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.
>
> Has anybody dealt with this type of overflow checking before? I see at
> least these options:
> - some mysql/DBI thing I haven't seen that returns a warning/error if
> this situation happens
> - adding constraints on all columns in a CDBI-object (maybe do this
> automatically)
> - manual checking of every before and after value
Consider before_create and before_update triggers, and look at the data on
the mysql-specific CPAN modules (Class::DBI::mysql et. al.)
--
Matt S Trout Brag sheet: http://trout.me.uk/services.html
LAMP, Infrastructure Contact: services@xxxxx.xx.xx
and Automation
specialist Do it once. Do it right.
|
|
Re: inserted value != actual value in database
Matt S Trout 00:22 on 10 Feb 2005
|