From e1c761d6736efe04e63f499fd18c8ee87dfb44b6 Mon Sep 17 00:00:00 2001 From: Ulf Wendel Date: Thu, 22 Sep 2011 16:45:37 +0000 Subject: [PATCH] Basic documentation for two new functions that will come with 1.1.0 git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@317159 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../mysqlnd-ms-get-last-used-connection.xml | 238 ++++++++++++++++++ .../functions/mysqlnd-ms-match-wild.xml | 139 ++++++++++ .../mysqlnd-ms-set-user-pick-server.xml | 13 + reference/mysqlnd_ms/versions.xml | 7 +- 4 files changed, 395 insertions(+), 2 deletions(-) create mode 100644 reference/mysqlnd_ms/functions/mysqlnd-ms-get-last-used-connection.xml create mode 100644 reference/mysqlnd_ms/functions/mysqlnd-ms-match-wild.xml diff --git a/reference/mysqlnd_ms/functions/mysqlnd-ms-get-last-used-connection.xml b/reference/mysqlnd_ms/functions/mysqlnd-ms-get-last-used-connection.xml new file mode 100644 index 0000000000..3570dada8a --- /dev/null +++ b/reference/mysqlnd_ms/functions/mysqlnd-ms-get-last-used-connection.xml @@ -0,0 +1,238 @@ + + + + + + mysqlnd_ms_get_last_used_connection + Returns an array which describes the last used connection + + + + &reftitle.description; + + mixed + mysqlnd_ms_get_last_used_connection + mixedconnection + + + Returns an array which describes the last used connection from the plugins + connection pool currently pointed to by the user connection handle. If using the + plugin, a user connection handle represents a pool of database connections. + It is not possible to tell from the user connection handles properties to which + database server from the pool the user connection handle points. + + + The function can be used to debug or monitor PECL mysqlnd_ms. + + + + + &reftitle.parameters; + + + connection + + + A MySQL connection handle obtained from any of the + connect functions of the mysqli, + mysql or + PDO_MYSQL extensions. + + + + + + + + &reftitle.returnvalues; + + FALSE on error. Otherwise, an + array which describes the connection used to + execute the last statement on. + + + Array which describes the connection. + + + + + + + + + Property + Description + Version + + + + + + scheme + + + Connection scheme. Either tcp://host:port + or unix://host:socket. If you want to + distinguish connections from each other use a combination + of scheme and thread_id as a unique + key. Neither scheme nor thread_id + alone are sufficient to distinguish two connections from each other. + Two servers may assign the same thread_id to two + different connections. Thus, connections in the pool may have the same + thread_id. Also, do not rely on uniqueness of + scheme in a pool. Your QA engineers may use the + same MySQL server instance for two distinct logical roles and add it + multiple times to the pool. This hack is used, for example, + in the test suite. + + Since 1.1.0. + + + + host + + + Database server host used with the connection. + + Since 1.1.0. + + + + port + + + Database server port used with the connection. + + Since 1.1.0. + + + + thread_id + + + Connection thread id. + + Since 1.1.0. + + + + last_message + + + Info message obtained from the + MySQL C API function mysql_info(). Pleae, see + mysqli_info for + a description. + + Since 1.1.0. + + + + errno + + + Error code. + + Since 1.1.0. + + + + error + + + Error message. + + Since 1.1.0. + + + + sqlstate + + + Error SQLstate code. + + Since 1.1.0. + + + + + + + + &reftitle.notes; + + + mysqlnd_ms_get_last_used_connection requires + PHP >= 5.4.0 and PECL mysqlnd_ms >> 1.1.0. Internally, it is using + a mysqlnd function not available with PHP 5.3. + + + + + + &reftitle.examples; + + The example assumes that myapp refers to a + plugin configuration file section and represents a connection pool. + + + + <function>mysqlnd_ms_get_last_used_connection</function> example + +query("SELECT 1 FROM DUAL"); +var_dump(mysqlnd_ms_get_last_used_connection($link)); +?> +]]> + + &example.outputs; + + + string(22) "unix:///tmp/mysql.sock" + ["host"]=> + string(0) "" + ["port"]=> + int(3306) + ["thread_id"]=> + int(18739) + ["last_message"]=> + string(0) "" + ["errno"]=> + int(0) + ["error"]=> + string(0) "" + ["sqlstate"]=> + string(5) "00000" +} +]]> + + + + + + + + diff --git a/reference/mysqlnd_ms/functions/mysqlnd-ms-match-wild.xml b/reference/mysqlnd_ms/functions/mysqlnd-ms-match-wild.xml new file mode 100644 index 0000000000..31ed8c67a4 --- /dev/null +++ b/reference/mysqlnd_ms/functions/mysqlnd-ms-match-wild.xml @@ -0,0 +1,139 @@ + + + + + + mysqlnd_ms_match_wild + Finds whether a table name matches a wildcard pattern or not + + + + &reftitle.description; + + bool + mysqlnd_ms_match_wild + stringtable_name + stringwildcard + + + Finds whether a table name matches a wildcard pattern or not. + + + This function is not of much practical relevance with PECL mysqlnd_ms 1.1.0 + because the plugin does not support MySQL replication table filtering yet. + + + + + &reftitle.parameters; + + + table_name + + + The table name to check if it is matched by the wildcard. + + + + + wildcard + + + The wildcard pattern to check against the table name. + The wildcard pattern supports the same placeholders as + MySQL Replication filters do. + + + MySQL replication filters + can be configured by using the MySQL Server configuration + options --replicate-wild-do-table and + --replicate-wild-do-db. Please, consult + the MySQL Reference Manual to learn more about this MySQL + Server feature. + + + The supported placeholders are: + + + + % - zero or more literals + + + + + % - one literal + + + + + + Placeholders can be escaped using \. + + + + + + + + &reftitle.returnvalues; + + Returns TRUE table_name is + matched by wildcard. + Otherwise, returns FALSE + + + + + &reftitle.examples; + + + <function>mysqlnd_ms_match_wild</function> example + + +]]> + + &example.outputs; + + + + + + + + + + diff --git a/reference/mysqlnd_ms/functions/mysqlnd-ms-set-user-pick-server.xml b/reference/mysqlnd_ms/functions/mysqlnd-ms-set-user-pick-server.xml index ef0da57b41..5d9cfeff6f 100755 --- a/reference/mysqlnd_ms/functions/mysqlnd-ms-set-user-pick-server.xml +++ b/reference/mysqlnd_ms/functions/mysqlnd-ms-set-user-pick-server.xml @@ -85,6 +85,19 @@ + + &reftitle.notes; + + + mysqlnd_ms_set_user_pick_server is available + with PECL mysqlnd_ms < 1.1.0. It has been replaced by the + user filter. Please, check the + Change History + for upgrade notes. + + + + &reftitle.examples; diff --git a/reference/mysqlnd_ms/versions.xml b/reference/mysqlnd_ms/versions.xml index ee62d3b82a..b130dcd970 100755 --- a/reference/mysqlnd_ms/versions.xml +++ b/reference/mysqlnd_ms/versions.xml @@ -6,9 +6,12 @@ - - + + + + +