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

Matt S Trout dbix-class at trout.me.uk
Thu Feb 1 09:32:15 GMT 2007


On 31 Jan 2007, at 21:43, Josef Karthauser wrote:

> 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.

That should work, unless it's possible to determine the far end by  
introspecting the $dbh (ISTR the ODBC driver does this)

>
> I'd welcome opinions on this.
>
> Thanks,
> Joe
> _______________________________________________
> List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
> Searchable Archive: http://www.mail-archive.com/dbix- 
> class at lists.rawmode.org/

-- 
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support contracts for  
Catalyst,
DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for  
details.
+ Help us build a better perl ORM: http://dbix- 
class.shadowcatsystems.co.uk/ +





More information about the Dbix-class mailing list