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

Created on 1 May 2014, about 10 years ago
Updated 20 February 2024, 4 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 about 1 hour 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.69.0 2024