This queue is for tickets about the Class-DBI CPAN distribution.

Report information
The Basics
Id:
33503
Status:
new
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
mschwern [...] cpan.org
Cc:
AdminCc:

BugTracker
Severity:
Unimportant
Broken in:
(no value)
Fixed in:
(no value)



Subject: Test that update() throws out it's data and reloads
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Charset: utf8
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1203642623-32655-1"
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 365
Attached is a test to make sure that update() throws out its data so it can be lazily reloaded from the database. This is in case the database alters the data on update, like with a trigger. I did this as part of testing DBIx::Class::CDBICompat. CDBICompat contains many more small additional functionality tests like this to make CDBICompat work just like CDBI.
Subject: lazy_update.patch
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_1203642623-32655-0"
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Charset: utf8
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 0
Content-Type: application/octet-stream; name="lazy_update.patch"
Content-Disposition: inline; filename="lazy_update.patch"
Content-Transfer-Encoding: base64
Content-Length: 700
--- t/04-lazy.t (revision 54551) +++ t/04-lazy.t (local) @@ -7,7 +7,7 @@ BEGIN { eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 25); + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 27); } INIT { @@ -76,3 +76,25 @@ }; ok($@, $@); + +# Test that update() throws out columns that changed +{ + my $l = Lazy->create({ + this => 99, + that => 2, + oop => 3, + opop => 4, + }); + + $l->oop(32); + $l->update; + + ok $l->db_Main->do(qq{ + UPDATE @{[ $l->table ]} + SET oop = ? + WHERE this = ? + }, undef, 23, $l->this); + + is $l->oop, 23; +} +


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.