Re: Wierd update behaviour in 0.96

[prev] [thread] [next] [Date index for 2004/06/01]

From: John Day
Subject: Re: Wierd update behaviour in 0.96
Date: 20:18 on 01 Jun 2004
--=====================_93300593==.ALT
Content-Type: text/plain; charset="us-ascii"

At 02:57 PM 6/1/2004, Perrin Harkins wrote:
>On Tue, 2004-06-01 at 00:40, John Day wrote:
>> 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.
>
>This code is kind of hard to follow.  Especially this bit:
>
>> my $results = $alter_int->hash;
>> $alter_int->set( %{$results} );
>> $alter_int->update;
>
>What is that supposed to do?  It looks like it's intended to do nothing
>at all.

Well, kinda! The data normally comes form a form, this was done to get the record, convert it to a hash and just write it back to the table.


>> $g = hashy($g) if ref $g;
>
>"hashy"?  Who is that?

An error. hashy should have been hash. We just recurse through the returned object to inflate references - if any.


>I would suggest reducing this code more to find out what's going on. 
>I'd try a simple update and see what happens, cutting out that
>$alter_int->hash stuff.

I did, and here is the conclusion.

If we send include the PRIMARY KEY as a column to be updated then we get the problem. IN the case of this table:

$alter_int->set( 'intend' => '17:53:00', 'intervalid' => 9 );

will fail - not returning any data when we attempt to read the record back, despite the table having been updated in the database. BUT

$alter_int->set( 'intend' => '17:53:00');

causes the update to take place AND the record can be read back again.

This behaviour was not evident in 0.94, I installed that on another server today and if the PRIMARY KEY is passed to the set method it seems to ignore it.

Thank you very much for the assistance - and the gentle prod in the right direction!

John





>- Perrin

--=====================_93300593==.ALT
Content-Type: text/html; charset="us-ascii"

<html>
<body>
At 02:57 PM 6/1/2004, Perrin Harkins wrote:<br>
<blockquote type=cite class=cite cite>On Tue, 2004-06-01 at 00:40, John
Day wrote:<br>
&gt; Using the following database table (it is one in my normal
development<br>
&gt; database) and the test code and the myCDBI.pm module I can
replicate<br>
&gt; the problem. When the code is run unmodified (with the
$alter_int<br>
&gt; object having the update method run on it) the second call to<br>
&gt; &amp;disp_data produces no output.<br><br>
This code is kind of hard to follow.&nbsp; Especially this bit:<br><br>
&gt; my $results = $alter_int-&gt;hash;<br>
&gt; $alter_int-&gt;set( %{$results} );<br>
&gt; $alter_int-&gt;update;<br><br>
What is that supposed to do?&nbsp; It looks like it's intended to do
nothing<br>
at all.</blockquote><br>
Well, kinda! The data normally comes form a form, this was done to get
the record, convert it to a hash and just write it back to the
table.<br><br>
<br>
<blockquote type=cite class=cite cite>&gt; $g = hashy($g) if ref
$g;<br><br>
&quot;hashy&quot;?&nbsp; Who is that?</blockquote><br>
An error. hashy should have been hash. We just recurse through the
returned object to inflate references - if any.<br><br>
<br>
<blockquote type=cite class=cite cite>I would suggest reducing this code
more to find out what's going on. <br>
I'd try a simple update and see what happens, cutting out that<br>
$alter_int-&gt;hash stuff.</blockquote><br>
I did, and here is the conclusion.<br><br>
If we send include the PRIMARY KEY as a column to be updated then we get
the problem. IN the case of this table:<br><br>
$<font color="#A000F0">alter_int-</font><font color="#B22200">&gt;</font>set(
<font color="#0000FF">'intend'</font> <font color="#B22200">=&gt;</font>
<font color="#0000FF">'17:53:00'</font>, <font color="#0000FF">'intervalid'</font> <font color="#B22200">=&gt;</font> <font color="#A02000">9</font> );<br><br>
will fail - not returning any data when we attempt to read the record back, despite the table having been updated in the database. BUT<br><br>
$<font color="#A000F0">alter_int-</font><font color="#B22200">&gt;</font>set( <font color="#0000FF">'intend'</font> <font color="#B22200">=&gt;</font> <font color="#0000FF">'17:53:00'</font>);<br><br>
causes the update to take place AND the record can be read back again.<br><br>
This behaviour was not evident in 0.94, I installed that on another server today and if the PRIMARY KEY is passed to the set method it seems to ignore it.<br><br>
Thank you very much for the assistance - and the gentle prod in the right direction!<br><br>
John<br><br>
<br><br>
<br><br>
<blockquote type=cite class=cite cite>- Perrin</blockquote></body>
</html>

--=====================_93300593==.ALT--


Wierd update behaviour in 0.96
John Day 04:40 on 01 Jun 2004

Re: Wierd update behaviour in 0.96
Perrin Harkins 18:57 on 01 Jun 2004

Re: Wierd update behaviour in 0.96
John Day 20:18 on 01 Jun 2004

Re: Wierd update behaviour in 0.96
Tony Bowden 20:28 on 01 Jun 2004

Re: Wierd update behaviour in 0.96
John Day 21:33 on 01 Jun 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52