inserted value != actual value in database
[prev]
[thread]
[next]
[Date index for 2005/02/09]
Hi,
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.
If you write the DBI code yourself you can check the value you
inserted against the value that is in the database with an extra
query, which is ugly but works. I currently don't know of / couldn't
find any way of getting information from mysql via DBI, if this
situation occurs.
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
thanks in advance for sharing your knowledge,
Emile
|
inserted value != actual value in database
Emile Aben 20:48 on 09 Feb 2005
|