You have it correct. The following line will only call the function once:
return ($row = get_db_row()) ? $row : get_empty_row();
Some code to prove this:
$counter = 0;
function test() {
global $counter;
$counter++;
return true;
}
$var = ($ret = test()) ? $ret : 'bar';
echo sprintf("#1 called the function %d times\n", $counter);
$counter = 0;
$var = ($ret = test()) ? test() : 'bar';
echo sprintf("#2 called the function %d times", $counter);
Outputs:
#1 called the function 1 times
#2 called the function 2 times