Re: [CDBI] DBI's last_insert_id and Class::DBI's _auto_increment_value

[prev] [thread] [next] [Date index for 2005/11/21]

From: David Steinbrunner
Subject: Re: [CDBI] DBI's last_insert_id and Class::DBI's _auto_increment_value
Date: 20:47 on 21 Nov 2005
> This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

--B_3215432825_14574679
Content-type: text/plain;
	charset="US-ASCII"
Content-transfer-encoding: 7bit

Kingsley Kerce wrote:

> David -- Can you post code for the simplest test case for which you
> receive the "Can't get last insert id" error when running with
> PostgreSQL?

Attached is a simple script that I quickly put together.  I works under
MySQL and under Postgres when CDBI's _auto_increment_value uses
last_insert_id.

To get Postgres to work without modifying CDBI I have the sequence being
defined but that then breaks MySQL.  The sequence lines are currently
commented out in the script so you can test the first case first.

--
David Steinbrunner


--B_3215432825_14574679
Content-type: text/plain; name="last_insert_id.pl";
 x-mac-type="54455854"
Content-disposition: attachment;
	filename="last_insert_id.pl"
Content-transfer-encoding: base64

IyEvdXNyL2Jpbi9wZXJsCgp1c2Ugc3RyaWN0OwoKcGFja2FnZSBEQjsKdXNlIGJhc2UgJ0Ns
YXNzOjpEQkknOwoKIyBNeVNRTAojbXkgJGRiZCAgICA9ICdteXNxbCc7CiNteSAkZGJ1c2Vy
ID0gJ3Jvb3QnOwojbXkgJGRicGFzcyA9ICdwYXNzJzsKCiMgUG9zdGdyZXMKbXkgJGRiZCAg
ICA9ICdQZyc7Cm15ICRkYnVzZXIgPSAncG9zdGdyZXMnOwpteSAkZGJwYXNzID0gJ3Bhc3Mn
OwoKbXkgJGRibmFtZSA9ICd0JzsKbXkgJGRiaG9zdCA9ICcxMjcuMC4wLjEnOwoKbXkgJGRz
biA9ICdkYmk6JyAuICRkYmQgLiAnOmRibmFtZT0nIC4gJGRibmFtZSAuICc7aG9zdD0nIC4g
JGRiaG9zdDsKCl9fUEFDS0FHRV9fLT5jb25uZWN0aW9uKAogICAgJGRzbiwgJGRidXNlciwg
JGRicGFzcywKICAgIHsKICAgIC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1BBQ0tBR0VfXy0+aGFzX2EoIHJlZl9pZCA9PiAnREI6
OlRhYmxlMScgKTsKCnN1YiBjcmVhdGVfdGFibGUgewogICAgbXkgJHNlbGYgID0gc2hpZnQ7
CiAgICBteSAkZGJoICAgPSAkc2VsZi0+ZGJfTWFpbigpOwogICAgbXkgJHRhYmxlID0gPDxU
QUJMRTsKQ1JFQVRFIFRBQkxFIHRhYmxlMiAoCiAgaWQgU0VSSUFMIE5PVCBOVUxMLAogIHJl
Zl9pZCBJTlQgTk9UIE5VTEwKICAgIFJFRkVSRU5DRVMgdGFibGUxKGlkKSwKICBuYW1lIENI
QVIoMTIpIE5PVCBOVUxMLAogIFBSSU1BUlkgS0VZIChpZCkKKTsKVEFCTEUKICAgICRkYmgt
PmRvKCR0YWJsZSk7Cn0KCnBhY2thZ2UgbWFpbjsKCkRCOjpUYWJsZTEtPm5ldygpOwpEQjo6
VGFibGUyLT5uZXcoKTsKCkRCOjpUYWJsZTEtPmNyZWF0ZV90YWJsZTsKREI6OlRhYmxlMi0+
Y3JlYXRlX3RhYmxlOwoKbXkgJHRhYmxlMVJlYyA9IERCOjpUYWJsZTEtPmluc2VydCggeyBu
YW1lID0+ICd0YWJsZTFSZWMnLCB9ICk7CgpteSAkdGFibGUyUmVjID0KICBEQjo6VGFibGUy
LT5pbnNlcnQoIHsgcmVmX2lkID0+ICR0YWJsZTFSZWMtPmlkLCBuYW1lID0+ICd0YWJsZTJS
ZWMnLCB9ICk7Cgo=

--B_3215432825_14574679
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

--B_3215432825_14574679--



(message missing)

Re: [CDBI] DBI's last_insert_id and Class::DBI's _auto_increment_value
David Steinbrunner 20:47 on 21 Nov 2005

Generated at 19:11 on 22 Dec 2005 by mariachi v0.52