[Dbix-class] Determining the database version...

Josef Karthauser joe at tao.org.uk
Wed Jan 31 21:43:53 GMT 2007


Hi peeps,

Me again.  This time with a different question :).

The background is that I'm implementing nested transaction handling,
initially for mysql which can handle it using SAVEPOINTs.

What I'm bashing my head against currently is determining whether the
database that is connected to supports SAVEPOINTs or not.  This is easy
in principle, one just issues a 'SELECT VERSION()' call, reads the
response and determines whether that version supports this or not.

However, I don't want to have to issue this every time a
begin/commit/rollback is called.  So, I could call it once and then
cache the result.  However it is probably nicer to have this command
issued once, when the connect is made by the API, and the result cached
for the duration of the connection.

So this is the question then.  What's the smartest way of allowing
.../DBI/driver.pm to have arbitary SQL statements issued at connect
time?  I notice that there is already functionality for 'on_connect_do'
statements specified by the user.  It doesn't seem as if the return
value of any of these can be obtained though (I might be smoking crack
on this point - not looked too deeply yet).  Perhaps the database
drivers could hook into this mechanism in a transparent way.

I'd welcome opinions on this.

Thanks,
Joe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20070131/eb39c5b6/attachment.pgp


More information about the Dbix-class mailing list