hello : help
work sql
type
Date* = ref object of RootObj
Data* : DateTime
Null* : bool
Temps* = ref object of RootObj
Data* : DateTime
Null* : bool
proc sql*(a: Date): string =
if a.Data.format("yyyy-MM-dd") == "0001-01-01" and a.Null == true :
return "null"
else : return fmt""" "{a.Data.format("yyyy-MM-dd")}" """
proc sql*(a: Temps): string =
if a.Data.format("HH:mm:ss") == "00:00:00" and a.Null == true : return
"null"
else :
return fmt""" "{a.Data.format("HH:mm:ss")}" """
Run
a.Data =parse("20:10:05","HH:mm:ss")
Run
: return fmt""" "{a.Data.format("HH:mm:ss")}" """
Run
/home/soleil/.choosenim/toolchains/nim-1.0.6/lib/pure/strformat.nim(562,
18) &
/home/soleil/NIMGUI/GUISQL/var.nim(105, 15) Error: could not parse
`a.Data.format("HH`.
/home/soleil/.choosenim/toolchains/nim-1.0.6/lib/core/macros.nim(557, 15)
Error: closing " expected
Run
is good DATE
: return fmt""" "{a.Data.format("yyyy-MM-dd")}" """ = "2020-03-18"
Run
other
sql*(a: Temps): string =
if a.Data.format("HH:mm:ss") == "00:00:00" and a.Null == true : return
"null"
else :
var h : string = a.Data.format("HH:mm:ss")
return fmt""" "{h}" """
Run
this ok
this a.Data =parse("20:10:05","HH:mm:ss")
Run
can you explain to me why please