List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:June 3 1999 6:25pm
Subject:Re: Dates in MySQL
View as plain text  
"Christopher R. Jones" wrote:
> 
> I am not sure about other SQL databases but Visual Foxpro checks SQL
> inserts for valid dates and if the date is invalid, a null value is
> inserted.  For example
> INSERT into datatest (date1) values ("1997,02,29") creates the new record
> but inserts a null value in the date1 field.
> 

Again we come back to the issue of the role of the
database server in an application. MySQL is based on the
assumption that the purpose of the database server is to
provide a mechanism for an application to quickly and
efficiently store and retrieve data. Data validation is
the responsibility of the application developer - the
only time a database would complain is if it cannot
figure out how to store the data. What you are looking
for is something more than that, you want it to do a lot
of validation. I would much rather user the first
option, as a programmer for the following reasons:

 a) My applications will be better off validating the
data first before giving it to the database, since they
know better what the data should be like anyway.
 b) Even if the database server does validation, you
still have to process the errors yourself and give some
meaningful output to the user
c) Extensive and often uncessary validation decreases 
performance
d) Having to worry about validating data increases the
complexity of the code and as the result the cost of a
licence

-- 
Sasha Pachev
http://www.sashanet.com/ (home)
http://www.direct1.com/ (work)
Thread
Dates in MySQLChristopher R. Jones3 Jun
  • Re: Dates in MySQLSasha Pachev3 Jun
  • Re: Dates in MySQL(Paul D. Smith)3 Jun
  • Re: Dates in MySQLVan4 Jun
    • Re: Dates in MySQLBenjamin Pflugmann5 Jun
  • Re: Dates in MySQLJim Faucette5 Jun
  • Not NullRobert Pruitt5 Jun
    • Re: Not NullPaul DuBois5 Jun