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

function column_quote Have bug #428

Closed
mengjie0827 opened this issue Jun 30, 2016 · 1 comment
Closed

function column_quote Have bug #428

mengjie0827 opened this issue Jun 30, 2016 · 1 comment

Comments

@mengjie0827
Copy link

mengjie0827 commented Jun 30, 2016

$last_user_id = $db->insert("userlist", [
"username" => "foo",
"(JSON)userqq" => ["en", "fr", "jp", "cn"]
]);

SQL:
INSERT INTO "userlist" (username, (JSON)userqq) VALUES ('foo', '["en","fr","jp","cn"]')

Can not replace JSON?

catfan added a commit that referenced this issue Jun 30, 2016
@easylogic
Copy link

column quote pattern is wrong.

protected function column_quote($string)
{
     return preg_replace('/(\(JSON\)\s*|^#)?([a-zA-Z0-9_]*)\.([a-zA-Z0-9_]*)/', '"' . $this->prefix . '$2"."$3"', $string);
}

you must add table name before field name.

$last_user_id = $db->insert("userlist", [
"username" => "foo",
"(JSON)userlist.userqq" => ["en", "fr", "jp", "cn"] 
]);

@catfan catfan closed this as completed Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants