[Dbix-class] can't get PK::Auto with MSSQL thru Sybase

Lee Standen nom at standen.id.au
Wed Sep 6 10:41:34 CEST 2006


Just further to this, if Sybase/MSSQL have a method to get the PK before 
an insert, you could look at PK::Sequence and writing a method into the 
DB driver to handle getting the next sequence :)

PK::Sequence is my little baby, posted on here a while back...no idea if 
it made it into the DBIC tree...




Robert Dobbs wrote:
>
>
>> > "It is not possible to retrieve the last IDENTITY value after an 
>> insert done
>> > with ?-style placeholders. This is a Sybase limitation/bug, not a
>> > DBD::Sybase problem. "
>> >
>> > Ergh. Anyone know a work-around for this? I searched the list 
>> archives a
>> > bit but didn't find anything recent.
>>
>> Somewhat related to this:
>> https://rt.cpan.org/Ticket/Display.html?id=21260
>>
>> If the DBB being used or the DB doesn't support it, what should DBIC
>> really do?
>>
>> Personally, I think failing is the only sane answer. I'd much rather
>> find out something isn't going to work that way, rather than 2 hours
>> later when the data is bogon.
>>
>> That's assuming there isn't another way to fix this issue...
>
> Merp... from DBI manpage under the explicit function "last_insert_id":
>
> * For some drivers the value may only be available if placeholders
> have not been used (e.g., Sybase, MS SQL). In this case the value
> returned would be from the last non-placeholder insert statement.
>
> Bleah. I guess I have to use SQL and be very careful about 
> de-sqlifying input.
>
> Mark
>
> _________________________________________________________________
> Windows Live Spaces is here! It’s easy to create your own personal Web 
> site. http://spaces.live.com/signup.aspx
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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@lists.rawmode.org/




More information about the Dbix-class mailing list