Code Comments
Programming Forum and web based access to our favorite programming groups.I am creating a simple tool that will query one table and retrieve the data.
Then this tool will turn the data into insert statements.
I was wondering if there was a way to retrieve the table name from the state
ment handle?
Similar to print "SQL statement contains $sth->{NUM_OF_FIELDS} columns\n";
but like this
print "SQL statement table name is $sth->{TABLENAME} \n";
Joseph Lamb
________________________________________
____________________________________
________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06...tDypao8Wcj9tAcJ
Post Follow-up to this messageHmmm, and what do you think $sth->{TABLENAME} should contain after
executing the following SQL?
SELECT t1.foo,t2.bar FROM narf t1, zord t2 WHERE t1.ikes=t2.blurb
Alexander
On 07.05.2008 19:51, Lamb Joseph wrote:
> I am creating a simple tool that will query one table and retrieve the dat
a. Then this tool will turn the data into insert statements.
>
> I was wondering if there was a way to retrieve the table name from the sta
tement handle?
>
> Similar to print "SQL statement contains $sth->{NUM_OF_FIELDS} columns\n";
>
> but like this
>
> print "SQL statement table name is $sth->{TABLENAME} \n";
>
>
> Joseph Lamb
>
>
>
> ________________________________________
____________________________
________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu0<...tDypao8Wcj9tAcJ
>
--
Alexander Foken
mailto:alexander@foken.de http://www.foken.de/alexander/
Post Follow-up to this messageOn Wed, May 7, 2008 at 10:51 AM, Lamb Joseph <joseph_lamb@yahoo.com> wrote:
> I am creating a simple tool that will query one table and retrieve the
> data. Then this tool will turn the data into insert statements.
>
> I was wondering if there was a way to retrieve the table name from the
> statement handle?
>
> Similar to print "SQL statement contains $sth->{NUM_OF_FIELDS} columns\n";
>
> but like this
>
> print "SQL statement table name is $sth->{TABLENAME} \n";
>
Over and above Alexander's cogent (but gentle - the SQL could have been a
lot more complex than that) rebuttal, there's another question for you:
How did you decide which table to build the 'SELECT * FROM $table' query
from?
Can't you keep tabs on the table name from that?
(Succinctly - no, you can't tell the table name from the statement handle
because, in general, there isn't a single table name to report.)
--
Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h>
Guardian of DBD::Informix - v2008.0229 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.