[prev] [thread] [next] [Date index for 2004/06/01]
--=====================_37055984==.ALT Content-Type: text/plain; charset="us-ascii" I have been using cdbi 0.94 for several months in a rather large webapp. Today a change in behaviour was detected after updating to 0.96. Essentially what happens is that data becomes 'invisible' after an update! Using the following database table (it is one in my normal development database) and the test code and the myCDBI.pm module I can replicate the problem. When the code is run unmodified (with the $alter_int object having the update method run on it) the second call to &disp_data produces no output. If you comment out the $alter_int->update line there IS output. Have I stumbled upon a bug? Environment is: perl 5.8.1 on RH9.0, cdbi 0.96 installed from cpan. test programme: #!/usr/local/bin/perl; use warnings; use strict; use Data::Dumper; use myCDBI; print "Data at start\n"; &disp_data; my $alter_int = AppSys::BusinessHours->retrieve( 'intervalid' => 9 ); my $results = $alter_int->hash; $alter_int->set( %{$results} ); $alter_int->update; print "Data at end\n"; &disp_data; sub disp_data { print "\n"; my $ints = AppSys::BusinessHours->search('providerid' => 4); while ( my $testint = $ints->next ) { print Dumper $testint; } } module: myCDBI.pm package AppSys::DBI; use base 'Class::DBI::mysql'; sub hash { my $self = shift; return { map { my $g = $self->get($_); $g = hashy($g) if ref $g; ( $_ => $g ); } $self->columns }; } AppSys::DBI->set_db('Main', 'DBI:mysql:apptsys', 'root', ''); package AppSys::BusinessHours; use base AppSys::DBI; __PACKAGE__->set_up_table("pr_businesshours"); 1; With this table: CREATE TABLE `pr_businesshours` ( `intervalid` int(11) NOT NULL auto_increment, `providerid` int(11) NOT NULL default '0', `personellid` int(11) NOT NULL default '0', `inttype` int(11) NOT NULL default '0', `intdow` int(11) NOT NULL default '0', `intstart` time default NULL, `intend` time default NULL, `intint` decimal(10,0) NOT NULL default '00', `defAptType` varchar(50) NOT NULL default '', PRIMARY KEY (`intervalid`), KEY `i2` (`intstart`) ) TYPE=MyISAM; #---------------------------- # Records for table pr_businesshours #---------------------------- insert into pr_businesshours values (1, 0, 0, 0, 0, '00:00:00', '00:00:00', '30', ''), (2, 0, 0, 0, 1, '08:00:00', '17:00:00', '30', ''), (3, 0, 0, 0, 2, '08:00:00', '17:00:00', '30', ''), (4, 0, 0, 0, 3, '08:00:00', '17:00:00', '30', ''), (5, 0, 0, 0, 4, '08:00:00', '17:00:00', '30', ''), (6, 0, 0, 0, 5, '08:00:00', '12:00:00', '30', ''), (7, 0, 0, 0, 5, '13:00:00', '21:00:00', '30', ''), (8, 0, 0, 0, 6, '08:00:00', '12:00:00', '30', ''), (9, 4, 0, 0, 0, '06:00:00', '17:50:00', '12', ''), (10, 4, 0, 0, 1, '06:00:00', '17:45:00', '15', '1'), (11, 4, 0, 0, 2, '06:00:00', '19:00:00', '15', '1'), (12, 4, 0, 0, 3, '06:00:00', '19:00:00', '15', '1'), (13, 4, 0, 0, 4, '06:00:00', '19:00:00', '15', '1'), (14, 4, 0, 0, 5, '06:00:00', '19:00:00', '15', '1'), (35, 6, 0, 0, 1, '08:00:00', '17:00:00', '30', ''), (16, 4, 0, 0, 6, '06:00:00', '19:00:00', '15', '2'), (34, 6, 0, 0, 0, '06:00:00', '18:00:00', '15', ''), (18, 5, 0, 0, 0, '06:00:00', '18:00:00', '15', ''), (19, 5, 0, 0, 1, '06:00:00', '18:00:00', '15', ''), (20, 5, 0, 0, 2, '06:00:00', '18:00:00', '15', ''), (21, 5, 0, 0, 3, '06:00:00', '18:00:00', '15', ''), (22, 5, 0, 0, 4, '06:00:00', '17:30:00', '15', ''), (23, 5, 0, 0, 5, '06:00:00', '18:00:00', '15', ''), (24, 5, 0, 0, 5, '06:00:00', '18:00:00', '15', ''), (25, 5, 0, 0, 6, '06:00:00', '18:00:00', '15', ''), (26, 1, 0, 0, 0, '09:00:00', '19:00:00', '30', ''), (27, 1, 0, 0, 1, '08:00:00', '17:00:00', '30', ''), (28, 1, 0, 0, 2, '08:00:00', '17:00:00', '30', ''), (29, 1, 0, 0, 3, '08:00:00', '17:00:00', '30', ''), (30, 1, 0, 0, 4, '08:00:00', '17:00:00', '30', ''), (31, 1, 0, 0, 5, '08:00:00', '12:00:00', '30', ''), (32, 1, 0, 0, 5, '13:00:00', '21:00:00', '30', ''), (33, 1, 0, 0, 6, '08:00:00', '12:00:00', '30', ''), (36, 6, 0, 0, 2, '08:00:00', '17:00:00', '30', ''), (37, 6, 0, 0, 3, '08:00:00', '17:00:00', '30', ''), (38, 6, 0, 0, 4, '08:00:00', '17:00:00', '30', ''), (39, 6, 0, 0, 5, '08:00:00', '12:00:00', '30', ''), (40, 6, 0, 0, 5, '13:00:00', '21:00:00', '30', ''), (41, 6, 0, 0, 6, '08:00:00', '12:00:00', '30', ''), (42, 8, 0, 0, 0, '00:00:00', '12:00:00', '30', ''), (43, 8, 0, 0, 1, '08:00:00', '12:15:00', '30', ''), (44, 8, 0, 0, 2, '08:00:00', '17:00:00', '30', ''), (45, 8, 0, 0, 3, '08:00:00', '17:00:00', '30', ''), (46, 8, 0, 0, 4, '08:00:00', '17:00:00', '30', ''), (47, 8, 0, 0, 5, '08:00:00', '12:00:00', '30', ''), (70, 8, 0, 0, 0, '12:00:00', '19:00:00', '30', ''), (49, 8, 0, 0, 6, '08:00:00', '08:37:30', '30', ''), (50, 9, 0, 0, 0, '06:00:00', '17:00:00', '15', ''), (51, 9, 0, 0, 1, '06:00:00', '17:00:00', '15', ''), (52, 9, 0, 0, 2, '06:00:00', '17:00:00', '15', ''), (53, 9, 0, 0, 3, '06:00:00', '17:00:00', '15', ''), (54, 9, 0, 0, 4, '06:00:00', '17:00:00', '15', ''), (55, 9, 0, 0, 5, '06:00:00', '17:00:00', '15', ''), (56, 9, 0, 0, 5, '06:00:00', '17:00:00', '15', ''), (57, 9, 0, 0, 6, '06:00:00', '17:00:00', '15', ''), (58, 10, 0, 0, 0, '06:00:00', '18:00:00', '15', ''), (59, 10, 0, 0, 1, '06:00:00', '17:00:00', '15', ''), (60, 10, 0, 0, 2, '06:00:00', '18:00:00', '15', ''), (61, 10, 0, 0, 3, '06:00:00', '18:00:00', '15', ''), (62, 10, 0, 0, 4, '06:00:00', '18:00:00', '15', ''), (63, 10, 0, 0, 5, '06:00:00', '18:00:00', '15', ''), (64, 10, 0, 0, 5, '06:00:00', '18:00:00', '15', ''), (65, 10, 0, 0, 6, '06:00:00', '18:00:00', '15', ''); --=====================_37055984==.ALT Content-Type: text/html; charset="us-ascii" <html> <body> I have been using cdbi 0.94 for several months in a rather large webapp. Today a change in behaviour was detected after updating to 0.96.<br><br> Essentially what happens is that data becomes 'invisible' after an update!<br><br> Using the following database table (it is one in my normal development database) and the test code and the myCDBI.pm module I can replicate the problem. When the code is run unmodified (with the $alter_int object having the update method run on it) the second call to &disp_data produces no output.<br><br> If you comment out the $alter_int->update line there IS output. Have I stumbled upon a bug?<br><br> Environment is: perl 5.8.1 on RH9.0, cdbi 0.96 installed from cpan.<br><br> <br> test programme:<br> <font color="#3A8C26">#!/usr/local/bin/perl;<br><br> </font><font color="#A020F0">use</font> warnings;<br> <font color="#A020F0">use</font> strict;<br><br> <font color="#A020F0">use</font> Data::Dumper;<br> <font color="#A020F0">use</font> myCDBI;<br><br> <br> <font color="#A02000">print</font> <font color="#0000FF">"Data at start\n"</font>;<br> <font color="#B22200">&</font>disp_data;<br><br> <font color="#A020F0">my</font> $<font color="#A000F0">alter_int </font><font color="#B22200">=</font> AppSys::BusinessHours<font color="#B22200">-></font>retrieve( <font color="#0000FF">'intervalid'</font> <font color="#B22200">=></font> <font color="#A02000">9</font> );<br><br> <font color="#A020F0">my</font> $<font color="#A000F0">results </font><font color="#B22200">=</font> $<font color="#A000F0">alter_int-</font><font color="#B22200">></font>hash;<br> $<font color="#A000F0">alter_int-</font><font color="#B22200">></font>set( %{$results} );<br> <font color="#3A8C26">$</font><font color="#A000F0">alter_int-</font><font color="#B22200">></font>update;<br><br> <font color="#A02000">print</font> <font color="#0000FF">"Data at end\n"</font>;<br> <font color="#B22200">&</font>disp_data;<br><br> <font color="#A020F0">sub</font> disp_data <font color="#B22200">{<br> </font><font color="#A02000">print</font> <font color="#0000FF">"\n"</font>;<br> <font color="#A020F0">my</font> $<font color="#A000F0">ints </font><font color="#B22200">=</font> AppSys::BusinessHours<font color="#B22200">-></font>search(<font color="#0000FF">'providerid'</font> <font color="#B22200">=></font> <font color="#A02000">4</font>);<br> <font color="#A020F0">while</font> ( <font color="#A020F0">my</font> $<font color="#A000F0">testint </font><font color="#B22200">=</font> $<font color="#A000F0">ints-</font><font color="#B22200">></font><font color="#A020F0">next</font> ) <font color="#B22200">{<br> </font><font color="#A02000">print</font> Dumper $<font color="#A000F0">testint;<br> </font><font color="#B22200">}<br> }<br><br> <br> </font>module: myCDBI.pm<br><br> <font color="#A020F0">package</font> AppSys::DBI;<br> <font color="#A020F0">use</font> base <font color="#0000FF">'Class::DBI::mysql'</font>;<br><br> <font color="#A020F0">sub</font> hash <font color="#B22200">{<br> </font><font color="#A020F0">my</font> $<font color="#A000F0">self </font><font color="#B22200">=</font> <font color="#A02000">shift</font>;<br> <font color="#A020F0">return</font> <font color="#B22200">{<br> </font><font color="#A02000">map</font> <font color="#B22200">{<br> </font><font color="#A020F0">my</font> $<font color="#A000F0">g </font><font color="#B22200">=</font> $<font color="#A000F0">self-</font><font color="#B22200">></font>get($<font color="#A000F0">_)</font>;<br> $<font color="#A000F0">g </font><font color="#B22200">=</font> hashy($<font color="#A000F0">g)</font> <font color="#A020F0">if</font> <font color="#A02000">ref</font> $<font color="#A000F0">g;<br> </font>( $<font color="#A000F0">_ </font><font color="#B22200">=></font> $<font color="#A000F0">g </font>);<br> <font color="#B22200">}<br> </font>$<font color="#A000F0">self-</font><font color="#B22200">></font>columns<br> <font color="#B22200">}</font>;<br> <font color="#B22200">}<br><br> <br> </font>AppSys::DBI<font color="#B22200">-></font>set_db(<font color="#0000FF">'Main'</font>, <font color="#0000FF">'DBI:mysql:apptsys'</font>, <font color="#0000FF">'root'</font>, <font color="#0000FF">''</font>);<br><br> <font color="#A020F0">package</font> AppSys::BusinessHours;<br> <font color="#A020F0">use</font> base AppSys::DBI;<br> __PACKAGE__<font color="#B22200">-></font>set_up_table(<font color="#0000FF">"pr_businesshours"</font>);<br><br> <br><br> <font color="#A02000">1</font>;<br><br> With this table:<br><br> CREATE TABLE `pr_businesshours` (<br> `intervalid` int(11) NOT NULL auto_increment,<br> `providerid` int(11) NOT NULL default '0',<br> `personellid` int(11) NOT NULL default '0',<br> `inttype` int(11) NOT NULL default '0',<br> `intdow` int(11) NOT NULL default '0',<br> `intstart` time default NULL,<br> `intend` time default NULL,<br> `intint` decimal(10,0) NOT NULL default '00',<br> `defAptType` varchar(50) NOT NULL default '',<br> PRIMARY KEY (`intervalid`),<br> KEY `i2` (`intstart`)<br> ) TYPE=MyISAM;<br> #----------------------------<br> # Records for table pr_businesshours<br> #----------------------------<br><br> <br> insert into pr_businesshours values <br> (1, 0, 0, 0, 0, '00:00:00', '00:00:00', '30', ''), <br> (2, 0, 0, 0, 1, '08:00:00', '17:00:00', '30', ''), <br> (3, 0, 0, 0, 2, '08:00:00', '17:00:00', '30', ''), <br> (4, 0, 0, 0, 3, '08:00:00', '17:00:00', '30', ''), <br> (5, 0, 0, 0, 4, '08:00:00', '17:00:00', '30', ''), <br> (6, 0, 0, 0, 5, '08:00:00', '12:00:00', '30', ''), <br> (7, 0, 0, 0, 5, '13:00:00', '21:00:00', '30', ''), <br> (8, 0, 0, 0, 6, '08:00:00', '12:00:00', '30', ''), <br> (9, 4, 0, 0, 0, '06:00:00', '17:50:00', '12', ''), <br> (10, 4, 0, 0, 1, '06:00:00', '17:45:00', '15', '1'), <br> (11, 4, 0, 0, 2, '06:00:00', '19:00:00', '15', '1'), <br> (12, 4, 0, 0, 3, '06:00:00', '19:00:00', '15', '1'), <br> (13, 4, 0, 0, 4, '06:00:00', '19:00:00', '15', '1'), <br> (14, 4, 0, 0, 5, '06:00:00', '19:00:00', '15', '1'), <br> (35, 6, 0, 0, 1, '08:00:00', '17:00:00', '30', ''), <br> (16, 4, 0, 0, 6, '06:00:00', '19:00:00', '15', '2'), <br> (34, 6, 0, 0, 0, '06:00:00', '18:00:00', '15', ''), <br> (18, 5, 0, 0, 0, '06:00:00', '18:00:00', '15', ''), <br> (19, 5, 0, 0, 1, '06:00:00', '18:00:00', '15', ''), <br> (20, 5, 0, 0, 2, '06:00:00', '18:00:00', '15', ''), <br> (21, 5, 0, 0, 3, '06:00:00', '18:00:00', '15', ''), <br> (22, 5, 0, 0, 4, '06:00:00', '17:30:00', '15', ''), <br> (23, 5, 0, 0, 5, '06:00:00', '18:00:00', '15', ''), <br> (24, 5, 0, 0, 5, '06:00:00', '18:00:00', '15', ''), <br> (25, 5, 0, 0, 6, '06:00:00', '18:00:00', '15', ''), <br> (26, 1, 0, 0, 0, '09:00:00', '19:00:00', '30', ''), <br> (27, 1, 0, 0, 1, '08:00:00', '17:00:00', '30', ''), <br> (28, 1, 0, 0, 2, '08:00:00', '17:00:00', '30', ''), <br> (29, 1, 0, 0, 3, '08:00:00', '17:00:00', '30', ''), <br> (30, 1, 0, 0, 4, '08:00:00', '17:00:00', '30', ''), <br> (31, 1, 0, 0, 5, '08:00:00', '12:00:00', '30', ''), <br> (32, 1, 0, 0, 5, '13:00:00', '21:00:00', '30', ''), <br> (33, 1, 0, 0, 6, '08:00:00', '12:00:00', '30', ''), <br> (36, 6, 0, 0, 2, '08:00:00', '17:00:00', '30', ''), <br> (37, 6, 0, 0, 3, '08:00:00', '17:00:00', '30', ''), <br> (38, 6, 0, 0, 4, '08:00:00', '17:00:00', '30', ''), <br> (39, 6, 0, 0, 5, '08:00:00', '12:00:00', '30', ''), <br> (40, 6, 0, 0, 5, '13:00:00', '21:00:00', '30', ''), <br> (41, 6, 0, 0, 6, '08:00:00', '12:00:00', '30', ''), <br> (42, 8, 0, 0, 0, '00:00:00', '12:00:00', '30', ''), <br> (43, 8, 0, 0, 1, '08:00:00', '12:15:00', '30', ''), <br> (44, 8, 0, 0, 2, '08:00:00', '17:00:00', '30', ''), <br> (45, 8, 0, 0, 3, '08:00:00', '17:00:00', '30', ''), <br> (46, 8, 0, 0, 4, '08:00:00', '17:00:00', '30', ''), <br> (47, 8, 0, 0, 5, '08:00:00', '12:00:00', '30', ''), <br> (70, 8, 0, 0, 0, '12:00:00', '19:00:00', '30', ''), <br> (49, 8, 0, 0, 6, '08:00:00', '08:37:30', '30', ''), <br> (50, 9, 0, 0, 0, '06:00:00', '17:00:00', '15', ''), <br> (51, 9, 0, 0, 1, '06:00:00', '17:00:00', '15', ''), <br> (52, 9, 0, 0, 2, '06:00:00', '17:00:00', '15', ''), <br> (53, 9, 0, 0, 3, '06:00:00', '17:00:00', '15', ''), <br> (54, 9, 0, 0, 4, '06:00:00', '17:00:00', '15', ''), <br> (55, 9, 0, 0, 5, '06:00:00', '17:00:00', '15', ''), <br> (56, 9, 0, 0, 5, '06:00:00', '17:00:00', '15', ''), <br> (57, 9, 0, 0, 6, '06:00:00', '17:00:00', '15', ''), <br> (58, 10, 0, 0, 0, '06:00:00', '18:00:00', '15', ''), <br> (59, 10, 0, 0, 1, '06:00:00', '17:00:00', '15', ''), <br> (60, 10, 0, 0, 2, '06:00:00', '18:00:00', '15', ''), <br> (61, 10, 0, 0, 3, '06:00:00', '18:00:00', '15', ''), <br> (62, 10, 0, 0, 4, '06:00:00', '18:00:00', '15', ''), <br> (63, 10, 0, 0, 5, '06:00:00', '18:00:00', '15', ''), <br> (64, 10, 0, 0, 5, '06:00:00', '18:00:00', '15', ''), <br> (65, 10, 0, 0, 6, '06:00:00', '18:00:00', '15', '');<br> </body> </html> --=====================_37055984==.ALT--
Wierd update behaviour in 0.96
|
Re: Wierd update behaviour in 0.96
|
Re: Wierd update behaviour in 0.96
|
Re: Wierd update behaviour in 0.96
|
Re: Wierd update behaviour in 0.96
|
Generated at 11:34 on 01 Dec 2004 by mariachi v0.52