[mythtv] Database date fields and 0000-00-00

Anduin Withers awithers at anduin.com
Wed Jul 9 16:48:31 EDT 2003


At some point someone defaulted the record startdate and enddate fields in
the database to default to 0000-00-00. Presumably it was only later that it
was found to wreak havoc with QDate and QDateTime. The "fix" appears to be
to stuff the current date in when it shouldn't matter. The problem is that
sometimes is does, so in a few places there are checks to pretend current
date = 0000-00-00.

Rather than do it that way... what if the database idea of 0000-00-00 were
maintained consistently by changing the conversion points to use some common
function. Something like:

QString toMythDateString(const QDate &qd) {}
QString toMythDateString(const QDateTime &qd) {}
QString toMythDateTimeString(const QDateTime &qd) {}

And the logical reverses.

Why? It is confusing to have current date sometimes mean 0000-00-00. If you
are willing to map all invalid dates to 0000-00-00 this problem goes away,
judicious use of the conversion function makes the queries work right, etc.

Evidence that it is confusing? Play more with program ranks when using
mythweb to schedule your recordings.

I'm willing to supply patches if I have reasonable confidence they will be
accepted. Or perhaps there is some really good reason things are they way
they are?

--
Anduin Withers




More information about the mythtv-dev mailing list