Uploaded image for project: 'MariaDB Connector/C++'
  1. MariaDB Connector/C++
  2. CONCPP-174

ResultSet integer getters allocate a temporary SQLString on every call

    XMLWordPrintable

Details

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 1.1.10
    • General
    • None

    Description

      RowProtocol::rangeCheck() takes the target type name as const SQLString&, and all callers pass a string literal ("int32_t", "int16_t", "Byte", "uint32_t"). Each call therefore builds a temporary SQLString, which means one heap allocation and one deallocation per value read. The name is only used to build the error message when the value is out of range.

      Affected getters:

      Text protocol: getInt(), getShort(), getByte(), getUInt() on every call.
      Binary protocol: the same getters, except getInt() on a signed INT/MEDIUMINT column, which returns before the range check.
      Fix: pass the type name as const char*. There is no behaviour change and the error message is identical.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            diego dupin Diego Dupin
            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.