Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

[PDO] Displaying output from prepare()?

 
   Database Help (Home) -> PHP RSS
Next:  CHeck version password-protected DB  
Author Message
Gilles Ganault

External


Since: Jan 13, 2008
Posts: 90



(Msg. 1) Posted: Tue Oct 07, 2008 12:25 pm
Post subject: [PDO] Displaying output from prepare()?
Archived from groups: comp>lang>php (more info?)

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.

 >> Stay informed about: [PDO] Displaying output from prepare()? 
Back to top
Login to vote
Jerry Stuckle

External


Since: Aug 11, 2004
Posts: 3530



(Msg. 2) Posted: Tue Oct 07, 2008 12:25 pm
Post subject: Re: [PDO] Displaying output from prepare()? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Gilles Ganault wrote:
> 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 RemoveThis @attglobal.net
==================

 >> Stay informed about: [PDO] Displaying output from prepare()? 
Back to top
Login to vote
Erwin Moller

External


Since: Dec 08, 2007
Posts: 304



(Msg. 3) Posted: Tue Oct 07, 2008 1:25 pm
Post subject: Re: [PDO] Displaying output from prepare()? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Gilles Ganault schreef:
> 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/
============================
 >> Stay informed about: [PDO] Displaying output from prepare()? 
Back to top
Login to vote
Álvaro_G._Vicario

External


Since: Apr 11, 2008
Posts: 980



(Msg. 4) Posted: Tue Oct 07, 2008 1:25 pm
Post subject: Re: [PDO] Displaying output from prepare()? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Gilles Ganault escribió:
> 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
--
 >> Stay informed about: [PDO] Displaying output from prepare()? 
Back to top
Login to vote
Gilles Ganault

External


Since: Jan 13, 2008
Posts: 90



(Msg. 5) Posted: Tue Oct 07, 2008 1:25 pm
Post subject: Re: [PDO] Displaying output from prepare()? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Tue, 07 Oct 2008 12:17:14 -0400, Jerry Stuckle
<jstucklex RemoveThis @attglobal.net> wrote:
>Unfortunately not.

Too bad. Thanks guys.
 >> Stay informed about: [PDO] Displaying output from prepare()? 
Back to top
Login to vote
Michael Fesser

External


Since: Dec 17, 2007
Posts: 867



(Msg. 6) Posted: Wed Oct 08, 2008 3:25 pm
Post subject: Re: [PDO] Displaying output from prepare()? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

..oO(Gilles Ganault)

>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
 >> Stay informed about: [PDO] Displaying output from prepare()? 
Back to top
Login to vote
Display posts from previous:   
   Database Help (Home) -> PHP All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]