PDO-MySQL: Boolean values get converted to 1 or empty string on prepared statement binding

后端 未结 1 1567
北荒
北荒 2021-01-23 08:58

I\'m trying to insert some boolean values into JSON-type columns.

$taskSql = \"INSERT INTO Tasks (data, taskListId) VALUES (JSON_OBJECT(\'title\', :title, \'done         


        
相关标签:
1条回答
  • 2021-01-23 09:05

    I endet up changing the insert line to

    INSERT INTO Tasks (data, taskListId) VALUES (JSON_OBJECT('title', :title, 'done', :done = TRUE || :done = '1'), :taskListId);
    

    Not a solution but a workaround.

    0 讨论(0)
提交回复
热议问题