Commit 9379fd4f7c981e70474cc6ef4010922c3876631e

Authored by totoro
1 parent b3254dcb

manage the NULL value on bind functions (bind_String_or_NULL, bind_Datetime, bind_Date, bind_Time)

Showing 1 changed file with 13 additions and 4 deletions   Show diff stats
database/db_binds.anubis
... ... @@ -59,7 +59,7 @@ public define SQLite3Bind
59 59 String name,
60 60 String value
61 61 )=
62   - if value = "" then
  62 + if value = "" | value = "{NULL}" then
63 63 bind_NULL(name)
64 64 else
65 65 bind_String(name, value).
... ... @@ -70,7 +70,10 @@ public define SQLite3Bind
70 70 String name,
71 71 DB_datetime dt
72 72 )=
73   - bind_String(name, datetime(dt)).
  73 + if dt.datetime = "" | dt.datetime = "{NULL}" then
  74 + bind_NULL(name)
  75 + else
  76 + bind_String(name, dt.datetime).
74 77  
75 78 public define SQLite3Bind
76 79 bind_Date
... ... @@ -78,7 +81,10 @@ public define SQLite3Bind
78 81 String name,
79 82 DB_date d
80 83 )=
81   - bind_String(name, date(d)).
  84 + if d.date = "" | d.date = "{NULL}" then
  85 + bind_NULL(name)
  86 + else
  87 + bind_String(name, d.date).
82 88  
83 89 public define SQLite3Bind
84 90 bind_Time
... ... @@ -86,7 +92,10 @@ public define SQLite3Bind
86 92 String name,
87 93 DB_time d
88 94 )=
89   - bind_String(name, time(d)).
  95 + if d.time = "" | d.time = "{NULL}" then
  96 + bind_NULL(name)
  97 + else
  98 + bind_String(name, d.time).
90 99  
91 100 public define SQLite3Bind
92 101 bind_Bool
... ...