Re: pear mdb2 and null

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
>> I need it to error when an attempt to create a record without setting that
>> field is attempted, but setting the field to an empty string is fine.
>>
>> Attempting to insert data without defining that field indicates there is
>> not sufficient information to create a record. Setting that field to a zero
>> length string however indicates that there is enough information to create a
>> record. Assuming that no information is the same as an zero length string is
>> not OK.
>>
>> Call it bad design if you want, by MySQL knows the difference between NULL
>> and an empty string, so should my database abstraction layer.
>>
>>
> Even if the default is set to '' - pear mdb2 refuses to do the insert.
> So it looks like pear mdb2 does not know the difference between NULL and a
> zero length string.
>
> Hopefully that is configurable somewhere.
>
  </snip]

Shouldn't this be really handled by the application layer, not the db layer?
If you are using the db to show the error code for the text field, wouldn't
it be simpler to handle that in the validation code, and then use the
default in the table to insert the data?


-- 

Bastien

Cat, the other other white meat

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux