[database] Handle NULL literal in params (#6581)

This commit is contained in:
yois615 2023-03-30 14:50:47 -04:00 committed by GitHub
parent 43eb2a5b9d
commit d92c32764a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -41,6 +41,7 @@ local function apply_params(db, sql, params)
local str = string.gsub(sql, param_pattern, function(param)
local v, t = params[param], type(params[param])
if "NULL" == v then return 'NULL' end
if "string" == t then return db:quote(v) end
if "number" == t then return tostring(v) end
if "boolean" == t then return v and '1' or '0' end