RE: [PEAR] Re: PEAR:DB get the SQL String
| From: | Torsten Roehr | Date: | Sat, 13 Dec 2003 22:32:52 +0000 |
| Subject: | RE: [PEAR] Re: PEAR:DB get the SQL String | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9507@lists.php.net to get a copy of this message | ||
> From: Justin Patrin [mailto:papercrane@reversefold.com]
> Sent: Saturday, December 13, 2003 10:36 PM
> Marco Kundert wrote:
>
> > Hi all
> >
> > First of all im verry new with Pear and i'm surre this is e newbi
> question but i diden't found something in the manual or the archiv.
> >
> > I use the folling code to insert a row:
> >
> > $sth = $db->autoExecute($table_name, $table_fields,
> DB_AUTOQUERY_INSERT);
> >
> > With mysql everything works fine, but with sqlserver driver
> > die ($sth->getMessage());
> > ouput the folling error:
> > DB Error:
> >
> > Thats not mutch. Is there any possibillity to output the genereated SQL
> String from prepare, execute or autoexecute, that would be verry usefully.
> >
> > Thanks Marco
>
> Try ->getUserInfo() as well. If you use both, you'll get all you need.
Usually the DB methods return an error object if an error occurred. This
object contains detailed information about the error (e.g. the invalid SQL
statement). So you could do print_r($sth) to see all of it.
Lucas' hint to do $sth->getUserInfo() prints out a part of this object
information.
Best regards,
Torsten
--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php