Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-255

Resultset.getBoolean result on value that differ 0 and 1

Details

    • Task
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 1.3.2, 1.3.1, 1.3.3, 1.3.4, 1.3.5
    • 1.3.6
    • Other
    • None

    Description

      Driver return false when using Resultset.getBoolean on tinyInt with value > 1.
      (That differ from the mysql driver which return true is this case.)

      At the same time :

      mysql> SELECT IF(0, 'true', 'false');
      +------------------------+
      | IF(0, 'true', 'false') |
      +------------------------+
      | false                  |
      +------------------------+
       
      mysql> SELECT IF(1, 'true', 'false');
      +------------------------+
      | IF(1, 'true', 'false') |
      +------------------------+
      | true                   |
      +------------------------+
       
      mysql> SELECT IF(2, 'true', 'false');
      +------------------------+
      | IF(2, 'true', 'false') |
      +------------------------+
      | true                   |
      +------------------------+
       

      This is inconsistent, driver must handle the same way

      Attachments

        Activity

          diego dupin Diego Dupin created issue -
          diego dupin Diego Dupin made changes -
          Field Original Value New Value
          Description Driver return false when using getBoolean on tinyInt with value > 1.
          That differ from the mysql driver which return true is this case.

          This is inconsistent , according to http://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html.


           
          Driver return false when using Resultset.getBoolean on tinyInt with value > 1.
          (That differ from the mysql driver which return true is this case.)

          At the same time :

          {code:java}
          mysql> SELECT IF(0, 'true', 'false');
          +------------------------+
          | IF(0, 'true', 'false') |
          +------------------------+
          | false |
          +------------------------+

          mysql> SELECT IF(1, 'true', 'false');
          +------------------------+
          | IF(1, 'true', 'false') |
          +------------------------+
          | true |
          +------------------------+

          mysql> SELECT IF(2, 'true', 'false');
          +------------------------+
          | IF(2, 'true', 'false') |
          +------------------------+
          | true |
          +------------------------+

          {code}

          This is inconsistent.
           
          diego dupin Diego Dupin made changes -
          Description Driver return false when using Resultset.getBoolean on tinyInt with value > 1.
          (That differ from the mysql driver which return true is this case.)

          At the same time :

          {code:java}
          mysql> SELECT IF(0, 'true', 'false');
          +------------------------+
          | IF(0, 'true', 'false') |
          +------------------------+
          | false |
          +------------------------+

          mysql> SELECT IF(1, 'true', 'false');
          +------------------------+
          | IF(1, 'true', 'false') |
          +------------------------+
          | true |
          +------------------------+

          mysql> SELECT IF(2, 'true', 'false');
          +------------------------+
          | IF(2, 'true', 'false') |
          +------------------------+
          | true |
          +------------------------+

          {code}

          This is inconsistent.
           
          Driver return false when using Resultset.getBoolean on tinyInt with value > 1.
          (That differ from the mysql driver which return true is this case.)

          At the same time :

          {code:java}
          mysql> SELECT IF(0, 'true', 'false');
          +------------------------+
          | IF(0, 'true', 'false') |
          +------------------------+
          | false |
          +------------------------+

          mysql> SELECT IF(1, 'true', 'false');
          +------------------------+
          | IF(1, 'true', 'false') |
          +------------------------+
          | true |
          +------------------------+

          mysql> SELECT IF(2, 'true', 'false');
          +------------------------+
          | IF(2, 'true', 'false') |
          +------------------------+
          | true |
          +------------------------+

          {code}

          This is inconsistent, and driver must handle the same way
           
          diego dupin Diego Dupin made changes -
          Description Driver return false when using Resultset.getBoolean on tinyInt with value > 1.
          (That differ from the mysql driver which return true is this case.)

          At the same time :

          {code:java}
          mysql> SELECT IF(0, 'true', 'false');
          +------------------------+
          | IF(0, 'true', 'false') |
          +------------------------+
          | false |
          +------------------------+

          mysql> SELECT IF(1, 'true', 'false');
          +------------------------+
          | IF(1, 'true', 'false') |
          +------------------------+
          | true |
          +------------------------+

          mysql> SELECT IF(2, 'true', 'false');
          +------------------------+
          | IF(2, 'true', 'false') |
          +------------------------+
          | true |
          +------------------------+

          {code}

          This is inconsistent, and driver must handle the same way
           
          Driver return false when using Resultset.getBoolean on tinyInt with value > 1.
          (That differ from the mysql driver which return true is this case.)

          At the same time :

          {code:java}
          mysql> SELECT IF(0, 'true', 'false');
          +------------------------+
          | IF(0, 'true', 'false') |
          +------------------------+
          | false |
          +------------------------+

          mysql> SELECT IF(1, 'true', 'false');
          +------------------------+
          | IF(1, 'true', 'false') |
          +------------------------+
          | true |
          +------------------------+

          mysql> SELECT IF(2, 'true', 'false');
          +------------------------+
          | IF(2, 'true', 'false') |
          +------------------------+
          | true |
          +------------------------+

          {code}

          This is inconsistent, driver must handle the same way
           
          diego dupin Diego Dupin made changes -
          Summary mariaDb boolean handling compare to mysql mariaDb Resultset.getBoolean handling on value that differ 0 and 1
          diego dupin Diego Dupin made changes -
          Summary mariaDb Resultset.getBoolean handling on value that differ 0 and 1 Resultset.getBoolean result on value that differ 0 and 1
          diego dupin Diego Dupin added a comment - done with commit : https://github.com/MariaDB/mariadb-connector-j/commit/16ad03767a0f1b3a39b1ef867e69122e47e4451d
          diego dupin Diego Dupin made changes -
          Component/s Other [ 12201 ]
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 74001 ] MariaDB v4 [ 128288 ]

          People

            diego dupin Diego Dupin
            diego dupin Diego Dupin
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.