Hi!
First, your last question:
> Should I CC these emails to internals?
Yes, please do. There're lots of people who know MySQL internals on the
list, including all our developers. You may get some very valuable piece
of advice from them. Besides, I could be travelling or on vacations and
my reply will be delayed, then.
Now the main problem.
I have an idea how to solve it.
As you know, there's no internal "date" result type in MySQL yet, only
INT_RESULT, REAL_RESULT, and STRING_RESULT. So, every item could be
converted to one of those, etc. In particular, it means that dates are
mostly sent around as strings and sometimes as numbers. And one of
the most important functions is str_to_time().
So, if you'll make a string format for jalali date to look clearly
different from a gregorian date, str_to_time will be able to
distinguish them. E.g. a jalali date may look like
"1380-01-01J"
or
"j:1380-01-01"
or perhaps not with 'j' but with some other character that you usually
use for dates, or with a special separator instead of '-'.
Or perhaps with 'P' (Persian), not 'J' - because 'J' can be used later
for 'Julian'.
str_to_time() could then set an appropriate flag in MYSQL_TIME
structure. Then usual data conversion will work, e.g. when you store
curdate() in a jalali date column, curdate() returns a gregorian date
as usual, and it's converted to jalali in
Field_date_jalali::store_time()
"1380-01-01P" is slightly better because it is resembles the standard
syntax for timestamps "2004-03-01 12:13:14Z" where 'Z' at the end means
"UTC timezone".
Anyway, this is not very important, because it could be changed later -
I'll try to find if anybody else did something similar, if there's any
standard for a calendar specification embedded in a date (just like
these is a standard for timezone specification). I wasn't able to find
anything so far bug I'll continue looking. If you have any ideas -
they will be highly appreciated :)
The goal is to know for any specific date in any place of the
code, whether it's gregorian date or jalali. Then MySQL could convert
dates appropriately, and e.g. one could compare jalali and gregorian
dates:
SELECT something FROM t0 WHERE dt > dtj;
How does it look ?
Regards,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer
/_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany
<___/ www.mysql.com