improving the error message for executeEmulateQuery
| From: | Vinai Kopp | Date: | Thu, 25 Oct 2001 11:32:30 +0000 |
| Subject: | improving the error message for executeEmulateQuery | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-2372@lists.php.net to get a copy of this message | ||
Hello,
handing a invalid statement to $db->execute() raised an error with the last SQL statement as debuginfo.
It cost stupid me quite some time, because I started looking for the mistake around that SQL statement.
I didn't find the location in the code where the last_query is used as debuginfo, but I think it would be a good idea to have a message like "invalid statement identifier" or something similiar instead.
This works for me (in common.php, executeEmulateQuery()):
if (!isset($this->prepare_tokens[$stmt]) ||
!is_array($this->prepare_tokens[$stmt]) ||
!sizeof($this->prepare_tokens[$stmt]))
{
return $this->raiseError(DB_ERROR_INVALID, null, null, 'invalid statement identifier');
}
Vinai