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

[Perl][PHP][Manual] The bind_param() must contain a bind_type when we bind a variable with a shard sql

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: PHP 9.2.0.0001, Perl 9.2.0.0001
    • Component/s: Perl Driver, PHP Driver
    • Labels:
    • Environment:
      • OS: Linux 64bit
      • CUBRID: 9.2.0.0128
      • Perl: 5.18.0
      • PHP: 5.5.0
      • Driver: cubrid-perl 9.2.0.0001 (20130813)
        cubrid-php 9.2.0.0001 (20130813)

      Description

      • Brief:
        1) In perl driver, when we use bind_param() to bind variable with a shard sql query, we have to specify the bind_type in the function otherwise the shard sql won't be executed correctly

      e.g. Correct bind_param with a shard sql

      {code}
      my $sth=$dbh->prepare("insert into perl_shard VALUES(/*+ shard_key */ ?);");
      $sth->bind_param(1,1,DBI::SQL_INTEGER);
      $sth->execute();{code}

      e.g. Incorrect bind_param with a shard sql

      {code}
      my $sth=$dbh->prepare("insert into perl_shard VALUES(/*+ shard_key */ ?);");
      $sth->bind_param(1,1);
      $sth->execute();{code}

      So we may need to update the document http://search.cpan.org/~cubrid/DBD-cubrid-9.1.0.0001/cubrid.pm#bind_param to add "In CUBRID shard envrioment, the $bind_type must be included in the bind_param function"

      2) Similar with PHP driver, based on APIS-551, we may also need to update the cubrid_bind document http://php.net/manual/zh/function.cubrid-bind.php to let user know ""In CUBRID shard envrioment, the $bind_value_type must be included in the cubrid_bind function"

        Activity

        Hide
        cn15800 谢韦华[Bert] added a comment -

        after modify:

        Note:

        If the type of data to be bound is BLOB/CLOB, CUBRID will try to map the data as a PHP stream. If the actually bind value type is not stream, CUBRID will convert it to string, and use it as the full path and file name of a file on the client filesystem.

        If the type of data to be bound explicitly is ENUM, the $bind_value argument should be the enum element which is in string format.

        In CUBRID shard envrioment, the $bind_value_type must be included in the cubrid_bind function.

        Show
        cn15800 谢韦华[Bert] added a comment - after modify: Note: If the type of data to be bound is BLOB/CLOB, CUBRID will try to map the data as a PHP stream. If the actually bind value type is not stream, CUBRID will convert it to string, and use it as the full path and file name of a file on the client filesystem. If the type of data to be bound explicitly is ENUM, the $bind_value argument should be the enum element which is in string format. In CUBRID shard envrioment, the $bind_value_type must be included in the cubrid_bind function.
        Hide
        cn15800 谢韦华[Bert] added a comment -

        fixed.

        php: 8.4.4.0002
        perl: 9.2.0.0002

        Show
        cn15800 谢韦华[Bert] added a comment - fixed. php: 8.4.4.0002 perl: 9.2.0.0002
        Hide
        ryin005 Ray Yin added a comment -
        Show
        ryin005 Ray Yin added a comment - The document of PHP has been updated http://php.net/manual/zh/function.cubrid-bind.php The perl document is still unchanged http://search.cpan.org/~cubrid/DBD-cubrid-9.2.0.0001/cubrid.pm#bind_param

          People

          • Assignee:
            cn15800 谢韦华[Bert]
            Reporter:
            ryin005 Ray Yin
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: