Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-348

Add callback support for prepared statement

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 3.2
    • Labels:
      None

      Description

      In case an application uses a data type which has no corresponding MariaDB data type, additional memory needs to be allocated, and the data needs to be converted.

      Speaking of bulk insert, additional memory needs to be allocated for all parameters, so it would be much more efficient to have a callback function which retrieves the parameters from the application for each row.

      When retrieving information (mysql_stmt_fetch) raw data will be converted to the bind buffers, afterwards the application needs to convert the bind buffers to the application specific format.
      It would be much more efficient to allow the application to access the raw data and convert the data directly into required types.

      Proposal:

      callback functions:

      int mariadb_param_callback(void *data, MYSQL_BIND* bind, unsigned int row_number)
      void mariadb_result_callback(void *data, unsigned char *raw_data)
      

      New parameters for mysql_stmt_attr_set/get:

      • STMT_ATTR_CB_DATA: registers user data which will be passed to the callback functions as first parameter
      • STMT_ATTR_CB_PARAM: registers the call back function for parameters
      • STMT_ATTR_CB_RESULT: registers the call back function for result fetching

        Attachments

          Activity

            People

            Assignee:
            georg Georg Richter
            Reporter:
            georg Georg Richter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: