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

Support CCI connection string parameters like altHosts, loadBalance in PHP/PDO

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PHP 9.1.0 0004
    • Component/s: PHP Driver
    • Labels:
      None

      Description

      Kai Yang says CUBRID PDO driver doesn't support connection string parameters at this moment. When specified, it simply drops them.

      Since PDO/PHP drivers are based on CCI, they should be able to support any CCI connection string parameters without a problem.

      Please add these parameters support.

      For a reference, see cci_connect_with_url() API for a list of available parameters. altHosts, loadBalance, rcTime and loginTimeout are among the most frequently important especially in HA and CUBRID SHARD environments.

        Activity

        Hide
        cn15163 杨伟为[Astro] added a comment -

        The parameters have been added.
        For php, the cubrid_connect (http://www.php.net/manual/en/function.cubrid-connect.php) function was added one more optional parameter, this parameter can be used to specify the additional parameters. for example:

        include "connect.inc";
        $conn=cubrid_connect($host, $port, $db, $user, $passwd, false, "altHosts=192.168.0.2:33000,192.168.0.3:33000&rcTime=600");
        $req = cubrid_execute($conn, "select * from  game");
        $row = cubrid_fetch($req, CUBRID_NUM | CUBRID_LOB);
        var_dump($row);
        cubrid_close_request($req);
        cubrid_disconnect($conn);
        

        For pdo, the PDO::__construct 's (http://www.php.net/manual/en/pdo.construct.php) laster parameter can be used to specity the additional parameters. for example:

        $db = new PDO(
            "cubrid:dbname=demodb;host=localhost;port=33000", "","",array("altHosts"=>"192.168.0.2:33000","rcTime"=>"600")
        );
        $query = $db->query("select * from game");
        var_dump($query);
        $db = null;
        
        Show
        cn15163 杨伟为[Astro] added a comment - The parameters have been added. For php, the cubrid_connect ( http://www.php.net/manual/en/function.cubrid-connect.php ) function was added one more optional parameter, this parameter can be used to specify the additional parameters. for example: include "connect.inc"; $conn=cubrid_connect($host, $port, $db, $user, $passwd, false, "altHosts=192.168.0.2:33000,192.168.0.3:33000&rcTime=600"); $req = cubrid_execute($conn, "select * from game"); $row = cubrid_fetch($req, CUBRID_NUM | CUBRID_LOB); var_dump($row); cubrid_close_request($req); cubrid_disconnect($conn); For pdo, the PDO::__construct 's ( http://www.php.net/manual/en/pdo.construct.php ) laster parameter can be used to specity the additional parameters. for example: $db = new PDO( "cubrid:dbname=demodb;host=localhost;port=33000", "","",array("altHosts"=>"192.168.0.2:33000","rcTime"=>"600") ); $query = $db->query("select * from game"); var_dump($query); $db = null;
        Hide
        kadishmal Esen Sagynov added a comment -

        Oh, this is perfect! Will this feature be a part of the upcoming release?

        Show
        kadishmal Esen Sagynov added a comment - Oh, this is perfect! Will this feature be a part of the upcoming release?
        Hide
        cn15163 杨伟为[Astro] added a comment -

        Fixed.

        Show
        cn15163 杨伟为[Astro] added a comment - Fixed.
        Hide
        ryin005 Ray Yin added a comment - - edited

        Added test cases for this new feature

        [php@NC-PL-QA011 php]$ svn ci --username ray -m "[APIS-580] Add a case to test the new feature of connection string properties"
        Adding         php/_21_new_features
        Adding         php/_21_new_features/apis_580_connect_properties
        Adding         php/_21_new_features/apis_580_connect_properties/_01_cubrid_connect
        Adding         php/_21_new_features/apis_580_connect_properties/_01_cubrid_connect/cases
        Adding         php/_21_new_features/apis_580_connect_properties/_01_cubrid_connect/cases/apis_580.phpt
        Adding         php/_21_new_features/apis_580_connect_properties/_01_cubrid_connect/cases/apis_580.sh
        Adding         php/_21_new_features/apis_580_connect_properties/_01_cubrid_connect/cases/connect.inc
        Adding         php/_21_new_features/apis_580_connect_properties/_02_cubrid_connect_with_url
        Adding         php/_21_new_features/apis_580_connect_properties/_02_cubrid_connect_with_url/cases
        Adding         php/_21_new_features/apis_580_connect_properties/_02_cubrid_connect_with_url/cases/apis_580.phpt
        Adding         php/_21_new_features/apis_580_connect_properties/_02_cubrid_connect_with_url/cases/apis_580.sh
        Adding         php/_21_new_features/apis_580_connect_properties/_02_cubrid_connect_with_url/cases/connect.inc
        Adding         php/_21_new_features/apis_580_connect_properties/_03_cubrid_connect_invalid
        Adding         php/_21_new_features/apis_580_connect_properties/_03_cubrid_connect_invalid/cases
        Adding         php/_21_new_features/apis_580_connect_properties/_03_cubrid_connect_invalid/cases/apis_580.phpt
        Adding         php/_21_new_features/apis_580_connect_properties/_03_cubrid_connect_invalid/cases/apis_580.sh
        Adding         php/_21_new_features/apis_580_connect_properties/_03_cubrid_connect_invalid/cases/connect.inc
        Adding         php/_21_new_features/apis_580_connect_properties/_04_cubrid_connect_with_url_invalid
        Adding         php/_21_new_features/apis_580_connect_properties/_04_cubrid_connect_with_url_invalid/cases
        Adding         php/_21_new_features/apis_580_connect_properties/_04_cubrid_connect_with_url_invalid/cases/apis_580.phpt
        Adding         php/_21_new_features/apis_580_connect_properties/_04_cubrid_connect_with_url_invalid/cases/apis_580.sh
        Adding         php/_21_new_features/apis_580_connect_properties/_04_cubrid_connect_with_url_invalid/cases/connect.inc
        Adding         php/_21_new_features/apis_580_connect_properties/_05_multi_properties
        Adding         php/_21_new_features/apis_580_connect_properties/_05_multi_properties/cases
        Adding         php/_21_new_features/apis_580_connect_properties/_05_multi_properties/cases/apis_580.phpt
        Adding         php/_21_new_features/apis_580_connect_properties/_05_multi_properties/cases/apis_580.sh
        Adding         php/_21_new_features/apis_580_connect_properties/_05_multi_properties/cases/connect.inc
        Transmitting file data ................
        Committed revision 1984.
        

        Case url: http://svn.cubrid.org/cubridapis/php/branches/RB-9.1.0_static_cci/tests2/php/_21_new_features/apis_580_connect_properties/

        Show
        ryin005 Ray Yin added a comment - - edited Added test cases for this new feature [php@NC-PL-QA011 php]$ svn ci --username ray -m "[APIS-580] Add a case to test the new feature of connection string properties" Adding php/_21_new_features Adding php/_21_new_features/apis_580_connect_properties Adding php/_21_new_features/apis_580_connect_properties/_01_cubrid_connect Adding php/_21_new_features/apis_580_connect_properties/_01_cubrid_connect/cases Adding php/_21_new_features/apis_580_connect_properties/_01_cubrid_connect/cases/apis_580.phpt Adding php/_21_new_features/apis_580_connect_properties/_01_cubrid_connect/cases/apis_580.sh Adding php/_21_new_features/apis_580_connect_properties/_01_cubrid_connect/cases/connect.inc Adding php/_21_new_features/apis_580_connect_properties/_02_cubrid_connect_with_url Adding php/_21_new_features/apis_580_connect_properties/_02_cubrid_connect_with_url/cases Adding php/_21_new_features/apis_580_connect_properties/_02_cubrid_connect_with_url/cases/apis_580.phpt Adding php/_21_new_features/apis_580_connect_properties/_02_cubrid_connect_with_url/cases/apis_580.sh Adding php/_21_new_features/apis_580_connect_properties/_02_cubrid_connect_with_url/cases/connect.inc Adding php/_21_new_features/apis_580_connect_properties/_03_cubrid_connect_invalid Adding php/_21_new_features/apis_580_connect_properties/_03_cubrid_connect_invalid/cases Adding php/_21_new_features/apis_580_connect_properties/_03_cubrid_connect_invalid/cases/apis_580.phpt Adding php/_21_new_features/apis_580_connect_properties/_03_cubrid_connect_invalid/cases/apis_580.sh Adding php/_21_new_features/apis_580_connect_properties/_03_cubrid_connect_invalid/cases/connect.inc Adding php/_21_new_features/apis_580_connect_properties/_04_cubrid_connect_with_url_invalid Adding php/_21_new_features/apis_580_connect_properties/_04_cubrid_connect_with_url_invalid/cases Adding php/_21_new_features/apis_580_connect_properties/_04_cubrid_connect_with_url_invalid/cases/apis_580.phpt Adding php/_21_new_features/apis_580_connect_properties/_04_cubrid_connect_with_url_invalid/cases/apis_580.sh Adding php/_21_new_features/apis_580_connect_properties/_04_cubrid_connect_with_url_invalid/cases/connect.inc Adding php/_21_new_features/apis_580_connect_properties/_05_multi_properties Adding php/_21_new_features/apis_580_connect_properties/_05_multi_properties/cases Adding php/_21_new_features/apis_580_connect_properties/_05_multi_properties/cases/apis_580.phpt Adding php/_21_new_features/apis_580_connect_properties/_05_multi_properties/cases/apis_580.sh Adding php/_21_new_features/apis_580_connect_properties/_05_multi_properties/cases/connect.inc Transmitting file data ................ Committed revision 1984. Case url: http://svn.cubrid.org/cubridapis/php/branches/RB-9.1.0_static_cci/tests2/php/_21_new_features/apis_580_connect_properties/

          People

          • Assignee:
            cn15163 杨伟为[Astro]
            Reporter:
            kadishmal Esen Sagynov
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: