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

SQLColAttribute and SQL_DESC_FIXED_PREC_SCALE returns wrong value for BigInt

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.0.8
    • 2.0.19, 3.0.9
    • General
    • None
    • Windows 10, 64-bit
      MariaDB Odbc driver 3.0.8
      MariaDB database server 3.10

    Description

      I have a simple test database, two columns, one is a varchar, the other one is a BigInt with Numeric_precision = 19 and Numeric_scale = 0.

      When I in my application use the command SQLColAttribute with the field descriptor SQL_DESC_FIXED_PREC_SCALE, it returns SQL_TRUE. But according to documentation, I think it should return SQL_FALSE.

      Link to documentation: https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlcolattribute-function?view=sql-server-2017

      I have tried MariaDB driver 3.0.7 and 3.1.0 Release Candiate with the same result.

      The same database setup on SQL Server and MySQL, and the same application gives the result SQL_FALSE.

      Attachments

        Activity

          Thank you for your report!
          On one hand looks like you are right. But on other the page says scale should be nonzero in both cases, and that makes both values not fitting your case

          "SQL_TRUE if the column has a fixed precision and nonzero scale that are data source-specific.
          SQL_FALSE if the column does not have a fixed precision and nonzero scale that are data source-specific."

          But yeah, we will fix this.

          Lawrin Lawrin Novitsky added a comment - Thank you for your report! On one hand looks like you are right. But on other the page says scale should be nonzero in both cases, and that makes both values not fitting your case "SQL_TRUE if the column has a fixed precision and nonzero scale that are data source-specific. SQL_FALSE if the column does not have a fixed precision and nonzero scale that are data source-specific." But yeah, we will fix this.

          Connector returned wrong value for SQL_DESC_FIXED_PREC_SCALE. In the
          report it was going about bigint type, but in fact for more types
          SQL_TRUE was returned, where it shouldn't. Since defininition of SQL_DESC_FIXED_PREC_SCALE is not super clear, I checked what SQL Server driver returns for different types. As as being also MS's creation, I guess it can be used for reference if specs
          are ambiguous. Only (small)money types SQL_TRUE is returned. MariaDB does not
          have it. And for types that has counterpart in MariaDB, SQL_FALSE is
          always returned. Thus, i made SQL_FALSE default value for all types for
          SQL_DESC_FIXED_PREC_SCALE field.

          Lawrin Lawrin Novitsky added a comment - Connector returned wrong value for SQL_DESC_FIXED_PREC_SCALE. In the report it was going about bigint type, but in fact for more types SQL_TRUE was returned, where it shouldn't. Since defininition of SQL_DESC_FIXED_PREC_SCALE is not super clear, I checked what SQL Server driver returns for different types. As as being also MS's creation, I guess it can be used for reference if specs are ambiguous. Only (small)money types SQL_TRUE is returned. MariaDB does not have it. And for types that has counterpart in MariaDB, SQL_FALSE is always returned. Thus, i made SQL_FALSE default value for all types for SQL_DESC_FIXED_PREC_SCALE field.

          People

            Lawrin Lawrin Novitsky
            Johan Telenius Johan Telenius
            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.