[Dbix-class] last insert ID from MSSQL?
Michael Higgins
linux at evolone.org
Wed Oct 17 00:48:49 GMT 2007
Folks --
Something changed to break the lousy hack I had to get this before...
can't figure it out from the related code and changes. Was doing a
"single" result on the auto_increment key, \"order by \"invoice #\"
desc" knd of thing. And it broke after an update of perl modules.
Anyway, being unable to find out what broke it, I found a way to do it
more directly... sort of.
In the interest of posting some working code, this is what I have come
up with:
The IDEA: "SELECT IDENT_CURRENT('tablename')"
The CODE:
our $last_bol = [$trex_schema->storage->dbh->selectall_arrayref("SELECT
IDENT_CURRENT('data')")]->[0]->[0]->[0];
... which actually works(!). At least, so it appears.
But, it seems like I should be able to do a ->last_insert_id or at
least come up with some something less... nested..??
Is it because I'm using freeTDS? IOW, is there some way to get MSSQL
quirks handled transparently with, like a
'schema->storage('::DBI::ODBC::MSSQL') type of call?
Any suggestions, advice helpful.
Cheers,
--
|\ /| | | ~ ~
| \/ | |---| `|` ?
| |ichael | |iggins \^ /
michael.higgins[at]evolone[dot]org
More information about the DBIx-Class
mailing list