Uploaded image for project: 'MariaDB Connector/ODBC'
  1. MariaDB Connector/ODBC
  2. ODBC-513

Parameter array with SQL_C_TYPE_DATE fails with "Error while retrieving parameter from callback function" (PCALLBACK=1)

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.2.6, 3.2.10
    • 3.2.11
    • General
    • None
    •  Linux x86_64 (openSUSE Tumbleweed), unixODBC 2.3.14, MariaDB Server 11.8.9; 3.2.6 = distribution package, 3.2.10 = fedora43 tarball from dlm.mariadb.com (bundled libmariadb 3.4.11)

    Description

      An INSERT executed with a parameter array (SQL_ATTR_PARAMSET_SIZE > 1) fails if one of the parameters is bound as SQL_C_TYPE_DATE (or SQL_C_DATE):

      [HY000] [ma-3.2.10][11.8.9-MariaDB-ubu2404]Error while retrieving parameter from callback function
      

      No row is inserted. With PCALLBACK=0 in the DSN the same program inserts all rows correctly. SQL_C_TYPE_TIMESTAMP arrays, and SQL_C_TYPE_DATE in a single row execute, work.

      Steps to reproduce (program attached, date.c):

      1. CREATE TABLE odbc_date_arr (id INT, d DATE)
      2. SQLPrepare "INSERT INTO odbc_date_arr (id, d) VALUES (?, ?)"
      3. SQL_ATTR_PARAM_BIND_TYPE = SQL_PARAM_BIND_BY_COLUMN, SQL_ATTR_PARAMSET_SIZE = 3
      4. SQLBindParameter 1: SQL_C_LONG / SQL_INTEGER, SQLINTEGER[3]
      5. SQLBindParameter 2: SQL_C_TYPE_DATE / SQL_TYPE_DATE, column size 10, SQL_DATE_STRUCT[3] {2026-02-01, 2026-02-02, 1999-12-31}

        , indicators 0

      6. SQLExecute

      gcc -o date date.c -lodbc
      ./date <DSN> <user> <password>
       
      PCALLBACK=1 (default), 3.2.6 and 3.2.10:
      SQLExecute (3 rows): rc=-1 [HY000] [ma-3.2.10][11.8.9-MariaDB-ubu2404]Error while retrieving parameter from callback function
      rows inserted: 0 (expected 3)
       
      PCALLBACK=0:
      SQLExecute (3 rows): rc=0
      rows inserted: 3 (expected 3)
      

      The same happens with NULL indicators in some rows. Possibly related: CONC-623 (return code of the parameter callback).

      Workaround: PCALLBACK=0 in the DSN.

      The analysis and the test program were made with AI assistance (Claude); I have verified the results.

      Attachments

        1. date.c
          2 kB
          Stefan Vogel

        Activity

          People

            Lawrin Lawrin Novitsky
            stefan5907 Stefan Vogel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.