MDB2 help needed
am 12.06.2008 17:15:12 von Yves Sucaet
Hello,
What's the equivalent of mysql_error() and mysql_errno() in MDB2?
When I'm sending an incorrect SQL-statement to the server and it fails, a=
ll
I'm getting is "MDB2 Error: syntax error".
Thanks in advance,
Yves Sucaet
Iowa State University
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: MDB2 help needed
am 12.06.2008 17:27:27 von Laura Longo
Hi Yves,
to understand if an error is occured you can use the static method
Pear::isError($db) where $db is an instance of MDB2 object.
To get the specific error you can use the MDB2 method getMessage()
($db->getMessage()).
Hope this help,
Laura
> Hello,
>
> What's the equivalent of mysql_error() and mysql_errno() in MDB2?
>
> When I'm sending an incorrect SQL-statement to the server and it fails, all
> I'm getting is "MDB2 Error: syntax error".
>
> Thanks in advance,
>
> Yves Sucaet
> Iowa State University
>
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: MDB2 help needed
am 12.06.2008 20:30:06 von Yves Sucaet
Thanks for trying to help, but that's what I'm doing already. =
I already know if something's wrong. But instead of a MySQL error referen=
ce
I'm only getting "MDB2 Error: syntax error" in return from the getMessage=
()
function. I want to obtain more info regarding the error (such as foreign=
key
constraint incompatilibities). Obviously I can copy the query subsequentl=
y to
SQLyog or another tool, but that takes more time.
Yves
------ Original Message ------
Received: Thu, 12 Jun 2008 10:25:02 AM CDT
From: Laura Longo
To: php-db@lists.php.net
Subject: Re: [PHP-DB] MDB2 help needed
Hi Yves,
to understand if an error is occured you can use the static method
Pear::isError($db) where $db is an instance of MDB2 object.
To get the specific error you can use the MDB2 method getMessage()
($db->getMessage()).
Hope this help,
Laura
> Hello,
> =
> What's the equivalent of mysql_error() and mysql_errno() in MDB2?
> =
> When I'm sending an incorrect SQL-statement to the server and it fails,=
all
> I'm getting is "MDB2 Error: syntax error".
> =
> Thanks in advance,
> =
> Yves Sucaet
> Iowa State University
> =
> =
> =
-- =
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: MDB2 help needed
am 12.06.2008 22:04:24 von James Lucas
Hi Yves,
As the error object should be an PEAR_Error object then the function
$result->getUserInfo() should give you the information you need.
An example being:
$record_sql = "SELECT * FROM non_existent_table";
$record_result =& $mdb2->query($record_sql);
if (PEAR::isError($record_result))
{
print_r($record_result->getUserInfo());
}
returns:
_doQuery: [Error message: Could not execute statement]
[Last executed query: SELECT * FROM non_existent_table]
[Native code: 1146]
[Native message: Table 'database.non_existent_table' doesn't exist]
Regards
James
YVES SUCAET wrote:
> Thanks for trying to help, but that's what I'm doing already.
>
> I already know if something's wrong. But instead of a MySQL error reference
> I'm only getting "MDB2 Error: syntax error" in return from the getMessage()
> function. I want to obtain more info regarding the error (such as foreign key
> constraint incompatilibities). Obviously I can copy the query subsequently to
> SQLyog or another tool, but that takes more time.
>
> Yves
>
> ------ Original Message ------
> Received: Thu, 12 Jun 2008 10:25:02 AM CDT
> From: Laura Longo
> To: php-db@lists.php.net
> Subject: Re: [PHP-DB] MDB2 help needed
>
> Hi Yves,
> to understand if an error is occured you can use the static method
> Pear::isError($db) where $db is an instance of MDB2 object.
> To get the specific error you can use the MDB2 method getMessage()
> ($db->getMessage()).
>
> Hope this help,
>
> Laura
>
>
>> Hello,
>>
>> What's the equivalent of mysql_error() and mysql_errno() in MDB2?
>>
>> When I'm sending an incorrect SQL-statement to the server and it fails, all
>> I'm getting is "MDB2 Error: syntax error".
>>
>> Thanks in advance,
>>
>> Yves Sucaet
>> Iowa State University
>>
>>
>>
>>
>
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php