Re: inserted value != actual value in database
[prev]
[thread]
[next]
[Date index for 2005/02/10]
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
|
|
Re: inserted value != actual value in database
Tony Bowden 07:57 on 10 Feb 2005
|