rinceWind has asked for the wisdom of the Perl Monks concerning the following question:
after executing a query on $sth. To my surprise, I did not find this in the DBI documentation.$sth->{NAME}
This has aroused my curiousity. What else is hiding in a statement handle? However, examining with the debugger came as a shock:
I had expected $sth to be merely a blessed object implemented as a hash ref, and at least to contain the key 'NAME'. Looking at DBI.pm, I had a hint that the variable might be tied, aha.DB<3> x $sth 0 DBI::st=HASH(0x402426c0) empty hash
What's going on here? Where is the key 'NAME'? Or where is the tie FETCH method that gets called? I had a look in DBD::Oracle.pm but couldn't find anything there. DBI.pm does have several TIEHASHes, but no obvious FETCH routines, and no reference to a key of NAME.DB<4> x tied %$sth 0 DBI::st=HASH(0x400221f0) 'Database' => DBI::db=HASH(0x4026e6fc) empty hash 'Debug' => 0 'Err' => SCALAR(0x402326cc) -> undef 'Errstr' => SCALAR(0x402326fc) -> undef 'FetchHashKeyName' => 'NAME' 'Handlers' => ARRAY(0x40242684) empty array 'ImplementorClass' => 'DBD::Oracle::st' 'State' => SCALAR(0x401c98d0) -> undef 'Statement' => 'select * from my.foo_test' DB<5>
Any insight would be appreciated. Curiousity has certainly got the better of this cat. :-)
--rW
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: What's in a DBI statement handle?
by lachoy (Parson) on May 17, 2002 at 16:03 UTC | |
by rinceWind (Monsignor) on May 17, 2002 at 16:21 UTC | |
by mpeppler (Vicar) on May 17, 2002 at 19:32 UTC | |
|
Re: What's in a DBI statement handle?
by tadman (Prior) on May 17, 2002 at 16:01 UTC | |
by lachoy (Parson) on May 17, 2002 at 16:09 UTC | |
by demerphq (Chancellor) on May 17, 2002 at 17:21 UTC | |
by lachoy (Parson) on May 17, 2002 at 17:31 UTC |