in reply to Want DBI to load empty strings as NULL
A couple notes: First, if you want to convert an empty string to a null on the insert, you shouldn't consider the map statement as an argument against placeholders. After all, you'll have to perform the conversion in *any* method you use. It's a different issue entirely.
Second, if you're considering an empty string as an illegal value in your database, you might consider using a stored procedure to perform your inserts, and enforce it there, so your various perl scripts don't all have to do the checking. Something like:
create sproc insert_foo @bar as varchar(77) as if @bar = '' set @bar=null insert into foo (bar) values (@bar)
(Or use the nullif function, etc.)
...roboticus
|
|---|