[Dbix-class] last insert ID from MSSQL?
Marc Mims
marc at questright.com
Fri Nov 2 18:54:37 GMT 2007
* Christopher H. Laco <claco at chrislaco.com> [071102 11:40]:
> I have MSSQL at work, although I've never ever tried to hooking
> perl/DBIC up to it. I'd be happy to test it if you could supply some
> details.
>
> Are you on *nix connecting to an MSSQL server via FreeTDS, or on
> windows machine connecting to an MSSQL server via ODBC?
There's not much to share in the way of details. :-)
Without this module, DBIC doesn't know anything about the backend
database, so doesn't know how to PK::Auto or what SQLA Limit dialect to
use. DBIx::Class::Storage::DBI::ODBC uses $dbh->get_info(17), to
discover the backend database, attempts to load a module based on the
name returned (in this case
DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server). It provides
_dbh_last_insert_id and _sql_maker_opts.
So, to test it, just add the included lib to your perl environment,
insert records with identity keys, in a MSSQL DB and ensure you get back
the proper PK. Also testing the limit/offset search attributes would be
helpful. MSSQL apparently uses the Top dialect.
The original poster is using FreeTDS, I believe, but this module should
work for from Windows or *nix over an ODBC connection.
I don't have or use MSSQL myself, so I have no way of testing. The only
test included, so far, ensures that if the ODBC driver is used, and
MSSQL is detected, $storage is properly reblessed.
-Marc
More information about the DBIx-Class
mailing list