Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to jump to row 0 on PostgreSQL result index (problem with GetRow()) #244

Closed
wesyah234 opened this issue May 13, 2016 · 3 comments
Closed
Labels
no change required pgsql PostgreSQL (Tier 1)

Comments

@wesyah234
Copy link
Contributor

wesyah234 commented May 13, 2016

I've typically used mysql and oracle and never seen this issue until using postgres. I've narrowed it down to using getRow when there are no rows found. using getRows() when there are no rows does not produce the error, just getRow().

code samples below:

function test_record_direct() {
  $dbconn = getNamedConnection();
  echo "calling getRow<br/>";
  $item = &$dbconn->GetRow('select * from doctor where doctor_id=13593999');
  echo "finished calling getRow<br/>";
  var_dump($item);
}

output:

calling getRow
(postgres8): select * from doctor where doctor_id=13593999 
  2016-05-13 16:31:43 -0500 /var/www/html/phpLiteFramework/thirdParty/dbAbstraction/adodb-5.20.4/drivers/adodb-postgres64.inc.php:1043 pg_fetch_array() [function.pg-fetch-array]: Unable to jump to row 0 on PostgreSQL result index 8
finished calling getRow
array(0) { } 

However, using getRows does not give the postgres error

function test_records_direct() {
  $dbconn = getNamedConnection();
  $rs = &$dbconn->Execute('select * from doctor where doctor_id=13593999');
  echo "calling getRows<br/>";
  $items = &$rs->GetRows();  
  echo "finished calling getRows<br/>";
  var_dump($items);
}

output:

 (postgres8): select * from doctor where doctor_id=13593999   
calling getRows
finished calling getRows
array(0) { } 
@mnewnham mnewnham added bug pgsql PostgreSQL (Tier 1) labels May 13, 2016
@mnewnham
Copy link
Contributor

What version of PHP are you using?

@mnewnham
Copy link
Contributor

It would seem that postgres would throw that error if you were trying to retrieve a row from an empty recordset See Here. The ADOdb code does have a silencer on it, so the error should just be ignored. Is it possible that there are custom error-handling overrides in place that might be causing it?

getRows wouldn't return such an error because it would just convert the empty recordset into an empty array.

@wesyah234
Copy link
Contributor Author

@mnewnham Thanks for looking at this... my apologies... yes, I do have a custom error handler, and I didn't realize it was presently configured to log everything to the output, including WARNING messages!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no change required pgsql PostgreSQL (Tier 1)
Projects
None yet
Development

No branches or pull requests

3 participants