Does This Mean Me??

In an odd turn of fate as I was just about to write today's post. I got this email announcing the release of DBI 1.6.31, normally this causes me little concern as DBI has been stable for a very very long time, but given yesterdays Part 18 and this line in the change file

Changed the handle passed to Callbacks from being an 'inner' handle to being an 'outer' handle.

I though maybe I should look at this change?

Are You an Innie or Outie

I'll start by giving the 25 cent tour of inner and outer handles. DBI has been using Tied Hashes since time immemorial, and all handles in DBI are references to tied hashes so you never really get a $dbh or $sth object just a reference to it.

Not to disembowel too greatly DBI and DBDs when your DBD is loaded you get both an inner and outer hash ref, where the inner ref is your DBD/DBI version and the outer is the instance or your app's version of it. As you create new handles from your $dbh the references are tied as well, inheriting from the handle that created it.

That's about as far as I want to go, as this is suppose to be a short post, because deep down creating new handles is accomplished with XS code to speed things up, unless you are using the pure perl version of DBI.

So the $dbh handle you get from a 'connect' is the reference to an outer hash that is tied to an inner hash that actually holds your data.

So with DBI 1.6.31 callbacks are now getting this reference rather than the reference to the hash that has the data.

Now what does this change mean to me? Well to me it makes no difference, however if someone was using callbacks with swapped handles it could be a problem as you may now get a reference to a hash-ref rather than a reference to a reference?

In the end;

Long answer with a but,

'doesn't effect my code'

Short answer with a maybe,

'does effect code'

I guess I will have to go out and check a few things later today?

Leave a comment

About byterock

user-pic Long time Perl guy, a few CPAN mods allot of work on DBD::Oracle and a few YAPC presentations