[MDEV-5422] binary protocol: default values not supported in prepared statements Created: 2013-12-09  Updated: 2018-02-14  Resolved: 2018-02-14

Status: Closed
Project: MariaDB Server
Component/s: Prepared Statements
Fix Version/s: 10.2.3

Type: Task Priority: Major
Reporter: Georg Richter Assignee: Oleksandr Byelkin
Resolution: Duplicate Votes: 2
Labels: None

Issue Links:
Relates
relates to MDEV-9114 Bulk operations (Array binding) Closed

 Description   

Default values are not supported by prepared statements. This slows down batch operations since you need to retrieve the default value for a column from information_schema:

  mysqll> CREATE TABLE t1 (a int  default 2);

  mysql_stmt_prepare(stmt, "INSERT INTO t1 VALUES (?)");
 
  for (i=0; i < numRows; i++)
  {
    if (RowPtr[i] == SQL_COLUMN_IGNORE)
    {
      /* since there is no MYSQL_TYPE_DEFAULT we need to retrieve
         the default value from information_schema. What a pain! */
    } else
    {
      bind[0].buffer_type= MYSQL_TYPE_LONG;
      bind{0].buffer= &RowValues[i];
    }
    mysql_stmt_execute(stmt);
  }



 Comments   
Comment by Oleksandr Byelkin [ 2018-02-14 ]

Implemented as bulk parameter of 1 row.

Generated at Thu Feb 08 07:04:16 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.