Check that all values passed into an insert query are scalar.

Created on 1 May 2014, over 10 years ago
Updated 20 February 2024, 10 months ago

Problem/Motivation


db_insert('custom_menu_link_data')
  ->fields(array('route_parameters', 'route_name'))
  ->values(array(array(), 'test'))
  ->execute();
/*
  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that          [31;40m[1m[error][0m
corresponds to your MySQL server version for the right syntax to use near ' 'test')' at line 1: INSERT INTO
{custom_menu_link_data} (route_parameters, route_name) VALUES (, :db_insert_placeholder_1); Array
(
    [:db_insert_placeholder_1] => test
)
*/

Proposed resolution

Check before the insert for the scalarness.

Remaining tasks

User interface changes

API changes

📌 Task
Status

Active

Version

11.0 🔥

Component
Database 

Last updated 2 days ago

  • Maintained by
  • 🇳🇱Netherlands @daffie
Created by

🇩🇪Germany dawehner

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
Production build 0.71.5 2024