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

[PHP] sql statment contained "prepare" can not execute using method "cubrid_execute"

    Details

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

      Linux NC-PL-QA030 2.6.18-194.el5xen #1 SMP Fri Apr 2 15:34:40 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

      Description

      [PHP] sql statment contained "prepare" can not execute using method "cubrid_execute".

      Test verion:

      Cubrid: CUBRID 9.0 (9.0.0.0455)
      PHP Driver: 
      http://svn.cubrid.org/cubridapis/php/branches/RB-9.0.0 Revision: 867
      

      Test codes:

      //prepare
      $sql = "prepare x from 'update enum032 set e3=? where id=1'";
      $req = cubrid_prepare($conn, $sql, CUBRID_INCLUDE_OID);
      cubrid_execute($req);
      if (!$req) {
          printf("[001] [%d] %s\n", cubrid_errno($conn), cubrid_error($conn));
      }
      
      //execute
      $sql = "execute x using -1";
      $req = cubrid_prepare($conn, $sql, CUBRID_INCLUDE_OID);
      cubrid_execute($req);
      if (!$req) {
          printf("[001] [%d] %s\n", cubrid_errno($conn), cubrid_error($conn));
      }
      

      Test result:

      Warning: Error: DBMS, -995, A prepared statement with the name x does not exist. in /home/php/phptestcases/php/php/_18_enum/enum_prepare_01.php on line 43
      
      Warning: cubrid_execute() expects parameter 1 to be resource, boolean given in /home/php/phptestcases/php/php/_18_enum/enum_prepare_01.php on line 44
      [001] [-995] A prepared statement with the name x does not exist.
      

      These two sql statment can execute in csql :

      csql> prepare x from 'update enum032 set e3=? where id=1';
      
      Current transaction has been committed.
      
      1 command(s) successfully processed.
      csql> execute x using -1;
      
      In the command from line 1,
      
      ERROR: Cannot coerce value of domain "integer" to domain "enum".
      
      
      0 command(s) successfully processed.
      csql> 
      
      1. APIS-338_FIX01.creview
        73 kB
        李金虎
      2. enum_prepare_01.phpt
        5 kB
        欧明宝[Bom Owen]
      3. enum_prepare_01.phpt
        5 kB
        欧明宝[Bom Owen]
      4. simple_prepare_06.pl
        1 kB
        高艳铭

        Issue Links

          Activity

          Hide
          gaoyanming 高艳铭 (Inactive) added a comment -

          Perl has same question:
          Repro steps:
          Please run the pl file in attachment.

          [perl@NC-PL-QA030 cases]$ perl simple_prepare_06.pl demodb 30022 10.34.64.212
          1..3
          ok 1 - prepare ok
          Can't locate object method "x" via package "using" (perhaps you forgot to load "using"?) at simple_prepare_06.pl line 28.
          # Looks like you planned 3 tests but ran 1.
          # Looks like your test exited with 115 just after 1.
          
          Show
          gaoyanming 高艳铭 (Inactive) added a comment - Perl has same question: Repro steps: Please run the pl file in attachment. [perl@NC-PL-QA030 cases]$ perl simple_prepare_06.pl demodb 30022 10.34.64.212 1..3 ok 1 - prepare ok Can't locate object method "x" via package "using" (perhaps you forgot to load "using"?) at simple_prepare_06.pl line 28. # Looks like you planned 3 tests but ran 1. # Looks like your test exited with 115 just after 1.
          Hide
          cn14130 欧明宝[Bom Owen] added a comment -

          After I removed "CUBRID_INCLUDE_OID" when preparing.
          The sql statment contained "prepare" can be executed.

          But when executing sql statment "execute x using -1", the php driver throw unknown exception.

          The codes

          //prepare
          $sql = "prepare x from 'update enum032 set e3=? where id=1'";
          $req = cubrid_prepare($conn, $sql );
          cubrid_execute($req);
          if (!$req) {
              printf("[001] [%d] %s\n", cubrid_errno($conn), cubrid_error($conn));
          }
          
          //execute
          $sql = "execute x using -1";
          $req = cubrid_prepare($conn, $sql );
          cubrid_execute($req);
          if (!$req) {
              printf("[001] [%d] %s\n", cubrid_errno($conn), cubrid_error($conn));
          }
          

          Result:

          *************Before Execute*******************
          id                            e2                            e3                            e4                            
          1                             Yes                           Sunday                        x                             
          6                             Yes                           Wednesday                     z                             
          
          Warning: Error: CAS, 0, Unknown error message in /home/php/phptestcases/php/php/_18_enum/enum_prepare_01.php on line 47
          *******************After Execute using -1****************
          id                            e2                            e3                            e4                            
          1                             Yes                           Sunday                        x                             
          6                             Yes                           Wednesday                     z  
          

          The detailed see the filr attached.

          Show
          cn14130 欧明宝[Bom Owen] added a comment - After I removed "CUBRID_INCLUDE_OID" when preparing. The sql statment contained "prepare" can be executed. But when executing sql statment "execute x using -1", the php driver throw unknown exception. The codes //prepare $sql = "prepare x from 'update enum032 set e3=? where id=1'"; $req = cubrid_prepare($conn, $sql ); cubrid_execute($req); if (!$req) { printf("[001] [%d] %s\n", cubrid_errno($conn), cubrid_error($conn)); } //execute $sql = "execute x using -1"; $req = cubrid_prepare($conn, $sql ); cubrid_execute($req); if (!$req) { printf("[001] [%d] %s\n", cubrid_errno($conn), cubrid_error($conn)); } Result: *************Before Execute******************* id e2 e3 e4 1 Yes Sunday x 6 Yes Wednesday z Warning: Error: CAS, 0, Unknown error message in /home/php/phptestcases/php/php/_18_enum/enum_prepare_01.php on line 47 *******************After Execute using -1**************** id e2 e3 e4 1 Yes Sunday x 6 Yes Wednesday z The detailed see the filr attached.
          Hide
          cn14130 欧明宝[Bom Owen] added a comment -

          enum_prepare_01.phpt which removed "CUBRID_INCLUDE_OID".

          Show
          cn14130 欧明宝[Bom Owen] added a comment - enum_prepare_01.phpt which removed "CUBRID_INCLUDE_OID".
          Hide
          jinhu 李金虎 added a comment - - edited

          Change the below error info from:
          Warning: Error: CAS, 0, Unknown error message
          to:
          Warning: Error: DBMS, -181, Cannot coerce value of domain "integer" to domain "enum"

          Sending php_cubrid.c
          Committed revision 901.
          Fixed.

          Show
          jinhu 李金虎 added a comment - - edited Change the below error info from: Warning: Error: CAS, 0, Unknown error message to: Warning: Error: DBMS, -181, Cannot coerce value of domain "integer" to domain "enum" Sending php_cubrid.c Committed revision 901. Fixed.
          Hide
          cn14130 欧明宝[Bom Owen] added a comment -

          This issue is not exist .
          Test verion:

          Cubrid: CUBRID 9.0 (9.0.0.0455)
          PHP Driver: 
          http://svn.cubrid.org/cubridapis/php/branches/RB-9.0.0 Revision: 913
          
          Show
          cn14130 欧明宝[Bom Owen] added a comment - This issue is not exist . Test verion: Cubrid: CUBRID 9.0 (9.0.0.0455) PHP Driver: http://svn.cubrid.org/cubridapis/php/branches/RB-9.0.0 Revision: 913

            People

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

              Dates

              • Due:
                Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 3 days
                3d
                Remaining:
                Remaining Estimate - 3 days
                3d
                Logged:
                Time Spent - Not Specified
                Not Specified