mirror of
https://github.com/dimitri/pgloader.git
synced 2026-02-10 17:01:02 +01:00
Transform dates with just day of month set to "00" to NIL.
This commit is contained in:
parent
2a65a1d39f
commit
a41ce12023
@ -27,10 +27,14 @@
|
||||
(find-package "PGLOADER.TRANSFORMS")))
|
||||
|
||||
(defun zero-dates-to-null (date-string)
|
||||
"MySQL accepts '0000-00-00' as a date, we want :null instead."
|
||||
"MySQL accepts '0000-00-00' as a date, we want NIL (SQL NULL) instead."
|
||||
(cond
|
||||
((null date-string) nil)
|
||||
((string= date-string "") nil)
|
||||
;; day is 00
|
||||
((string= date-string "0000-00-00" :start1 8 :start2 8 ) nil)
|
||||
;; month is 00
|
||||
((string= date-string "0000-00-00" :start1 5 :end1 7 :start2 5 :end2 7) nil)
|
||||
((string= date-string "0000-00-00") nil)
|
||||
((string= date-string "0000-00-00 00:00:00") nil)
|
||||
(t date-string)))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user