[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
MyODBC date problem/MySQL default value policy
Hi list
My purpose in this posting is to share my MySQL expirience with
reviewers of the list. This and it's follow-ups may be a good reference
to developers with similar cases (but I guess that depends on the
correcness of this message).
I have an M$-Access application working at about 5 stations. I was
driven by Windows NT's slow locking mechanism and MS-Jet's slow
performance to seek a faster database engine and I found MySQL. MySQL
seemed like a good low-cost (time is money too...) open-source solution.
I must say I was impressed by the fast performance it displays, and fair
stability (I tested it with my proxy server's logs - about 500,000
records and growing, so far - works well). I got impressed enough to
start a small Delphi project with MySQL as its database. Sorry I can't
say the same for MyODBC.
Let me precede by saying that I have compiled a source distribution of
MySQL in order to support hebrew (also added pthreads while I'm at it
and at some point canceled the default value feature). The DSNs that are
configured as instructed in the readme file both for the BDE and Access.
I noticed a problem in adding new records to tables with dates. When you
define date columns without setting a default value, MySQL automatically
assigns 0000-00-00 as the date. The MyODBC documentation says that ODBC
doesn't support 0000-00-00 as a date, and instead it returns a NULL
value (and it does). The problem is that any record created with
0000-00-00 assigned as a date connot be deleted through ODBC with cursor
access (this happens both on Delphi and Access). The only way to delete
these records is to use an explicit query (this you CAN do through
ODBC). You can reproduce this problem by defining a table of this type
and accessing it though Access's table interface or Delhi's Database
Explorer.
The only ways to avoid this problem is to set a different default value
at the table creation query or to cancel the default column value. But
not always do we want to set a default value for a date -- for example:
what default date would you set to a birth date field?
Another problem you will definitely run into is MyODBC's poor cursor
support (stated - currently under development). This problem occurs only
in Access. You will run into situations where you add a legitimate
record and once you exit it it will show as #deleted#. If you exit the
form you were in and return to it (or just refresh) - you will see that
the record was actually inserted and the #deleted# mark is false. Some
driver tuning (I added ODBC 1.0 sim, safety mode, 1 and 2) improve the
situation, but still, in some places you see records marked as deleted
on the first addition of a record to a dataset, and afterwards newly
added records are added correctly.
Did anyone run into a similar problem?
=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il