File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,12 @@ M.run = function(func, o)
7474 if o .tbl_exists == nil then
7575 o .tbl_exists = o .db :exists (o .name )
7676 o .mtime = o .db .uri and (luv .fs_stat (o .db .uri ) or { mtime = {} }).mtime .sec or nil
77- o .has_content = o .tbl_exists and o .db :eval (fmt (" select count(*) from %s" , o .name ))[1 ][" count(*)" ] ~= 0 or 0
77+ rawset (
78+ o ,
79+ " has_content" ,
80+ o .tbl_exists and o .db :eval (fmt (" select count(*) from %s" , o .name ))[1 ][" count(*)" ] ~= 0 or 0
81+ )
82+ -- o.has_content =
7883 M .check_for_auto_alter (o , valid_schema )
7984 end
8085
Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ local pvalues = function(defs, kv)
120120
121121 local keys = {}
122122 for k , v in u .opairs (defs ) do
123- if type (v ) == " string" and v :match " %a +%(.+%) " then
123+ if type (v ) == " string" and v :match " ^[%S] +%(.*%)$ " then
124124 tinsert (keys , v )
125125 else
126126 tinsert (keys , " :" .. k )
@@ -341,7 +341,7 @@ local opts_to_str = function(tbl)
341341 end
342342 end ,
343343 default = function (v )
344- v = (type (v ) == " string" and v :match " ^%a +%(.+ %)$" ) and " (" .. tostring (v ) .. " )" or v
344+ v = (type (v ) == " string" and v :match " ^[%S] +%(.* %)$" ) and " (" .. tostring (v ) .. " )" or v
345345 local str = " default "
346346 if tbl [" required" ] then
347347 return " on conflict replace " .. str .. v
Original file line number Diff line number Diff line change @@ -302,7 +302,7 @@ function sqlstmt:bind(...)
302302
303303 for k , v in pairs (names ) do
304304 local index = parameter_index_cache [k ] or table.remove (anon_indices , 1 )
305- if ((type (v ) == " string" and v :match " %a +%(.+%) " ) and flags .ok or self :bind (index , v )) ~= flags .ok then
305+ if ((type (v ) == " string" and v :match " ^[%S] +%(.*%)$ " ) and flags .ok or self :bind (index , v )) ~= flags .ok then
306306 error (" sqlite.lua error at stmt:bind(), failed to bind a given value '%s'. Please report issue." ):format (v )
307307 end
308308 end
You can’t perform that action at this time.
0 commit comments