Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old October 7th, 2008, 04:45 PM
Gilles Ganault
Guest
 
Posts: n/a
Default [PDO] Displaying output from prepare()?

Hello

I use the prepare/execute combo to generate SQL statements. Is it
possible to actually see what PDO creates with prepare()?

=======
$sql = "INSERT INTO mytable (id, label) VALUES (NULL,?)";
$insert = $dbh->prepare($sql);

//Display SQL before running it

$insert->execute(array($argv[1]));
=======

Thank you.
  #2  
Old October 7th, 2008, 05:25 PM
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: [PDO] Displaying output from prepare()?

Gilles Ganault wrote:
Quote:
Hello
>
I use the prepare/execute combo to generate SQL statements. Is it
possible to actually see what PDO creates with prepare()?
>
=======
$sql = "INSERT INTO mytable (id, label) VALUES (NULL,?)";
$insert = $dbh->prepare($sql);
>
//Display SQL before running it
>
$insert->execute(array($argv[1]));
=======
>
Thank you.
>
Unfortunately not.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

  #3  
Old October 7th, 2008, 05:35 PM
Erwin Moller
Guest
 
Posts: n/a
Default Re: [PDO] Displaying output from prepare()?


Gilles Ganault schreef:
Quote:
Hello
>
I use the prepare/execute combo to generate SQL statements. Is it
possible to actually see what PDO creates with prepare()?
>
=======
$sql = "INSERT INTO mytable (id, label) VALUES (NULL,?)";
$insert = $dbh->prepare($sql);
>
//Display SQL before running it
>
$insert->execute(array($argv[1]));
=======
>
Thank you.
Hi Gilles,

As far as I know: No.
However, if you are on a bughunt, you can probably ask your database
itself to log anything that is executed against it in a logfile.

Regards,
Erwin Moller

--
============================
Erwin Moller
Now dropping all postings from googlegroups.
Why? http://improve-usenet.org/
============================
  #4  
Old October 7th, 2008, 05:45 PM
=?ISO-8859-1?Q?=22=C1lvaro_G=2E_Vicario=22?=
Guest
 
Posts: n/a
Default Re: [PDO] Displaying output from prepare()?

Gilles Ganault escribió:
Quote:
I use the prepare/execute combo to generate SQL statements. Is it
possible to actually see what PDO creates with prepare()?
I guess you want to see the SQL query with the value of your parameters,
something like: INSERT INTO mytable (id, label) VALUES (NULL,'Foo Bar')

I suppose these internals depend on the driver but I'd dare say that
"INSERT INTO mytable (id, label) VALUES (NULL,?)" is what's actually
sent to the database server, with the values being sent separately.

--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
  #5  
Old October 7th, 2008, 05:45 PM
Gilles Ganault
Guest
 
Posts: n/a
Default Re: [PDO] Displaying output from prepare()?

On Tue, 07 Oct 2008 12:17:14 -0400, Jerry Stuckle
<jstucklex@attglobal.netwrote:
Quote:
>Unfortunately not.
Too bad. Thanks guys.
  #6  
Old October 8th, 2008, 08:15 PM
Michael Fesser
Guest
 
Posts: n/a
Default Re: [PDO] Displaying output from prepare()?

..oO(Gilles Ganault)
Quote:
>I use the prepare/execute combo to generate SQL statements. Is it
>possible to actually see what PDO creates with prepare()?
See <news:em6a35-1r3.ln1@ophelia.g5n.co.uk>.

Micha
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles