You would normally only expect $sth->{NAME} to be populated if the statement
handle was returning a result set, as in a SELECT statement.

BTW, as far as I know there in no point in the prepare/execute/finish
methods for the DDL stuff you are doing.  These are used in DML type stuff
(select, delete, update) when you are using placeholders to improve
efficiency (by avoiding re-parsing of the SQL) - so I would use the do
method.

Anyway, once you have done the alter table, you could do a 'select * from
foo where 1 = 0' and look at the NAME attribute on that statement handle.

Michael Fox

-----Original Message-----
From: Alex Krohn [mailto:[EMAIL PROTECTED]
Sent: Friday, 9 January 2004 10:13 AM
To: [EMAIL PROTECTED]
Subject: Re: fetching statement attribute NAME causes query to be
executed again


Hi Ron,

> > use DBI;
> > DBI->trace(3, "trace.log");
> > my $dbh = DBI->connect('DBI:ODBC:testdb', 'sa', '');
> > my $sth = $dbh->prepare("create table foo (a int)");
> > $sth->execute;
> 
> $sth -> finish();
> 
> > $sth = $dbh->prepare("alter table foo add b int");
> > $sth->execute;
> > my $names = $sth->{NAME};
> > $sth->finish; $dbh->disconnect;
> >
> > errors out with:

Thanks for the email, but no difference. I was under the impression that
finish wasn't needed in the above case, and all cleanup would happen at
destruction.

Cheers,

Alex

Australia Post is committed to providing our customers with excellent service. If we 
can assist you in any way please telephone 13 13 18 or visit our website 
www.auspost.com.au.

CAUTION

This e-mail and any files transmitted with it are privileged and confidential 
information intended for the use of the addressee. The confidentiality and/or 
privilege in this e-mail is not waived, lost or destroyed if it has been transmitted 
to you in error. If you have received this e-mail in error you must (a) not 
disseminate, copy or take any action in reliance on it; (b) please notify Australia 
Post immediately by return e-mail to the sender; and (c) please delete the original 
e-mail.

Reply via email to