[prev] [thread] [next] [Date index for 2004/10/20]
------=_20041020104414_17762 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit After some more testing, I realized the changes I made to Class::DBI:Sybase were not enough. Attached is 0.3 which correctly deals with last_insert_id behaviour.. sorry about that --mike >> On Tue, Oct 19, 2004 at 11:56:19AM -0500, Michael Wojcikiewicz wrote: >>> Attached is a patch (and full file) for allowing auto-generation of >>> values >>> for IDENTITY columns in Sybase. It relies on the fact that sp_help > returns the right info regarding IDENTITY columns (works in sybase > 12.5.2). >>> Comments? Suggestions? Bugs?? >> >> Just curious why you'd going through the DBI prepare-execute-fetch > cycle, rather than the normal Class::DBI set-sql approach? > > I was just following the coding convention that was in the 0.1 release. I > guess it seems like overkill to use set_sql for a built-in command (like > sp_columns or sp_help) or for a statement as simple as 'SELECT > @@IDENTITY'. I could convert to use set_sql if that is desired. > > --mike > > > ------=_20041020104414_17762 Content-Type: application/octet-stream; name="Sybase.pm" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="Sybase.pm" cGFja2FnZSBDbGFzczo6REJJOjpTeWJhc2U7Cgo9aGVhZDEgTkFNRQoKQ2xhc3M6OkRCSTo6U3li YXNlIC0gRXh0ZW5zaW9ucyB0byBDbGFzczo6REJJIGZvciBTeWJhc2UKCj1oZWFkMSBTWU5PUFNJ UwoKICBwYWNrYWdlIE11c2ljOjpEQkk7CiAgdXNlIGJhc2UgJ0NsYXNzOjpEQkk6OlN5YmFzZSc7 CiAgTXVzaWM6OkRCSS0+c2V0X2RiKCdNYWluJywgJ2RiaTpTeWJhc2U6c2VydmVyPSRzZXJ2ZXIn LCAndXNlcm5hbWUnLCAncGFzc3dvcmQnKTsKCiAgcGFja2FnZSBBcnRpc3Q7CiAgdXNlIGJhc2Ug J011c2ljOjpEQkknOwogIF9fUEFDS0FHRV9fLT5zZXRfdXBfdGFibGUoJ0FydGlzdCcpOwogIAog ICMgLi4uIHNlZSB0aGUgQ2xhc3M6OkRCSSBkb2N1bWVud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vIEdlbmVyYXRlZAoJCWZvciBt eSAkY29sdW1uIChrZXlzICUkZGF0YSkgewoJCQl1bmxlc3MgKCAkY29sdW1uIGVxICRpZGVudGl0 eV9jb2x1bW5zWzBdICkgewoJCQkJcHVzaCBAY29sdW1ucywgJGNvbHVtbjsKCQkJCXB1c2ggQHZh bHVlcywgJGRhdGEgLT4geyRjb2x1bW59OwoJCQl9CgkJfQogICAgICAgIG15ICRzdGggPSAkc2Vs Zi0+c3FsX01ha2VOZXdPYmooCiAgICAgICAgICAgIGpvaW4oJywgJywgQGNvbHVtbnMpLAogICAg ICAgICAgICBqb2luKCcsICcsIG1hcCAkc2VsZi0+X2NvbHVtbl9wbGFjZWhvbGRlcigkXyksIEBj b2x1bW5zKSwKCQkJCQkJCQkJCQkpOwogICAgICAgICRzZWxmLT5fYmluZF9wYXJhbSgkc3RoLCBc QGNvbHVtbnMpOwogICAgICAgICRzdGgtPmV4ZWN1dGUoQHZhbHVlcyk7CgoJCW15ICRpZCA9ICRz dGggLT4gZmV0Y2hyb3dfYXJyYXlyZWYoKSAtPiBbMF07CgogICAgICAgICRkYXRhLT57ICRpZGVu dGl0eV9jb2x1bW5zWzBdIH0gPSAkaWQKICAgICAgICAgICAgaWYgQGlkZW50aXR5X2NvbHVtbnMg PT0gMQogICAgICAgICAgICAmJiAhZGVmaW5lZCAkZGF0YS0+eyAkaWRlbnRpdHlfY29sdW1uc1sw XSB9OwogICAgfTsKICAgIGlmICgkQCkgewogICAgICAgIG15ICRjbGFzcyA9IHJlZiAkc2VsZjsK ICAgICAgICByZXR1cm4gJHNlbGYtPl9jcm9haygKICAgICAgICAgICAgIkNhbid0IGluc2VydCBu ZXcgJGNsYXNzOiAkQCIsCiAgICAgICAgICAgIGVyciAgICA9PiAkQCwKICAgICAgICAgICAgbWV0 aG9kID0+ICdjcmVhdGUnCgkJCQkJCQkgKTsKICAgIH0KICAgIHJldHVybiAxOwp9CgoxOwoKX19F TkRfXwo= ------=_20041020104414_17762--
Class::DBI::Sybase patch (for IDENTITY columns)
|
Re: Class::DBI::Sybase patch (for IDENTITY columns)
|
Re: Class::DBI::Sybase patch (for IDENTITY columns)
|
another Class::DBI::Sybase patch (0.3)
|
Generated at 11:34 on 01 Dec 2004 by mariachi v0.52