From f5139cbf29b53ba94155eed4ae062b46c9985aa2 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Fri, 3 Jul 2020 18:39:37 +0200 Subject: [PATCH] Add support for DATETIME() function call as a SQLite default values. Fixes #1177. --- src/sources/sqlite/sqlite-cast-rules.lisp | 6 ++++++ test/sqlite/sqlite.db | Bin 118784 -> 122880 bytes 2 files changed, 6 insertions(+) diff --git a/src/sources/sqlite/sqlite-cast-rules.lisp b/src/sources/sqlite/sqlite-cast-rules.lisp index 0192a66..eaffe9e 100644 --- a/src/sources/sqlite/sqlite-cast-rules.lisp +++ b/src/sources/sqlite/sqlite-cast-rules.lisp @@ -107,6 +107,12 @@ (string= "CURRENT TIMESTAMP" default))) :current-timestamp) + ((and (stringp default) + ;; we don't care about spaces in that expression + (string-equal "datetime('now','localtime')" + (remove #\Space default))) + :current-timestamp) + ((and (stringp default) (string-equal "current_date" default)) :current-date) diff --git a/test/sqlite/sqlite.db b/test/sqlite/sqlite.db index ff6df4ee1894be5aa142c01f68cd5055c2000c4a..3db3a1d41fc3b784b0555bb41fb35dbb5dcc79d7 100644 GIT binary patch delta 299 zcmZozz}|3xeS);02Ll6x91z2R_Cy_H9uEdR69r!Ge+**m_a|m+GqK;_xX_Kgp1YA# zj9pw;m$A{cBrz!`H6^hmwInk)H9jRZEwMDG1f4JE9OUX4;;Inh=;Y(7fG(?%sgRjh zlA4}cq@$3QpAVN;fSRV^0@NGg>FcVYo|j*)uA{)Go|B)Pm; z<9xh8$20S9W8iKQ%e927Epfx delta 59 zcmZoTz}~QceS);0H3I{KED*zh%0wMw9%}|Y69r!Ge+;4=*%Pz1Hwy|}WpB>r*q+V7 HIQ2LHRI&|H