Uploaded image for project: 'CUBRID APIs'
  1. CUBRID APIs
  2. APIS-397

Cannot run cubrid_bind with NULL value

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: PHP Driver
    • Labels:
      None
    • Environment:

      CUBRID 8.4.1.6004, Windows 7 64 bit, PHP 8.4.1.0006

      Description

      Create the following test table in demodb database:

      {code}
      CREATE TABLE Teste(Coloana NUMERIC(18,2));{code}

      Here is the test.php code:

      {code}
      <?php
      $conn = cubrid_connect("localhost", 33000, "demodb", "dba", "");
      if ($conn) {
      $sql = "INSERT INTO Teste(Coloana) VALUES";
      $req = cubrid_prepare($conn, $sql);

      cubrid_bind($req, 1, null, "null");
      cubrid_execute($req);
      }
      ?>

      Here it says for NULL to put NULL:
      http://php.net/manual/en/function.cubrid-bind.php{code}

      The error obtained is:

      {code}
      Warning: cubrid_bind(): Bind value type unknown : null
      in C:\Users\user\Desktop\Bug\test.php on line 7{code}

      Same issue happens with either value "null","NULL" or NULL. It works only if you put cubrid_bind($req, 1, null, "string") or cubrid_bind($req, 1, null, "numeric"). If this is the correct behaviour the documentation needs to be fixed as from it users understand to put NULL or "NULL".

        Activity

        Hide
        jinhu 李金虎 added a comment -

        Analysis:
        In CCI, CCI_U_TYPE_UNKNOWN == CCI_U_TYPE_NULL == 0, so when the type is 0, php driver consider it as a unknown type and failed.

        Fix in Trunk, revision: 1347
        Fix in RB-8.4.1, revision: 1348
        Fix in RB-8.4.3, revision: 1349
        Fix in RB-8.4.4, revision: 1350

        Show
        jinhu 李金虎 added a comment - Analysis: In CCI, CCI_U_TYPE_UNKNOWN == CCI_U_TYPE_NULL == 0, so when the type is 0, php driver consider it as a unknown type and failed. Fix in Trunk, revision: 1347 Fix in RB-8.4.1, revision: 1348 Fix in RB-8.4.3, revision: 1349 Fix in RB-8.4.4, revision: 1350
        Hide
        jinhu 李金虎 added a comment -

        Resolved.

        Show
        jinhu 李金虎 added a comment - Resolved.
        Show
        cn14130 欧明宝[Bom Owen] added a comment - - edited Add test cases for this issue: 1. RB-8.4.1: http://svn.cubrid.org/cubridapis/php/branches/RB-8.4.1/tests2/php/_02_prepare/bind_null_01.phpt 2. RB-8.4.3: http://svn.cubrid.org/cubridapis/php/branches/RB-8.4.3/tests2/php/_02_prepare/bind_null_01.phpt 3. RB-8.4.4: http://svn.cubrid.org/cubridapis/php/branches/RB-8.4.4/tests2/php/_02_prepare/bind_null_01.phpt 4. RB-9.1.0: http://svn.cubrid.org/cubridapis/php/branches/RB-8.4.3/tests2/php/_02_prepare/bind_null_01.phpt
        Hide
        cn14130 欧明宝[Bom Owen] added a comment - - edited

        Test Build: 9.1.0.0201
        Test OS: Windows 7 32 bit and Windows 7 64 bit
        php driver: 9.1.0.0001
        Test Result: pass

        RB-8.4.1, RB-8.4.3, RB-8.4.4 will be validated by daily qa test

        Show
        cn14130 欧明宝[Bom Owen] added a comment - - edited Test Build: 9.1.0.0201 Test OS: Windows 7 32 bit and Windows 7 64 bit php driver: 9.1.0.0001 Test Result: pass RB-8.4.1, RB-8.4.3, RB-8.4.4 will be validated by daily qa test

          People

          • Assignee:
            cn14130 欧明宝[Bom Owen]
            Reporter:
            ovidiu.veliscu Veliscu Ovidiu
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: