[Dbix-class] Storage::DBI::MSSQL
Marc Mims
marc at questright.com
Thu Jan 3 00:59:57 GMT 2008
Back in October, I responded to a request from Michael Higgins on this
list for help with last insert ID for MSSQL over ODBC.
http://lists.scsys.co.uk/pipermail/dbix-class/2007-October/005107.html
I don't use MSSQL myself, so Michael tested the resulting module and I
committed it to 0.08/trunk, today.
http://dev.catalyst.perl.org/svnweb/bast/view/DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
There is another MSSQL storage module in tree, written by Brian Cassidy,
Storage::DBI::MSSQL.
In the new, ODBC::Microsoft_SQL_Server, I used SELECT SCOPE_IDENTITY
which is a bit safer than the @@IDENTITY used in Storage::DBI::MSSQL,
especially in the presence of triggers. It required a bit more hoop
jumping, though, since SCOPE_IDENTITY must be called in the same execute
call, not just the same connection.
Both modules should probably share the same implementation. I discussed
that briefly with Brian, via e-mail, and he gave me permission to make
any changes necessary to the MSSQL module he authored.
I'd be happy to do that, but since I don't actually use MSSQL myself and
don't have a system to test with both DBD::Sybase and DBD::ODBC, I could
use some help. If someone else with interest in the MSSQL code wants to
jump in, or if someone can offer me access to a system for testing, we
can eliminate a bit of code by sharing the same implementation for both.
In fact, if my implementation works for Storage::DBI::MSSQL, then
DBI::ODBC::Microsoft_SQL_Server can probably be reduced to single line
of code:
use base qw/DBIx::Class::Storage::DBI::MSSQL/;
-Marc
More information about the DBIx-Class
mailing list