[CDBI] Bug with sequences and the object cache ( I think )

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

From: Edmund von der Burg
Subject: [CDBI] Bug with sequences and the object cache ( I think )
Date: 17:06 on 09 Nov 2005
------=_Part_14313_26537094.1131556017057
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hello,

I came across some odd behaviour in Class::DBI and have reduced it
down to the attached test script.

It involves sequences - when a primary key is created from a sequence
then the object is not correctly fetched from / stored in  the object
cache which leads to there being two objects in memory at once. My
guess is that the identifier is being looked at differently / maybe a
string/integer thing. I haven't dug into the sources so this is just a
guess.

The test needs a postgres database called 'cdbi_test'. It creates the
tables and sequences that it needs and then clears them out at the
end. As SQLite does not have sequences I did not know how to go about
getting this working with that.

Tested against CDBI version 'v3.0.12'.

Attached - the test script and the output that I get.

Cheers,
  Edmund.

--
In reality I'm evdb@xxxxxxxxxx.xx.xx - http://ecclestoad.co.uk

------=_Part_14313_26537094.1131556017057
Content-Type: text/plain; name="output.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="output.txt"

IyAkQ2xhc3M6OkRCSTo6VkVSU0lPTjogJ3YzLjAuMTInCiMgQ3JlYXRpbmcgdGFibGVzIGFuZCBz
ZXF1ZW5jZQpOT1RJQ0U6ICBDUkVBVEUgVEFCTEUgLyBQUklNQVJZIEtFWSB3aWxsIGNyZWF0ZSBp
bXBsaWNpdCBpbmRleCAicGFyZW50c19wa2V5IiBmb3IgdGFibGUgInBhcmVudHMiCk5PVElDRTog
IENSRUFURSBUQUJMRSAvIFBSSU1BUlkgS0VZIHdpbGwgY3JlYXRlIGltcGxpY2l0IGluZGV4ICJj
aGlsZHJlbl9wa2V5IiBmb3IgdGFibGUgImNoaWxkcmVuIgojCiMgdXNpbmcgY2RiaV9pZDogMTAw
MDAwMAojCm9rIDEgLSBjcmVhdGUgdGVzdCBwYXJlbnQKb2sgMiAtIGNyZWF0ZSB0ZXN0IGNoaWxk
Cm9rIDMg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AgICAnbmFt
ZScgPT4gJ25ldyBuYW1lJywKIyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjZGJp
X2lkJyA9PiAnMicKIyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAnUGFyZW50JyAp
LAojICAgICAgICAgICAnJGNoaWxkLT5wYXJlbnQnID0+IGJsZXNzKCB7CiMgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgJ25hbWUnID0+ICd0ZXN0IHBhcmVudCcsCiMgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NkYmlfaWQnID0+ICcyJwojICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAnUGFyZW50JyApCiMgICAgICAg
ICB9OwojIERlc3Ryb3lpbmcgdGFibGVzIGFuZCBzZXF1ZW5jZQoxLi4xOAojIExvb2tzIGxpa2Ug
eW91IGZhaWxlZCAzIHRlc3RzIG9mIDE4LgoK
------=_Part_14313_26537094.1131556017057
Content-Type: application/x-troff; name="class-dbi-strangeness.t"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="class-dbi-strangeness.t"

IyBUaGlzIGlzIGEgdGVzdCB0byBzaG93IHVuZXhwZWN0ZWQgYmVoYXZpb3VyIHdpdGggcmVsYXRp
b24gdG8gJ29ubHkKIyBvbmUgb2JqZWN0IGluIG1lbW9yeScuIElmIGEgcm93IGlzIGFkZGVkIHRv
IHRoZSBkYXRhYmFzZSBhbmQgdGhlCiMgdmFsdWUgb2YgaXQncyBwcmltYXJ5IGtleSBjb21lcyBm
cm9tIGEgc2VxdWVuY2UgdGhlbiBpdCBpcyBub3QKIyBmZXRjaGVkIHByb3Blcmx5IGZyb20gdGhl
IG9iamVjdCBjYWNoZS4gVGhlIHNhbWUgYmVoYXZpb3VyIGlzIG5vdAojIHNob3duIGlmIGEgdmFs
dWUgaXMgZXhwbGljaXRseSBnaXZlbiBmb3IgdGhlIHByaW1hcnkga2V5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8oImRyb3Agc2VxdWVuY2UgY2RiaV9pZF9zZXEiKTsKCn0K
------=_Part_14313_26537094.1131556017057
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

------=_Part_14313_26537094.1131556017057--

[CDBI] Bug with sequences and the object cache ( I think )
Edmund von der Burg 17:06 on 09 Nov 2005

Generated at 18:17 on 10 Nov 2005 by mariachi v0.52