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

High Prepared_stmt_count after freeing statement handles

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.2.2, 3.2.3
    • 3.2.4
    • General
    • None
    • Arch Linux x86_64 running MariaDB 11.5.2 or 11.4.2

    Description

      When using prepared statements with SQLPrepare, the Prepared_stmt_count increases on MariaDB (when shown with SHOW GLOBAL STATUS LIKE 'Prepared_stmt_count'). It does not decrease when calling SQLFreeHandle(SQL_HANDLE_STMT, stmt) on the statement handle that was made as a prepared statement. Disconnecting and reconnecting, however, does lower the Prepared_stmt_count.

      On long-lived connections or connections with many prepared statements, this can have the effect of throwing errors like:

      STATE 42000: ODBC ECode 1461: EMsg [ma-3.2.2][11.4.2-MariaDB-log]Can't create more than max_prepared_stmt_count statements (current value: 16382)

      Attached is a test program that demonstrates this.

      Expected Output:
      Initial - 0
      After SQLExecDirect - 0
      After SQLPrepare - 1
      After SQLExecute - 1
      After SQLCloseCursor - 1
      After SQLFreeHandle - 0
      After Reconnect - 0

      Actual Output:
      Initial - 0
      After SQLExecDirect - 0
      After SQLPrepare - 1
      After SQLExecute - 1
      After SQLCloseCursor - 1
      After SQLFreeHandle - 1
      After Reconnect - 0

      Attachments

        Activity

          People

            Lawrin Lawrin Novitsky
            cfsaaron Aaron Bishop
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.