Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[database] Handle NULL literal in params #6581

Merged
merged 1 commit into from Mar 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was done this way to not break what's currently on line 48, although I cannot find a scenario where that actually does anything

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
Expand Down