Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

How to Retrieve Table Name from Statement Handle
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

Report this thread to moderator Post Follow-up to this message
Old Post
Lamb Joseph
05-08-08 12:09 AM


Re: How to Retrieve Table Name from Statement Handle
Hmmm, 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/


Report this thread to moderator Post Follow-up to this message
Old Post
Alexander Foken
05-08-08 12:09 AM


Re: How to Retrieve Table Name from Statement Handle
On 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."


Report this thread to moderator Post Follow-up to this message
Old Post
Jonathan Leffler
05-08-08 12:09 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL DBI archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:22 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.