-
Notifications
You must be signed in to change notification settings - Fork 39
Description
I have updated this implementation on pull request #93.
Date
type in Swift is recommended way to treat typical date and time type TIMESTAMP
, DATETIME
in MySQL commonly used for creation date, updates date.
Date
only supports TIMESTAMP
, DATETIME
MySQL types.
DateComponents
type in Swift is just container for representing SELECT
ed string from databases into it.
YEAR
, TIME
, DATE
, TIMESTAMP
, DATETIME
column can be parsed into DateComponents
. And used as query parameters for these types in MySQL as well.
DateComponents
doesn't respect or treat for timeZone
and calendar
on itself by this library. But Date
does respect time zone on ConnectionOption.timeZone
.
Check more details on its tests and another one.
This is original proposal:
We could implement this:
- treat MySQL TIMESTAMP and DATETIME as SQLDate(and NSDate)
- DATE as SQLDate(NSDate) with
YYYY-MM-DD 00:00:00
- TIME as String
- YEAR as Int
TIME type has range of '-838:59:59.000000' to '838:59:59.000000’, we couldn’t treat as NSDate. So we support it with String type for now.
(https://dev.mysql.com/doc/refman/5.6/en/datetime.html)
Related #24.
MySQL has 0000-00-00
date value for representing dummy date or empty date, or sometimes null.
We could support such case in this library by following JDBC zeroDateTimeBehavior
. (#24)