Re: inserted value != actual value in database

[prev] [thread] [next] [Date index for 2005/02/10]

From: Tony Bowden
Subject: Re: inserted value != actual value in database
Date: 07:57 on 10 Feb 2005
On Wed, Feb 09, 2005 at 12:48:14PM -0800, Emile Aben wrote:
> I have a problem with inserting data via CDBI with a mysql (3.23.38)
> backend in that I currently have no clue if a value I insert is the
> same as the value that is actually in the database. Say, I hit the
> maximum of an INT value, or the maximum length for a VARCHAR, mysql
> just inserts a value that is different from the value I asked it to
> insert. What I'd like to have is at least some kind of warning if one
> or more values I've inserted 'overflows' the column data-type.

After an insert Class::DBI flushes out all the data from the object for
this exact reason. You can just fetch it back again and compare it to
see if it's the same.

my $obj = Class->create({ value => $val });
warn "Value changed" unless $obj->value == $val

Tony

inserted value != actual value in database
Emile Aben 20:48 on 09 Feb 2005

Re: inserted value != actual value in database
Matt S Trout 00:22 on 10 Feb 2005

Re: inserted value != actual value in database
Tony Bowden 07:57 on 10 Feb 2005

Re: inserted value != actual value in database
Emile Aben 18:17 on 11 Feb 2005

Generated at 17:31 on 15 Feb 2005 by mariachi v0.52