diff --git a/reference/pdo/pdo/connect.xml b/reference/pdo/pdo/connect.xml
new file mode 100644
index 000000000000..9090df7b2afa
--- /dev/null
+++ b/reference/pdo/pdo/connect.xml
@@ -0,0 +1,74 @@
+
+
+
+ PDO::connect
+ Connect to a database and return a PDO subclass for drivers that support it
+
+
+
+ &reftitle.description;
+
+ publicstaticstaticPDO::connect
+ stringdsn
+ stringnullusername&null;
+ #[\SensitiveParameter]stringnullpassword&null;
+ arraynulloptions&null;
+
+
+ Creates an instance of a PDO subclass for the
+ database being connection if it exists,
+ otherwise return a generic PDO instance.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns an instance of a PDO subclass for the
+ corresponding PDO driver if it exists,
+ or a generic PDO instance.
+
+
+
+
+
+
+
+
+ &reftitle.seealso;
+
+ Pdo\Dblib
+ Pdo\Firebird
+ Pdo\Mysql
+ Pdo\Odbc
+ Pdo\Pgsql
+ Pdo\Sqlite
+ PDO::__construct
+
+
+
+
+
diff --git a/reference/pdo/pdo/construct.xml b/reference/pdo/pdo/construct.xml
index 27289c2ac4e1..3e15e707dea6 100644
--- a/reference/pdo/pdo/construct.xml
+++ b/reference/pdo/pdo/construct.xml
@@ -114,8 +114,9 @@
&reftitle.errors;
- PDO::__construct throws a PDOException if the attempt
- to connect to the requested database fails, regardless of which PDO::ATTR_ERRMODE is currently set.
+ A PDOException is thrown if the attempt
+ to connect to the requested database fails,
+ regardless of which PDO::ATTR_ERRMODE is currently set.
diff --git a/reference/pdo_dblib/pdo-dblib.xml b/reference/pdo_dblib/pdo-dblib.xml
new file mode 100644
index 000000000000..60ad7638cef1
--- /dev/null
+++ b/reference/pdo_dblib/pdo-dblib.xml
@@ -0,0 +1,164 @@
+
+
+ The Pdo\Dblib class
+ Pdo\Dblib
+
+
+
+
+
+ &reftitle.intro;
+
+ A PDO subclass representing a connection using
+ the DBLib PDO driver.
+
+
+
+
+
+ &reftitle.classsynopsis;
+
+
+
+ Pdo\Dblib
+
+
+ extends
+ PDO
+
+ &InheritedConstants;
+
+
+
+ &Constants;
+
+ public
+ const
+ int
+ Pdo\Dblib::ATTR_CONNECTION_TIMEOUT
+
+
+ public
+ const
+ int
+ Pdo\Dblib::ATTR_QUERY_TIMEOUT
+
+
+ public
+ const
+ int
+ Pdo\Dblib::ATTR_STRINGIFY_UNIQUEIDENTIFIER
+
+
+ public
+ const
+ int
+ Pdo\Dblib::ATTR_VERSION
+
+
+ public
+ const
+ int
+ Pdo\Dblib::ATTR_TDS_VERSION
+
+
+ public
+ const
+ int
+ Pdo\Dblib::ATTR_SKIP_EMPTY_ROWSETS
+
+
+ public
+ const
+ int
+ Pdo\Dblib::ATTR_DATETIME_CONVERT
+
+ &InheritedMethods;
+
+
+
+
+
+
+
+
+
+
+
+
+ &reftitle.constants;
+
+
+ Pdo\Dblib::ATTR_CONNECTION_TIMEOUT
+
+
+
+
+
+
+ Pdo\Dblib::ATTR_QUERY_TIMEOUT
+
+
+
+
+
+
+ Pdo\Dblib::ATTR_STRINGIFY_UNIQUEIDENTIFIER
+
+
+
+
+
+
+ Pdo\Dblib::ATTR_VERSION
+
+
+
+
+
+
+ Pdo\Dblib::ATTR_TDS_VERSION
+
+
+
+
+
+
+ Pdo\Dblib::ATTR_SKIP_EMPTY_ROWSETS
+
+
+
+
+
+
+ Pdo\Dblib::ATTR_DATETIME_CONVERT
+
+
+
+
+
+
+
+
+
+
+
diff --git a/reference/pdo_dblib/reference.xml b/reference/pdo_dblib/reference.xml
index 7c72d025070d..3d6870f3b62d 100644
--- a/reference/pdo_dblib/reference.xml
+++ b/reference/pdo_dblib/reference.xml
@@ -7,7 +7,7 @@
MS SQL Server (PDO)
-
+
&reftitle.intro;
PDO_DBLIB is a driver that implements the PHP
@@ -120,6 +120,7 @@ dblib:host=localhost;dbname=testdb
+ &reference.pdo-dblib.pdo-dblib;
+
+
+
+
+
diff --git a/reference/pdo_firebird/constants.xml b/reference/pdo_firebird/constants.xml
index 3e4a37c2ca1d..7d9dae9cdaf5 100644
--- a/reference/pdo_firebird/constants.xml
+++ b/reference/pdo_firebird/constants.xml
@@ -1,6 +1,6 @@
-
+
&reftitle.constants;
&pdo.driver-constants;
@@ -11,7 +11,7 @@
- Sets the date format.
+ &Alias; Pdo\Firebird::ATTR_DATE_FORMAT.
@@ -22,7 +22,7 @@
- Sets the time format.
+ &Alias; Pdo\Firebird::ATTR_TIME_FORMAT.
@@ -33,13 +33,12 @@
- Sets the timestamp format.
+ &Alias; Pdo\Firebird::ATTR_TIMESTAMP_FORMAT.
-
+
+ &reftitle.intro;
+
+ A PDO subclass representing a connection using
+ the Firebird PDO driver.
+
+
+
+
+
+ &reftitle.classsynopsis;
+
+
+
+ Pdo\Firebird
+
+
+
+ extends
+ PDO
+
+
+ &InheritedConstants;
+
+
+
+
+ &Constants;
+
+ public
+ const
+ int
+ Pdo\Firebird::ATTR_DATE_FORMAT
+
+
+ public
+ const
+ int
+ Pdo\Firebird::ATTR_TIME_FORMAT
+
+
+ public
+ const
+ int
+ Pdo\Firebird::ATTR_TIMESTAMP_FORMAT
+
+
+ public
+ const
+ int
+ Pdo\Firebird::TRANSACTION_ISOLATION_LEVEL
+
+
+ public
+ const
+ int
+ Pdo\Firebird::READ_COMMITTED
+
+
+ public
+ const
+ int
+ Pdo\Firebird::REPEATABLE_READ
+
+
+ public
+ const
+ int
+ Pdo\Firebird::SERIALIZABLE
+
+
+ public
+ const
+ int
+ Pdo\Firebird::WRITABLE_TRANSACTION
+
+
+ &Methods;
+
+
+
+
+ &InheritedMethods;
+
+
+
+
+
+
+
+
+
+
+
+
+ &reftitle.constants;
+
+
+ Pdo\Firebird::ATTR_DATE_FORMAT
+
+
+ Sets the date format.
+
+
+
+
+ Pdo\Firebird::ATTR_TIME_FORMAT
+
+
+ Sets the time format.
+
+
+
+
+ Pdo\Firebird::ATTR_TIMESTAMP_FORMAT
+
+
+ Sets the timestamp format.
+
+
+
+
+ Pdo\Firebird::TRANSACTION_ISOLATION_LEVEL
+
+
+ Attribute to sets the transaction isolation level.
+ This can be one of Pdo\Firebird::READ_COMMITTED,
+ Pdo\Firebird::REPEATABLE_READ,
+ or Pdo\Firebird::SERIALIZABLE.
+
+
+
+
+ Pdo\Firebird::READ_COMMITTED
+
+
+ Flag denoting the ANSI transaction isolation
+ level is read commited.
+ This is the default behavior.
+
+
+
+
+ Pdo\Firebird::REPEATABLE_READ
+
+
+ Flag denoting the ANSI transaction isolation
+ level is repeatable read.
+ This corresponds to Firebird's "snapshot" isolation level.
+
+
+
+
+ Pdo\Firebird::SERIALIZABLE
+
+
+ Flag denoting the ANSI transaction isolation
+ level is serializable.
+ This corresponds to Firebird's "snapshot table stability" isolation level.
+
+
+
+
+ Pdo\Firebird::WRITABLE_TRANSACTION
+
+
+ Boolean attribute used to toggle the transaction access mode between
+ READ ONLY and READ WRITE.
+ By default, it is &true; indicating READ WRITE.
+
+
+
+
+
+
+
+ &reference.pdo-firebird.pdo.entities.firebird;
+
+
+
diff --git a/reference/pdo_firebird/pdo/firebird/getapiversion.xml b/reference/pdo_firebird/pdo/firebird/getapiversion.xml
new file mode 100644
index 000000000000..6d925a0902ce
--- /dev/null
+++ b/reference/pdo_firebird/pdo/firebird/getapiversion.xml
@@ -0,0 +1,51 @@
+
+
+
+ Pdo\Firebird::getApiVersion
+ Get the API version
+
+
+
+ &reftitle.description;
+
+ publicstaticintPdo\Firebird::getApiVersion
+
+
+
+ Returns the Firebird API version as defined by the C constant
+ FB_API_VER in ibase.h.
+
+
+
+
+ &reftitle.parameters;
+ &no.function.parameters;
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the FireBird API as an int.
+
+
+
+
diff --git a/reference/pdo_firebird/reference.xml b/reference/pdo_firebird/reference.xml
index e5c1c1d495d0..d24a395a37ac 100644
--- a/reference/pdo_firebird/reference.xml
+++ b/reference/pdo_firebird/reference.xml
@@ -7,7 +7,7 @@
Firebird (PDO)
-
+
&reftitle.intro;
PDO_FIREBIRD is a driver that implements the PHP Data Objects (PDO)
@@ -128,6 +128,7 @@ firebird:dbname=localhost:/var/lib/firebird/2.5/data/test.fdb;charset=utf-8;dial
+ &reference.pdo-firebird.pdo-firebird;
+
+
+
+
+
+
diff --git a/reference/pdo_mysql/configure.xml b/reference/pdo_mysql/configure.xml
index d2265fb23d9f..1d647065e969 100644
--- a/reference/pdo_mysql/configure.xml
+++ b/reference/pdo_mysql/configure.xml
@@ -48,11 +48,14 @@ $ ./configure --with-pdo-mysql --with-mysql-sock=/var/mysql/mysql.sock
- SSL support is enabled using the appropriate PDO_MySQL constants,
- which is equivalent to calling the MySQL C API function mysql_ssl_set().
- Also, SSL cannot be enabled with PDO::setAttribute because the connection
- already exists. See also the MySQL documentation about connecting to
- MySQL with SSL.
+ SSL support is enabled using the appropriate
+ Pdo\Mysql::ATTR_SSL_*,
+ which is equivalent to calling the
+ MySQL C API function mysql_ssl_set().
+ Also, SSL cannot be enabled with PDO::setAttribute
+ because the connection already exists.
+ See also the MySQL documentation about
+ connecting to MySQL with SSL.
diff --git a/reference/pdo_mysql/constants.xml b/reference/pdo_mysql/constants.xml
index 5da969c48c72..302dfd9ae64c 100644
--- a/reference/pdo_mysql/constants.xml
+++ b/reference/pdo_mysql/constants.xml
@@ -1,6 +1,6 @@
-
+
&reftitle.constants;
&pdo.driver-constants;
@@ -11,29 +11,8 @@
- By default all statements are executed in
- buffered mode.
- If this attribute is set to &false; on a
- PDO object, the MySQL driver will use the
- unbuffered mode.
+ &Alias; Pdo\Mysql::ATTR_USE_BUFFERED_QUERY
-
- Setting MySQL unbuffered mode
-
-setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
-
-$unbufferedResult = $pdo->query("SELECT Name FROM City");
-foreach ($unbufferedResult as $row) {
- echo $row['Name'] . PHP_EOL;
-}
-?>
-]]>
-
-
-
@@ -42,45 +21,32 @@ foreach ($unbufferedResult as $row) {
(int)
-
- Enable LOAD LOCAL INFILE.
-
-
- Note, this constant can only be used in the driver_options
- array when constructing a new database handle.
-
+
+ &Alias; Pdo\Mysql::ATTR_LOCAL_INFILE
+ PDO::MYSQL_ATTR_LOCAL_INFILE_DIRECTORY
- (string)
+ (int)
-
- Allows restricting LOCAL DATA loading to files located in this designated
- directory. Available as of PHP 8.1.0.
-
-
- Note, this constant can only be used in the driver_options
- array when constructing a new database handle.
-
+
+ &Alias; Pdo\Mysql::ATTR_LOCAL_INFILE_DIRECTORY.
+ Available as of PHP 8.1.0.
+ PDO::MYSQL_ATTR_INIT_COMMAND
- (string)
+ (int)
-
- Command to execute when connecting to the MySQL server. Will
- automatically be re-executed when reconnecting.
-
-
- Note, this constant can only be used in the driver_options
- array when constructing a new database handle.
-
+
+ &Alias; Pdo\Mysql::ATTR_INIT_COMMAND
+
@@ -89,12 +55,9 @@ foreach ($unbufferedResult as $row) {
(int)
-
- Read options from the named option file instead of from
- my.cnf. This option is not available if
- mysqlnd is used, because mysqlnd does not read the mysql
- configuration files.
-
+
+ &Alias; Pdo\Mysql::ATTR_READ_DEFAULT_FILE
+
@@ -103,12 +66,9 @@ foreach ($unbufferedResult as $row) {
(int)
-
- Read options from the named group from my.cnf or the
- file specified with MYSQL_READ_DEFAULT_FILE. This option
- is not available if mysqlnd is used, because mysqlnd does not read the mysql
- configuration files.
-
+
+ &Alias; Pdo\Mysql::ATTR_READ_DEFAULT_GROUP
+
@@ -117,10 +77,9 @@ foreach ($unbufferedResult as $row) {
(int)
-
- Maximum buffer size. Defaults to 1 MiB. This constant is not supported when
- compiled against mysqlnd.
-
+
+ &Alias; Pdo\Mysql::ATTR_MAX_BUFFER_SIZE
+
@@ -129,9 +88,9 @@ foreach ($unbufferedResult as $row) {
(int)
-
- Perform direct queries, don't use prepared statements.
-
+
+ &Alias; PDO::ATTR_EMULATE_PREPARES
+
@@ -140,10 +99,9 @@ foreach ($unbufferedResult as $row) {
(int)
-
- Return the number of found (matched) rows, not the
- number of changed rows.
-
+
+ &Alias; Pdo\Mysql::ATTR_FOUND_ROWS
+
@@ -152,10 +110,9 @@ foreach ($unbufferedResult as $row) {
(int)
-
- Permit spaces after function names. Makes all functions
- names reserved words.
-
+
+ &Alias; Pdo\Mysql::ATTR_IGNORE_SPACE
+
@@ -164,9 +121,21 @@ foreach ($unbufferedResult as $row) {
(int)
-
- Enable network communication compression.
-
+
+ &Alias; Pdo\Mysql::ATTR_COMPRESS
+
+
+
+
+
+
+ PDO::MYSQL_ATTR_SERVER_PUBLIC_KEY
+ (int)
+
+
+
+ &Alias; Pdo\Mysql::ATTR_SERVER_PUBLIC_KEY
+
@@ -176,9 +145,9 @@ foreach ($unbufferedResult as $row) {
(int)
-
- The file path to the SSL certificate authority.
-
+
+ &Alias; Pdo\Mysql::ATTR_SSL_CA
+
@@ -188,10 +157,9 @@ foreach ($unbufferedResult as $row) {
(int)
-
- The file path to the directory that contains the trusted SSL
- CA certificates, which are stored in PEM format.
-
+
+ &Alias; Pdo\Mysql::ATTR_SSL_CAPATH
+
@@ -201,9 +169,9 @@ foreach ($unbufferedResult as $row) {
(int)
-
- The file path to the SSL certificate.
-
+
+ &Alias; Pdo\Mysql::ATTR_SSL_CERT
+
@@ -213,10 +181,9 @@ foreach ($unbufferedResult as $row) {
(int)
-
- A list of one or more permissible ciphers to use for SSL encryption, in a format
- understood by OpenSSL. For example: DHE-RSA-AES256-SHA:AES128-SHA
-
+
+ &Alias; Pdo\Mysql::ATTR_SSL_CIPHER
+
@@ -226,9 +193,9 @@ foreach ($unbufferedResult as $row) {
(int)
-
- The file path to the SSL key.
-
+
+ &Alias; Pdo\Mysql::ATTR_SSL_KEY
+
@@ -238,13 +205,9 @@ foreach ($unbufferedResult as $row) {
(int)
-
- Provides a way to disable verification of the server SSL certificate.
- This option is available only with mysqlnd.
-
-
- &version.exists.asof; 7.0.18 and PHP 7.1.4.
-
+
+ &Alias; Pdo\Mysql::ATTR_SSL_VERIFY_SERVER_CERT
+
@@ -254,14 +217,9 @@ foreach ($unbufferedResult as $row) {
(int)
-
- Disables multi query execution in both PDO::prepare
- and PDO::query when set to &false;.
-
-
- Note, this constant can only be used in the driver_options
- array when constructing a new database handle.
-
+
+ &Alias; Pdo\Mysql::ATTR_MULTI_STATEMENTS
+
diff --git a/reference/pdo_mysql/pdo-mysql.xml b/reference/pdo_mysql/pdo-mysql.xml
new file mode 100644
index 000000000000..c0ec40473a86
--- /dev/null
+++ b/reference/pdo_mysql/pdo-mysql.xml
@@ -0,0 +1,470 @@
+
+
+ The Pdo\Mysql class
+ Pdo\Mysql
+
+
+
+
+
+ &reftitle.intro;
+
+ A PDO subclass representing a connection using
+ the MySQL PDO driver.
+
+
+ This driver supports a dedicated SQL query parser for the MySQL dialect.
+ It can handle the following:
+
+
+
+ Single and double-quoted literals with both doubling and backslash as escaping mechanisms
+
+
+
+
+ Backtick literals with doubling as escaping mechanism
+
+
+
+
+ Two-dashes, C-style comments, and Hash-comments.
+
+
+
+
+
+
+
+
+ &reftitle.classsynopsis;
+
+
+
+
+ Pdo\Mysql
+
+
+
+ extends
+ PDO
+
+
+ &InheritedConstants;
+
+
+
+
+ &Constants;
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_USE_BUFFERED_QUERY
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_LOCAL_INFILE
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_LOCAL_INFILE_DIRECTORY
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_INIT_COMMAND
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_MAX_BUFFER_SIZE
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_READ_DEFAULT_FILE
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_READ_DEFAULT_GROUP
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_COMPRESS
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_DIRECT_QUERY
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_FOUND_ROWS
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_IGNORE_SPACE
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_MULTI_STATEMENTS
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_SERVER_PUBLIC_KEY
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_SSL_KEY
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_SSL_CERT
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_SSL_CA
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_SSL_CAPATH
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_SSL_CIPHER
+
+
+ public
+ const
+ int
+ Pdo\Mysql::ATTR_SSL_VERIFY_SERVER_CERT
+
+
+ &Methods;
+
+
+
+
+ &InheritedMethods;
+
+
+
+
+
+
+
+
+
+
+
+
+ &reftitle.constants;
+
+
+ Pdo\Mysql::ATTR_USE_BUFFERED_QUERY
+
+
+ By default all statements are executed in
+ buffered mode.
+ If this attribute is set to &false; on a
+ Pdo\Mysql object,
+ the MySQL driver will use the unbuffered mode.
+
+ Setting MySQL unbuffered mode
+
+setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
+
+$unbufferedResult = $pdo->query("SELECT Name FROM City");
+foreach ($unbufferedResult as $row) {
+ echo $row['Name'] . PHP_EOL;
+}
+?>
+]]>
+
+
+
+
+
+ Pdo\Mysql::ATTR_LOCAL_INFILE
+
+
+ Enable LOAD LOCAL INFILE.
+
+
+
+ Can only be used in the driver_options
+ array when constructing a new database handle.
+
+
+
+
+
+ Pdo\Mysql::ATTR_LOCAL_INFILE_DIRECTORY
+
+
+ Allows restricting LOCAL DATA loading to files located in this
+ designated directory.
+ Available as of PHP 8.1.0.
+
+
+
+
+
+
+
+ Pdo\Mysql::ATTR_INIT_COMMAND
+
+
+ Command to execute when connecting to the MySQL server.
+ Will automatically be re-executed when reconnecting.
+
+
+
+
+
+
+
+ Pdo\Mysql::ATTR_READ_DEFAULT_FILE
+
+
+ Read options from the named option file instead of from
+ my.cnf.
+
+
+
+ This option is not available if mysqlnd is used,
+ because mysqlnd does not read the mysql configuration files.
+
+
+
+
+
+ Pdo\Mysql::ATTR_READ_DEFAULT_GROUP
+
+
+ Read options from the named group from my.cnf or
+ the file specified with
+ Pdo\Mysql::ATTR_READ_DEFAULT_FILE.
+
+
+
+ This option is not available if mysqlnd is used,
+ because mysqlnd does not read the mysql configuration files.
+
+
+
+
+
+ Pdo\Mysql::ATTR_COMPRESS
+
+
+ Enable network communication compression.
+
+
+
+
+ Pdo\Mysql::ATTR_DIRECT_QUERY
+
+
+ &Alias; PDO::ATTR_EMULATE_PREPARES.
+
+
+
+
+ Pdo\Mysql::ATTR_FOUND_ROWS
+
+
+ Return the number of found (matched) rows,
+ not the number of changed rows.
+
+
+
+
+
+
+
+ Pdo\Mysql::ATTR_IGNORE_SPACE
+
+
+ Permit spaces after SQL function names.
+ Makes all SQL functions names reserved words.
+
+
+
+
+
+
+
+ Pdo\Mysql::ATTR_MAX_BUFFER_SIZE
+
+
+ Maximum buffer size. Defaults to 1 MiB.
+
+
+
+ This constant is not supported when compiled against mysqlnd.
+
+
+
+
+
+ Pdo\Mysql::ATTR_MULTI_STATEMENTS
+
+
+ Disables multi query execution in both
+ PDO::prepare and
+ PDO::query when set to &false;.
+
+
+
+
+
+
+
+ Pdo\Mysql::ATTR_SERVER_PUBLIC_KEY
+
+
+ RSA public key file used with the SHA-256 based authentication.
+
+
+
+
+
+
+
+ Pdo\Mysql::ATTR_SSL_KEY
+
+
+ The file path to the SSL key.
+
+
+
+
+
+
+
+ Pdo\Mysql::ATTR_SSL_CERT
+
+
+ The file path to the SSL certificate.
+
+
+
+
+
+
+
+ Pdo\Mysql::ATTR_SSL_CA
+
+
+ The file path to the SSL certificate authority.
+
+
+
+
+
+
+
+ Pdo\Mysql::ATTR_SSL_CAPATH
+
+
+ The file path to the directory that contains the trusted
+ SSL CA certificates,
+ which are stored in PEM format.
+
+
+
+
+
+
+
+ Pdo\Mysql::ATTR_SSL_CIPHER
+
+
+ A list of one or more permissible ciphers to use for
+ SSL encryption, in a format understood by OpenSSL.
+ For example: DHE-RSA-AES256-SHA:AES128-SHA
+
+
+
+
+
+
+
+ Pdo\Mysql::ATTR_SSL_VERIFY_SERVER_CERT
+
+
+ Provides a way to disable verification of the server SSL certificate.
+ Available as of PHP 7.0.18 and PHP 7.1.4.
+
+
+
+ This option is available only with mysqlnd.
+
+
+
+
+
+
+
+
+
+
+
+ &reference.pdo-mysql.pdo.entities.mysql;
+
+
+
diff --git a/reference/pdo_mysql/pdo/mysql/getwarningcount.xml b/reference/pdo_mysql/pdo/mysql/getwarningcount.xml
new file mode 100644
index 000000000000..59aaf0d43d42
--- /dev/null
+++ b/reference/pdo_mysql/pdo/mysql/getwarningcount.xml
@@ -0,0 +1,94 @@
+
+
+
+ Pdo\Mysql::getWarningCount
+ Returns the number of warnings from the last executed query
+
+
+
+ &reftitle.description;
+
+ publicintPdo\Mysql::getWarningCount
+
+
+
+ Returns the number of warnings from the last executed query.
+
+
+
+ For retrieving warning messages the following SQL command can be used:
+ SHOW WARNINGS [limit row_count].
+
+
+
+
+
+ &reftitle.parameters;
+ &no.function.parameters;
+
+
+
+ &reftitle.returnvalues;
+
+ Returns an int representing the number of warnings generated by the last query.
+
+
+
+
+ &reftitle.examples;
+
+ Pdo\Mysql::getWarningCount example
+
+query('SELECT 42/0');
+if ($conn->getWarningCount() > 0) {
+ $result = $conn->query("SHOW WARNINGS");
+ $row = $result->fetch();
+ printf("%s (%d): %s\n", $row[0], $row[1], $row[2]);
+}
+
+?>
+]]>
+
+ &example.outputs;
+
+
+
+
+
+
+
+ &reftitle.seealso;
+
+ mysqli_warning_count
+ mysqli::$warning_count
+
+
+
+
+
diff --git a/reference/pdo_mysql/reference.xml b/reference/pdo_mysql/reference.xml
index 79449b648d70..6ccbe52b8727 100644
--- a/reference/pdo_mysql/reference.xml
+++ b/reference/pdo_mysql/reference.xml
@@ -7,7 +7,7 @@
MySQL (PDO)
-
+
&reftitle.intro;
PDO_MYSQL is a driver that implements the PHP
@@ -167,6 +167,7 @@ mysql:unix_socket=/tmp/mysql.sock;dbname=testdb
+ &reference.pdo-mysql.pdo-mysql;
+
+
+
+
+
+
diff --git a/reference/pdo_odbc/constants.xml b/reference/pdo_odbc/constants.xml
index f2b81cb20614..e62c7f5d3a55 100644
--- a/reference/pdo_odbc/constants.xml
+++ b/reference/pdo_odbc/constants.xml
@@ -1,7 +1,7 @@
-
+
&reftitle.constants;
&pdo.driver-constants;
@@ -22,31 +22,42 @@
(int)
-
- This option controls whether the ODBC cursor library is used. The ODBC cursor library
- supports some advanced ODBC features (e.g. block scrollable cursors), which may not
- be implemented by the driver. The following values are supported:
-
-
-
- PDO::ODBC_SQL_USE_IF_NEEDED (the default):
- use the ODBC cursor library when needed.
-
-
-
-
- PDO::ODBC_SQL_USE_DRIVER:
- never use the ODBC cursor library.
-
-
-
-
- PDO::ODBC_SQL_USE_ODBC:
- always use the ODBC cursor library.
-
-
-
-
+
+ &Alias; Pdo\Odbc::ATTR_USE_CURSOR_LIBRARY.
+
+
+
+
+
+ PDO::ODBC_SQL_USE_IF_NEEDED
+ (int)
+
+
+
+ &Alias; Pdo\Odbc::SQL_USE_IF_NEEDED.
+
+
+
+
+
+ PDO::ODBC_SQL_USE_DRIVER
+ (int)
+
+
+
+ &Alias; Pdo\Odbc::SQL_USE_DRIVER.
+
+
+
+
+
+ PDO::ODBC_SQL_USE_ODBC
+ (int)
+
+
+
+ &Alias; Pdo\Odbc::SQL_USE_ODBC.
+
@@ -55,12 +66,9 @@
(bool)
-
- Windows only. If &true;, UTF-16 encoded character data (CHAR,
- VARCHAR and LONGVARCHAR) is converted to
- UTF-8 when reading from or writing data to the database.
- If &false; (the default), character encoding conversion may be done by the driver.
-
+
+ &Alias; Pdo\Odbc::ATTR_ASSUME_UTF8.
+
diff --git a/reference/pdo_odbc/pdo-odbc.xml b/reference/pdo_odbc/pdo-odbc.xml
new file mode 100644
index 000000000000..d59815023a0c
--- /dev/null
+++ b/reference/pdo_odbc/pdo-odbc.xml
@@ -0,0 +1,159 @@
+
+
+ The Pdo\Odbc class
+ Pdo\Odbc
+
+
+
+
+
+ &reftitle.intro;
+
+ A PDO subclass representing a connection using
+ the ODBC PDO driver.
+
+
+
+
+
+ &reftitle.classsynopsis;
+
+
+
+
+ Pdo\Odbc
+
+
+
+ extends
+ PDO
+
+
+ &InheritedConstants;
+
+
+
+
+ &Constants;
+
+ public
+ const
+ int
+ Pdo\Odbc::ATTR_USE_CURSOR_LIBRARY
+
+
+ public
+ const
+ int
+ Pdo\Odbc::ATTR_ASSUME_UTF8
+
+
+ public
+ const
+ int
+ Pdo\Odbc::SQL_USE_IF_NEEDED
+
+
+ public
+ const
+ int
+ Pdo\Odbc::SQL_USE_DRIVER
+
+
+ public
+ const
+ int
+ Pdo\Odbc::SQL_USE_ODBC
+
+
+ &InheritedMethods;
+
+
+
+
+
+
+
+
+
+
+
+
+ &reftitle.constants;
+
+
+ Pdo\Odbc::ATTR_USE_CURSOR_LIBRARY
+
+
+ This option controls whether the ODBC cursor library is used.
+ The ODBC cursor library supports some advanced ODBC features
+ (e.g. block scrollable cursors),
+ which may not be implemented by the driver.
+ The following values are supported:
+
+
+ Pdo\Odbc::SQL_USE_IF_NEEDED
+
+
+ Use the ODBC cursor library when needed.
+ This is the default.
+
+
+
+
+ Pdo\Odbc::SQL_USE_DRIVER
+
+
+ Never use the ODBC cursor library.
+
+
+
+
+ Pdo\Odbc::SQL_USE_ODBC
+
+
+ Always use the ODBC cursor library.
+
+
+
+
+
+
+
+
+ Pdo\Odbc::ATTR_ASSUME_UTF8
+
+
+ Windows only.
+ If &true;, UTF-16 encoded character data (CHAR,
+ VARCHAR and LONGVARCHAR)
+ is converted to UTF-8 when reading from or writing data to the database.
+ If &false; (the default), character encoding conversion may be done by the driver.
+
+
+
+
+
+
+
+
+
diff --git a/reference/pdo_odbc/reference.xml b/reference/pdo_odbc/reference.xml
index 1666e2e6a124..fce87a60cce9 100644
--- a/reference/pdo_odbc/reference.xml
+++ b/reference/pdo_odbc/reference.xml
@@ -7,7 +7,7 @@
ODBC and DB2 (PDO)
-
+
&reftitle.intro;
PDO_ODBC is a driver that implements the PHP Data
@@ -160,6 +160,7 @@ odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\\db.mdb;Uid=Admin
+ &reference.pdo-odbc.pdo-odbc;
+
+
+
+
+
diff --git a/reference/pdo_pgsql/PDO/pgsqlCopyFromArray.xml b/reference/pdo_pgsql/PDO/pgsqlCopyFromArray.xml
index 3e5803ffcdd6..4f8a8246b34c 100644
--- a/reference/pdo_pgsql/PDO/pgsqlCopyFromArray.xml
+++ b/reference/pdo_pgsql/PDO/pgsqlCopyFromArray.xml
@@ -3,80 +3,25 @@
PDO::pgsqlCopyFromArray
- Copy data from PHP array into table
+
+ &Alias; Pdo\Pgsql::copyFromArray
+
&reftitle.description;
- publicboolPDO::pgsqlCopyFromArray
- stringtable_name
+ publicboolPDO::pgsqlCopyFromArray
+ stringtableNamearrayrows
- stringdelimiter"\t"
- stringnull_as"\\\\N"
- stringfields
+ stringseparator"\t"
+ stringnullAs"\\\\N"
+ stringnullfields&null;
-
- Copies data from rows array to table table_name
- using delimiter as fields delimiter and fields list
-
-
-
-
- &reftitle.parameters;
-
-
-
- table_name
-
-
- String containing table name
-
-
-
-
- rows
-
-
- Array of strings with fields separated by delimiter
-
-
-
-
- delimiter
-
-
- Delimiter used in rows array
-
-
-
-
- null_as
-
-
- How to interpret null values
-
-
-
-
- fields
-
-
- List of fields to insert
-
-
-
-
-
-
-
-
- &reftitle.returnvalues;
-
- Returns &true; on success,&return.falseforfailure;.
-
+
+ &info.method.alias; Pdo\Pgsql::copyFromArray.
+
-
-
PDO::pgsqlLOBCreate
- Creates a new large object
+
+ &Alias; Pdo\Pgsql::lobCreate
+
&reftitle.description;
@@ -12,91 +13,11 @@
publicstringPDO::pgsqlLOBCreate
-
- PDO::pgsqlLOBCreate creates a large object and
- returns the OID of that object. You may then open a stream on the object
- using PDO::pgsqlLOBOpen to read or write data to
- it. The OID can be stored in columns of type OID and be used to reference
- the large object, without causing the row to grow arbitrarily large.
- The large object will continue to live in the database until it
- is removed by calling PDO::pgsqlLOBUnlink.
-
-
- Large objects can be up to 2GB in size, but are cumbersome to use; you need
- to ensure that PDO::pgsqlLOBUnlink is called prior
- to deleting the last row that references its OID from your database.
- In addition, large objects have no access controls. As an alternative,
- try the bytea column type; recent versions of PostgreSQL allow bytea
- columns of up to 1GB in size and transparently manage the storage for
- optimal row size.
-
-
-
- This function must be called within a transaction.
-
-
+
+ &info.method.alias; Pdo\Pgsql::lobCreate.
+
-
- &reftitle.parameters;
-
- PDO::pgsqlLOBCreate takes no parameters.
-
-
-
-
- &reftitle.returnvalues;
-
- Returns the OID of the newly created large object on success, or &false;
- on failure.
-
-
-
-
- &reftitle.examples;
-
-
- A PDO::pgsqlLOBCreate example
-
- This example creates a new large object and copies the contents
- of a file into it. The OID is then stored into a table.
-
-
-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-$db->beginTransaction();
-$oid = $db->pgsqlLOBCreate();
-$stream = $db->pgsqlLOBOpen($oid, 'w');
-$local = fopen($filename, 'rb');
-stream_copy_to_stream($local, $stream);
-$local = null;
-$stream = null;
-$stmt = $db->prepare("INSERT INTO BLOBS (ident, oid) VALUES (?, ?)");
-$stmt->execute(array($some_id, $oid));
-$db->commit();
-?>
-]]>
-
-
-
-
-
-
-
- &reftitle.seealso;
-
-
- PDO::pgsqlLOBOpen
- PDO::pgsqlLOBUnlink
- pg_lo_create
-
-
-
-
-
-
-
PDO::pgsqlLOBOpen
- Opens an existing large object stream
+
+ &Alias; Pdo\Pgsql::lobOpen
+
&reftitle.description;
@@ -13,98 +14,11 @@
stringoidstringmode"rb"
-
- PDO::pgsqlLOBOpen opens a stream to access the data
- referenced by oid. If mode
- is r, the stream is opened for reading, if
- mode is w, then the stream will
- be opened for writing. You can use all the usual filesystem functions,
- such as fread, fwrite and
- fgets to manipulate the contents of the stream.
-
-
-
- This function, and all manipulations of the large object,
- must be called and carried out within a transaction.
-
-
+
+ &info.method.alias; Pdo\Pgsql::lobOpen.
+
-
- &reftitle.parameters;
-
-
-
- oid
-
-
- A large object identifier.
-
-
-
-
- mode
-
-
- If mode is r, open the stream for reading.
- If mode is w, open the stream for writing.
-
-
-
-
-
-
-
- &reftitle.returnvalues;
-
- Returns a stream resource on success&return.falseforfailure;.
-
-
-
-
- &reftitle.examples;
-
-
- A PDO::pgsqlLOBOpen example
-
- Following on from the PDO::pgsqlLOBCreate
- example, this code snippet retrieves the large object from
- the database and outputs it to the browser.
-
-
-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-$db->beginTransaction();
-$stmt = $db->prepare("select oid from BLOBS where ident = ?");
-$stmt->execute(array($some_id));
-$stmt->bindColumn('oid', $oid, PDO::PARAM_STR);
-$stmt->fetch(PDO::FETCH_BOUND);
-$stream = $db->pgsqlLOBOpen($oid, 'r');
-header("Content-type: application/octet-stream");
-fpassthru($stream);
-?>
-]]>
-
-
-
-
-
-
-
- &reftitle.seealso;
-
-
- PDO::pgsqlLOBCreate
- PDO::pgsqlLOBUnlink
- pg_lo_open
-
-
-
-
-
-
-
PDO::pgsqlLOBUnlink
- Deletes the large object
+
+ &Alias; Pdo\Pgsql::lobUnlink
+
&reftitle.description;
@@ -12,79 +13,11 @@
publicboolPDO::pgsqlLOBUnlinkstringoid
-
- Deletes a large object from the database identified by OID.
-
-
-
- This function must be called within a transaction.
-
-
-
+
+ &info.method.alias; Pdo\Pgsql::lobUnlink.
+
-
- &reftitle.parameters;
-
-
-
- oid
-
-
- A large object identifier
-
-
-
-
-
-
-
- &reftitle.returnvalues;
-
- &return.success;
-
-
-
-
- &reftitle.examples;
-
-
- A PDO::pgsqlLOBUnlink example
-
- This example unlinks a large object from the database prior to deleting
- the row that references it from the blobs table we've been using in
- our PDO::pgsqlLOBCreate and
- PDO::pgsqlLOBOpen examples.
-
-
-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-$db->beginTransaction();
-$db->pgsqlLOBUnlink($oid);
-$stmt = $db->prepare("DELETE FROM BLOBS where ident = ?");
-$stmt->execute(array($some_id));
-$db->commit();
-?>
-]]>
-
-
-
-
-
-
- &reftitle.seealso;
-
-
- PDO::pgsqlLOBOpen
- PDO::pgsqlLOBCreate
-
-
-
-
-
-
-
+
&reftitle.constants;
&pdo.driver-constants;
-
PDO::PGSQL_ATTR_DISABLE_PREPARES
(int)
-
- Send the query and the parameters to the server together in a single
- call, avoiding the need to create a named prepared statement separately.
- If the query is only going to be executed once this can reduce latency by
- avoiding an unnecessary server round-trip.
-
+
+ &Alias; Pdo\Pgsql::ATTR_DISABLE_PREPARES.
+
-
-
-
- PDO::PGSQL_ATTR_RESULT_MEMORY_SIZE
- (int)
-
-
-
- Returns the amount of memory, in bytes, allocated to the specified query result
- PDOStatement instance,
- or &null; if no results exist before the query is executed.
- Available as of PHP 8.4.0.
-
-
-
-
-
+
+ &reftitle.intro;
+
+ A PDO subclass representing a connection using
+ the PostgreSQL PDO driver.
+
+
+ This driver supports a dedicated SQL query parser for the PostgreSQL dialect.
+ It can handle the following:
+
+
+
+ Single and double-quoted literals, with doubling as escaping mechanism
+
+
+
+
+ C-style “escape” string literals
+
+
+
+
+ Dollar-quoted string literals
+
+
+
+
+ Two-dashes and C-style comments (non-nested).
+
+
+
+
+ Support for ?? as escape sequence for the
+ ? operator.
+
+
+
+
+
+
+
+
+ &reftitle.classsynopsis;
+
+
+
+
+ Pdo\Pgsql
+
+
+
+ extends
+ PDO
+
+
+ &InheritedConstants;
+
+
+
+
+ &Constants;
+
+ public
+ const
+ int
+ Pdo\Pgsql::ATTR_DISABLE_PREPARES
+
+
+ public
+ const
+ int
+ Pdo\Pgsql::ATTR_RESULT_MEMORY_SIZE
+
+
+ public
+ const
+ int
+ Pdo\Pgsql::TRANSACTION_IDLE
+
+
+ public
+ const
+ int
+ Pdo\Pgsql::TRANSACTION_ACTIVE
+
+
+ public
+ const
+ int
+ Pdo\Pgsql::TRANSACTION_INTRANS
+
+
+ public
+ const
+ int
+ Pdo\Pgsql::TRANSACTION_INERROR
+
+
+ public
+ const
+ int
+ Pdo\Pgsql::TRANSACTION_UNKNOWN
+
+
+ &Methods;
+
+
+
+
+ &InheritedMethods;
+
+
+
+
+
+
+
+
+
+
+
+
+ &reftitle.constants;
+
+
+ Pdo\Pgsql::ATTR_DISABLE_PREPARES
+
+
+ Send the query and the parameters to the server together in a single
+ call, avoiding the need to create a named prepared statement separately.
+ If the query is only going to be executed once this can reduce latency by
+ avoiding an unnecessary server round-trip.
+
+
+
+
+ Pdo\Pgsql::ATTR_RESULT_MEMORY_SIZE
+
+
+ Returns the amount of memory, in bytes, allocated to the specified
+ query result PDOStatement instance,
+ or &null; if no results exist before the query is executed.
+
+
+
+
+ Pdo\Pgsql::TRANSACTION_IDLE
+
+
+
+
+
+
+ Pdo\Pgsql::TRANSACTION_ACTIVE
+
+
+
+
+
+
+ Pdo\Pgsql::TRANSACTION_INTRANS
+
+
+
+
+
+
+ Pdo\Pgsql::TRANSACTION_INERROR
+
+
+
+
+
+
+ Pdo\Pgsql::TRANSACTION_UNKNOWN
+
+
+
+
+
+
+
+
+
+ &reference.pdo-pgsql.pdo.entities.pgsql;
+
+
+
diff --git a/reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml b/reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml
new file mode 100644
index 000000000000..8ae887515cb6
--- /dev/null
+++ b/reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml
@@ -0,0 +1,144 @@
+
+
+
+ Pdo\Pgsql::copyFromArray
+ Copy data from a PHP array into a table
+
+
+
+ &reftitle.description;
+
+ publicboolPdo\Pgsql::copyFromArray
+ stringtableName
+ arrayrows
+ stringseparator"\t"
+ stringnullAs"\\\\N"
+ stringnullfields&null;
+
+
+ Copies data from rows array to table
+ tableName using separator
+ as fields delimiter and fields list.
+
+
+
+
+ &reftitle.parameters;
+
+
+ tableName
+
+
+ String containing table name.
+
+
+
+
+ rows
+
+
+ An indexed array of strings with fields
+ separated by separator.
+
+
+
+
+ separator
+
+
+ Delimiter used to separate fields in an entry of the
+ rows array.
+
+
+
+
+ nullAs
+
+
+ How to interpret SQL NULL values.
+
+
+
+
+ fields
+
+
+ List of fields to insert.
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &return.success;
+
+
+
+
+
+
+
+
+ &reftitle.seealso;
+
+ Pdo\Pgsql::copyToArray
+ Pdo\Pgsql::copyFromFile
+ Pdo\Pgsql::copyToFile
+
+
+
+
+
diff --git a/reference/pdo_pgsql/pdo/pgsql/copyfromfile.xml b/reference/pdo_pgsql/pdo/pgsql/copyfromfile.xml
new file mode 100644
index 000000000000..fb4a6c25373e
--- /dev/null
+++ b/reference/pdo_pgsql/pdo/pgsql/copyfromfile.xml
@@ -0,0 +1,122 @@
+
+
+
+ Pdo\Pgsql::copyFromFile
+ Copy data from file into table
+
+
+
+ &reftitle.description;
+
+ publicboolPdo\Pgsql::copyFromFile
+ stringtableName
+ stringfilename
+ stringseparator"\t"
+ stringnullAs"\\\\N"
+ stringnullfields&null;
+
+
+ Copies data from file specified by filename
+ into table tableName using
+ separator as fields delimiter and fields list
+
+
+
+
+ &reftitle.parameters;
+
+
+
+
+
+ filename
+
+
+ Filename containing the data to import.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &return.success;
+
+
+
+
+
+
+
+
+ &reftitle.seealso;
+
+ Pdo\Pgsql::copyToFile
+ Pdo\Pgsql::copyFromArray
+ Pdo\Pgsql::copyToArray
+
+
+
+
+
diff --git a/reference/pdo_pgsql/pdo/pgsql/copytoarray.xml b/reference/pdo_pgsql/pdo/pgsql/copytoarray.xml
new file mode 100644
index 000000000000..e89c3e8dcadf
--- /dev/null
+++ b/reference/pdo_pgsql/pdo/pgsql/copytoarray.xml
@@ -0,0 +1,116 @@
+
+
+
+ Pdo\Pgsql::copyToArray
+ Copy data from database table into PHP array
+
+
+
+ &reftitle.description;
+
+ publicarrayfalsePdo\Pgsql::copyToArray
+ stringtableName
+ stringseparator"\t"
+ stringnullAs"\\\\N"
+ stringnullfields&null;
+
+
+ Copies data from tableName into array using delimiter as fields delimiter and fields list
+
+
+
+
+ &reftitle.parameters;
+
+
+
+
+
+
+
+
+
+
+
+ fields
+
+
+ List of fields to export.
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns an array of rows,&return.falseforfailure;.
+
+
+
+
+
+
+
+
+ &reftitle.seealso;
+
+ Pdo\Pgsql::copyFromArray
+ Pdo\Pgsql::copyFromFile
+ Pdo\Pgsql::copyToFile
+
+
+
+
+
diff --git a/reference/pdo_pgsql/pdo/pgsql/copytofile.xml b/reference/pdo_pgsql/pdo/pgsql/copytofile.xml
new file mode 100644
index 000000000000..bce96872e505
--- /dev/null
+++ b/reference/pdo_pgsql/pdo/pgsql/copytofile.xml
@@ -0,0 +1,136 @@
+
+
+
+ Pdo\Pgsql::copyToFile
+ Copy data from table into file
+
+
+
+ &reftitle.description;
+
+ publicboolPdo\Pgsql::copyToFile
+ stringtableName
+ stringfilename
+ stringseparator"\t"
+ stringnullAs"\\\\N"
+ stringnullfields&null;
+
+
+ Copies data from table into file specified by filename
+ using separator as fields delimiter and
+ fields list.
+
+
+
+
+ &reftitle.parameters;
+
+
+
+
+
+ filename
+
+
+ Filename to export data.
+
+
+
+
+
+
+
+
+
+
+ fields
+
+
+ List of fields to insert.
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &return.success;
+
+
+
+
+
+
+
+
+ &reftitle.seealso;
+
+ Pdo\Pgsql::copyFromFile
+ Pdo\Pgsql::copyFromArray
+ Pdo\Pgsql::copyToArray
+
+
+
+
+
diff --git a/reference/pdo_pgsql/pdo/pgsql/escapeidentifier.xml b/reference/pdo_pgsql/pdo/pgsql/escapeidentifier.xml
new file mode 100644
index 000000000000..cda80ea19803
--- /dev/null
+++ b/reference/pdo_pgsql/pdo/pgsql/escapeidentifier.xml
@@ -0,0 +1,110 @@
+
+
+
+ Pdo\Pgsql::escapeIdentifier
+ Escapes a string for use as an SQL identifier
+
+
+
+ &reftitle.description;
+
+ publicstringPdo\Pgsql::escapeIdentifier
+ stringinput
+
+
+ Escapes a string for use as an SQL identifier, such as a table, column, or function name.
+ This is useful when a user-supplied identifier might contain special characters
+ that would otherwise not be interpreted as part of the identifier by the SQL parser,
+ or when the identifier might contain upper case characters whose case should be preserved.
+
+
+
+
+ &reftitle.parameters;
+
+
+ input
+
+
+ A string containing text to be escaped.
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ A string containing the escaped data.
+
+
+
+
+ &reftitle.examples;
+
+ Pdo\Pgsql::escapeIdentifier example
+
+exec("CREATE TABLE $unescapedTableName ()");
+
+$escapedTableName = $pdo->escapeIdentifier('EscapedTableName');
+$pdo->exec("CREATE TABLE $escapedTableName ()");
+
+$statement = $pdo->query(
+ "SELECT relname FROM pg_stat_user_tables WHERE relname ilike '%tablename'"
+);
+
+var_export($statement->fetchAll(PDO::FETCH_COLUMN, 0));
+
+$tableNameWithSymbols = 'Table-Name-With-Symbols';
+$pdo->exec("CREATE TABLE $tableNameWithSymbols ()");
+?>
+]]>
+
+ &example.outputs.similar;
+
+ 'unescapedtablename',
+ 1 => 'EscapedTableName',
+)
+Fatal error: Uncaught PDOException: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "Table"
+LINE 1: CREATE TABLE Table-Name-With-Symbols ()
+]]>
+
+
+
+
+
+ &reftitle.seealso;
+
+ PDO::quote
+
+
+
+
+
diff --git a/reference/pdo_pgsql/pdo/pgsql/getnotify.xml b/reference/pdo_pgsql/pdo/pgsql/getnotify.xml
new file mode 100644
index 000000000000..c5c74fe0db1a
--- /dev/null
+++ b/reference/pdo_pgsql/pdo/pgsql/getnotify.xml
@@ -0,0 +1,132 @@
+
+
+
+ Pdo\Pgsql::getNotify
+ Get asynchronous notification
+
+
+
+ &reftitle.description;
+
+ publicarrayfalsePdo\Pgsql::getNotify
+ intfetchModePDO::FETCH_DEFAULT
+ inttimeoutMilliseconds0
+
+
+ Returns a result set representing a pending asynchronous notification.
+
+
+
+
+ &reftitle.parameters;
+
+
+ fetchMode
+
+
+ The format the result set should be returned as,
+ one of the following constants:
+
+ PDO::FETCH_DEFAULT
+ PDO::FETCH_BOTH
+ PDO::FETCH_ASSOC
+ PDO::FETCH_NUM
+
+
+
+
+
+ timeoutMilliseconds
+
+
+ The length of time to wait for a response, in milliseconds.
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ If one or more notifications is pending, returns a single row,
+ with fields message and pid,
+ otherwise returns &false;.
+
+
+
+
+ &reftitle.errors;
+
+ A ValueError is thrown if
+ fetchMode is not one of the valid
+ PDO::FETCH_*
+ constants.
+
+
+ A ValueError is thrown if
+ timeoutMilliseconds is less than 0.
+
+
+ A E_WARNING is raised when
+ timeoutMilliseconds is greater than the value
+ that can be contained in a signed 32-bit integer, in which case it will be
+ the maximum value of a signed 32-bit integer.
+
+
+
+
+
+
+ &reftitle.seealso;
+
+ PDO::query
+ PDOStatement::fetch
+ PDOStatement::fetchAll
+
+
+
+
+
diff --git a/reference/pdo_pgsql/pdo/pgsql/getpid.xml b/reference/pdo_pgsql/pdo/pgsql/getpid.xml
new file mode 100644
index 000000000000..67ea2ee966f4
--- /dev/null
+++ b/reference/pdo_pgsql/pdo/pgsql/getpid.xml
@@ -0,0 +1,52 @@
+
+
+
+ Pdo\Pgsql::getPid
+ Get the PID of the backend process handling this connection
+
+
+
+ &reftitle.description;
+
+ publicintPdo\Pgsql::getPid
+
+
+
+ Returns the PID of the backend process handling this connection.
+ Note that the PID belongs to a process executing on the database server host,
+ not the local host.
+
+
+
+
+ &reftitle.parameters;
+ &no.function.parameters;
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the PID as an int.
+
+
+
+
diff --git a/reference/pdo_pgsql/pdo/pgsql/lobcreate.xml b/reference/pdo_pgsql/pdo/pgsql/lobcreate.xml
new file mode 100644
index 000000000000..cc2ac23df4e5
--- /dev/null
+++ b/reference/pdo_pgsql/pdo/pgsql/lobcreate.xml
@@ -0,0 +1,116 @@
+
+
+
+ Pdo\Pgsql::lobCreate
+ Creates a new large object
+
+
+
+ &reftitle.description;
+
+ publicstringfalsePdo\Pgsql::lobCreate
+
+
+
+ Pdo\Pgsql::lobCreate creates a large object
+ and returns the OID which refers to it.
+ It can be opened to read or write data with
+ Pdo\Pgsql::lobOpen.
+
+
+ The OID can be stored in columns of type OID and be used to reference
+ the large object, without causing the row to grow arbitrarily large.
+ The large object will continue to live in the database until it
+ is removed by calling Pdo\Pgsql::lobUnlink.
+
+
+ Large objects are cumbersome to use.
+ Indeed, it is required that Pdo\Pgsql::lobUnlink
+ is called prior to deleting the last row referencing the OID in the entire database;
+ otherwise, unreferenced large objects will remain on the server indefinitely.
+ Moreover, large objects have no access controls.
+ An alternative is the bytea column type, which can be up to 1GB in size,
+ and this column type transparently manages the storage for optimal row size.
+
+
+
+ This function, and all manipulations of the large object,
+ must be called and carried out within a transaction.
+
+
+
+
+
+ &reftitle.parameters;
+ &no.function.parameters;
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the OID of the newly created large object on success,
+ &return.falseforfailure;.
+
+
+
+
+ &reftitle.examples;
+
+ Pdo\Pgsql::lobCreate example
+
+ This example creates a new large object and copies the contents
+ of a file into it.
+ The OID is then stored into a table.
+
+
+setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+$db->beginTransaction();
+$oid = $db->lobCreate();
+$stream = $db->lobOpen($oid, 'w');
+$local = fopen($filename, 'rb');
+stream_copy_to_stream($local, $stream);
+$local = null;
+$stream = null;
+$stmt = $db->prepare("INSERT INTO BLOBS (ident, oid) VALUES (?, ?)");
+$stmt->execute([$some_id, $oid]);
+$db->commit();
+?>
+]]>
+
+
+
+
+
+ &reftitle.seealso;
+
+ Pdo\Pgsql::lobOpen
+ Pdo\Pgsql::lobUnlink
+ pg_lo_create
+ pg_lo_open
+
+
+
+
+
diff --git a/reference/pdo_pgsql/pdo/pgsql/lobopen.xml b/reference/pdo_pgsql/pdo/pgsql/lobopen.xml
new file mode 100644
index 000000000000..582979843481
--- /dev/null
+++ b/reference/pdo_pgsql/pdo/pgsql/lobopen.xml
@@ -0,0 +1,123 @@
+
+
+
+ Pdo\Pgsql::lobOpen
+ Opens an existing large object stream
+
+
+
+ &reftitle.description;
+
+ publicresourcefalsePdo\Pgsql::lobOpen
+ stringoid
+ stringmode"rb"
+
+
+ Pdo\Pgsql::lobOpen opens a stream to access
+ the data referenced by oid.
+ All usual filesystem functions, such as fread,
+ fwrite or fgets can be used
+ to manipulate the contents of the stream.
+
+
+
+
+
+
+
+ &reftitle.parameters;
+
+
+ oid
+
+
+ A large object identifier.
+
+
+
+
+ mode
+
+
+ If mode is r, open the stream for reading.
+ If mode is w, open the stream for writing.
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns a stream resource on success,&return.falseforfailure;.
+
+
+
+
+ &reftitle.errors;
+
+ When does this function issue E_* level errors,
+ and/or throw Exceptions.
+
+
+
+
+ &reftitle.examples;
+
+ Pdo\Pgsql::lobOpen example
+
+ Following on from the Pdo\Pgsql::lobCreate
+ example, this code snippet retrieves the large object from
+ the database and outputs it to the browser.
+
+
+setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+$db->beginTransaction();
+$stmt = $db->prepare("SELECT oid FROM BLOBS WHERE ident = ?");
+$stmt->execute(array($some_id));
+$stmt->bindColumn('oid', $oid, PDO::PARAM_STR);
+$stmt->fetch(PDO::FETCH_BOUND);
+$stream = $db->pgsqlLOBOpen($oid, 'r');
+header("Content-type: application/octet-stream");
+fpassthru($stream);
+?>
+]]>
+
+
+
+
+
+ &reftitle.seealso;
+
+ Pdo\Pgsql::lobCreate
+ Pdo\Pgsql::lobUnlink
+ pg_lo_create
+ pg_lo_open
+
+
+
+
+
diff --git a/reference/pdo_pgsql/pdo/pgsql/lobunlink.xml b/reference/pdo_pgsql/pdo/pgsql/lobunlink.xml
new file mode 100644
index 000000000000..07bf1b6bc3ef
--- /dev/null
+++ b/reference/pdo_pgsql/pdo/pgsql/lobunlink.xml
@@ -0,0 +1,99 @@
+
+
+
+ Pdo\Pgsql::lobUnlink
+ Deletes the large object
+
+
+
+ &reftitle.description;
+
+ publicboolPdo\Pgsql::lobUnlink
+ stringoid
+
+
+ Deletes a large object from the database identified by OID.
+
+
+
+
+
+
+
+ &reftitle.parameters;
+
+
+ oid
+
+
+ A large object identifier.
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &return.success;
+
+
+
+
+ &reftitle.examples;
+
+ Pdo\Pgsql::lobUnlink example
+
+ This example unlinks a large object from the database prior to deleting
+ the row that references it from the blobs table are used in the examples of
+ Pdo\Pgsql::lobCreate and
+ Pdo\Pgsql::lobOpen.
+
+
+setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+$db->beginTransaction();
+$db->pgsqlLOBUnlink($oid);
+$stmt = $db->prepare("DELETE FROM BLOBS where ident = ?");
+$stmt->execute(array($some_id));
+$db->commit();
+?>
+]]>
+
+
+
+
+
+ &reftitle.seealso;
+
+ Pdo\Pgsql::lobCreate
+ Pdo\Pgsql::lobOpen
+ pg_lo_create
+ pg_lo_open
+
+
+
+
+
diff --git a/reference/pdo_pgsql/pdo/pgsql/setnoticecallback.xml b/reference/pdo_pgsql/pdo/pgsql/setnoticecallback.xml
new file mode 100644
index 000000000000..8d95834e07a8
--- /dev/null
+++ b/reference/pdo_pgsql/pdo/pgsql/setnoticecallback.xml
@@ -0,0 +1,111 @@
+
+
+
+ Pdo\Pgsql::setNoticeCallback
+ Set a callback to handle notice and warning messages generated by the backend
+
+
+
+ &reftitle.description;
+
+ publicvoidPdo\Pgsql::setNoticeCallback
+ callablenullcallback
+
+
+ Set a callback to handle notice and warning messages generated by the backend.
+ This includes messages emitted by PostgreSQL itself,
+ as well as those raised by user-defined SQL functions using RAISE.
+ Please note that the actual receipt of these messages
+ depends on the backend setting client_min_messages.
+
+
+
+
+ &reftitle.parameters;
+
+
+ callback
+
+
+ If &null; is passed, the handler is reset to its default state.
+
+
+ Otherwise, the handler is a callback with the following signature:
+
+ voidhandler
+ stringmessage
+
+
+
+ message
+
+
+ A message generated by the backend.
+
+
+
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &return.void;
+
+
+
+
+ &reftitle.examples;
+
+ Pdo\Pgsql::setNoticeCallback example
+
+exec('CREATE TABLE parent(id int primary key)');
+$pdo->exec('CREATE TABLE child(id int references parent)');
+
+$pdo->setNoticeCallback(function ($message) {
+ echo $message;
+});
+
+$pdo->exec('TRUNCATE parent CASCADE');
+?>
+]]>
+
+ &example.outputs.similar;
+
+
+
+
+
+
+
+
diff --git a/reference/pdo_pgsql/reference.xml b/reference/pdo_pgsql/reference.xml
index 43e150216dfb..1c4975b33f50 100644
--- a/reference/pdo_pgsql/reference.xml
+++ b/reference/pdo_pgsql/reference.xml
@@ -7,7 +7,7 @@
PostgreSQL (PDO)
-
+
&reftitle.intro;
PDO_PGSQL is a driver that implements the PHP
@@ -16,7 +16,7 @@
-
+
&reftitle.resources;
This extension defines a stream resource returned by
@@ -27,7 +27,7 @@
&reference.pdo-pgsql.configure;
&reference.pdo-pgsql.constants;
-
+ General notes
@@ -153,7 +153,7 @@ pgsql:host=/tmp;port=5432;dbname=testdb;user=bruce;password=mypass
&reference.pdo-pgsql.entities.PDO;
-
+ &reference.pdo-pgsql.pdo-pgsql;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/reference/pdo_sqlite/PDO/sqliteCreateAggregate.xml b/reference/pdo_sqlite/PDO/sqliteCreateAggregate.xml
index c883515fa4b9..3913996ec2c0 100644
--- a/reference/pdo_sqlite/PDO/sqliteCreateAggregate.xml
+++ b/reference/pdo_sqlite/PDO/sqliteCreateAggregate.xml
@@ -4,7 +4,7 @@
PDO::sqliteCreateAggregate
- Registers an aggregating User Defined Function for use in SQL statements
+ &Alias; Pdo\Sqlite::createAggregate
@@ -12,257 +12,16 @@
&reftitle.description;
publicboolPDO::sqliteCreateAggregate
- stringfunction_name
- callablestep_func
- callablefinalize_func
- intnum_args
+ stringname
+ callablestep
+ callablefinalize
+ intnumArgs-1
- &warn.experimental.func;
-
- This method is similar to except that it registers functions that can be used to calculate a
- result aggregated across all the rows of a query.
-
-
- The key difference between this method and is that two functions are
- required to manage the aggregate.
-
+
+ &info.method.alias; Pdo\Sqlite::createAggregate.
+
-
-
- &reftitle.parameters;
-
-
-
- function_name
-
-
- The name of the function used in SQL statements.
-
-
-
-
- step_func
-
-
- Callback function called for each row of the result set. Your PHP
- function should accumulate the result and store it in the aggregation
- context.
-
-
- This function need to be defined as:
-
- mixedstep
- mixedcontext
- intrownumber
- mixedvalue
- mixedvalues
-
-
-
- context
-
-
- &null; for the first row; on subsequent rows it will have the value
- that was previously returned from the step function; you should use
- this to maintain the aggregate state.
-
-
-
-
- rownumber
-
-
- The current row number.
-
-
-
-
- value
-
-
- The first argument passed to the aggregate.
-
-
-
-
- values
-
-
- Further arguments passed to the aggregate.
-
-
-
-
- The return value of this function will be used as the
- context argument in the next call of the step or
- finalize functions.
-
-
-
-
- finalize_func
-
-
- Callback function to aggregate the "stepped" data from each row.
- Once all the rows have been processed, this function will be called
- and it should then take the data from the aggregation context and
- return the result. This callback function should return a type understood
- by SQLite (i.e. scalar type).
-
-
- This function need to be defined as:
-
- mixedfini
- mixedcontext
- introwcount
-
-
-
- context
-
-
- Holds the return value from the very last call to the step function.
-
-
-
-
- rowcount
-
-
- Holds the number of rows over which the aggregate was performed.
-
-
-
-
- The return value of this function will be used as the return value for
- the aggregate.
-
-
-
-
- num_args
-
-
- Hint to the SQLite parser if the callback function accepts a
- predetermined number of arguments.
-
-
-
-
-
-
-
-
- &reftitle.returnvalues;
-
- &return.success;
-
-
-
-
- &reftitle.examples;
-
-
- max_length aggregation function example
-
-exec("CREATE TABLE strings(a)");
-$insert = $db->prepare('INSERT INTO strings VALUES (?)');
-foreach ($data as $str) {
- $insert->execute(array($str));
-}
-$insert = null;
-
-function max_len_step($context, $rownumber, $string)
-{
- if (strlen($string) > $context) {
- $context = strlen($string);
- }
- return $context;
-}
-
-function max_len_finalize($context, $rowcount)
-{
- return $context === null ? 0 : $context;
-}
-
-$db->sqliteCreateAggregate('max_len', 'max_len_step', 'max_len_finalize');
-
-var_dump($db->query('SELECT max_len(a) from strings')->fetchAll());
-
-?>
-]]>
-
-
-
-
- In this example, we are creating an aggregating function that will
- calculate the length of the longest string in one of the columns of the
- table. For each row, the max_len_step function is
- called and passed a $context parameter. The context
- parameter is just like any other PHP variable and be set to hold an array
- or even an object value. In this example, we are simply using it to hold
- the maximum length we have seen so far; if the
- $string has a length longer than the current
- maximum, we update the context to hold this new maximum length.
-
-
- After all of the rows have been processed, SQLite calls the
- max_len_finalize function to determine the aggregate
- result. Here, we could perform some kind of calculation based on the
- data found in the $context. In our simple example
- though, we have been calculating the result as the query progressed, so we
- simply need to return the context value.
-
-
-
- It is NOT recommended for you to store a copy of the values in the context
- and then process them at the end, as you would cause SQLite to use a lot of
- memory to process the query - just think of how much memory you would need
- if a million rows were stored in memory, each containing a string 32 bytes
- in length.
-
-
-
-
- You can use and
- to override SQLite
- native SQL functions.
-
-
-
-
-
-
- &reftitle.seealso;
-
-
-
- sqlite_create_function
- sqlite_create_aggregate
-
-
-
-
-
-
-
- You can use and
- to override SQLite
- native SQL functions.
-
-
-
-
-
- &reftitle.seealso;
-
-
-
- sqlite_create_function
- sqlite_create_aggregate
-
-
-
-
-
+
+ &reftitle.intro;
+
+ A PDO subclass representing a connection using
+ the SQLite PDO driver.
+
+
+ This driver supports a dedicated SQL query parser for the SQLite dialect.
+ It can handle the following:
+
+
+
+ Single, double-quoted, and backtick literals, with doubling as escaping mechanism.
+
+
+
+
+ Square brackets quoting for identifiers.
+
+
+
+
+ Two-dashes and C-style comments (non-nested).
+
+
+
+
+
+
+
+
+ &reftitle.classsynopsis;
+
+
+
+
+ Pdo\Sqlite
+
+
+
+ extends
+ PDO
+
+
+ &InheritedConstants;
+
+
+
+
+ &Constants;
+
+ public
+ const
+ int
+ Pdo\Sqlite::DETERMINISTIC
+
+
+ public
+ const
+ int
+ Pdo\Sqlite::OPEN_READONLY
+
+
+ public
+ const
+ int
+ Pdo\Sqlite::OPEN_READWRITE
+
+
+ public
+ const
+ int
+ Pdo\Sqlite::OPEN_CREATE
+
+
+ public
+ const
+ int
+ Pdo\Sqlite::ATTR_OPEN_FLAGS
+
+
+ public
+ const
+ int
+ Pdo\Sqlite::ATTR_READONLY_STATEMENT
+
+
+ public
+ const
+ int
+ Pdo\Sqlite::ATTR_EXTENDED_RESULT_CODES
+
+
+ &Methods;
+
+
+
+
+ &InheritedMethods;
+
+
+
+
+
+
+
+
+
+
+
+
+ &reftitle.constants;
+
+
+ Pdo\Sqlite::DETERMINISTIC
+
+
+
+
+
+
+ Pdo\Sqlite::OPEN_READONLY
+
+
+
+
+
+
+ Pdo\Sqlite::OPEN_READWRITE
+
+
+
+
+
+
+ Pdo\Sqlite::OPEN_CREATE
+
+
+
+
+
+
+ Pdo\Sqlite::ATTR_OPEN_FLAGS
+
+
+
+
+
+
+ Pdo\Sqlite::ATTR_READONLY_STATEMENT
+
+
+
+
+
+
+ Pdo\Sqlite::ATTR_EXTENDED_RESULT_CODES
+
+
+
+
+
+
+
+
+
+ &reference.pdo-sqlite.pdo.entities.sqlite;
+
+
+
diff --git a/reference/pdo_sqlite/pdo/sqlite/createaggregate.xml b/reference/pdo_sqlite/pdo/sqlite/createaggregate.xml
new file mode 100644
index 000000000000..525d04c7d94a
--- /dev/null
+++ b/reference/pdo_sqlite/pdo/sqlite/createaggregate.xml
@@ -0,0 +1,285 @@
+
+
+
+ Pdo\Sqlite::createAggregate
+
+ Registers an aggregating user-defined function for use in SQL statements
+
+
+
+
+ &reftitle.description;
+
+ publicboolPdo\Sqlite::createAggregate
+ stringname
+ callablestep
+ callablefinalize
+ intnumArgs-1
+
+
+ This method is similar to Pdo\Sqlite::createFunction
+ except that it registers functions that can be used to calculate a
+ result aggregated across all the rows of a query.
+
+
+ The key difference between this method and
+ Pdo\Sqlite::createFunction
+ is that two functions are required to manage the aggregate.
+
+
+
+ By using this method it is possible to override native SQL functions.
+
+
+
+
+
+ &reftitle.parameters;
+
+
+ name
+
+
+ The name of the function used in SQL statements.
+
+
+
+
+ step
+
+
+ Callback function called for each row of the result set.
+ The callback should accumulate the result and store it in the aggregation context.
+
+
+ This function need to be defined as:
+
+ mixedstep
+ mixedcontext
+ intrownumber
+ mixedvalue
+ mixedvalues
+
+
+
+ context
+
+
+ &null; for the first row; on subsequent rows it will have the value
+ that was previously returned from the step function; you should use
+ this to maintain the aggregate state.
+
+
+
+
+ rownumber
+
+
+ The current row number.
+
+
+
+
+ value
+
+
+ The first argument passed to the aggregate.
+
+
+
+
+ values
+
+
+ Further arguments passed to the aggregate.
+
+
+
+
+ The return value of this function will be used as the
+ context argument in the next call of the step or
+ finalize functions.
+
+
+
+
+ finalize
+
+
+ Callback function to aggregate the "stepped" data from each row.
+ Once all the rows have been processed, this function will be called,
+ and it should then take the data from the aggregation context and return the result.
+ This callback function should return a type understood by SQLite
+ (i.e. scalar type).
+
+
+ This function need to be defined as:
+
+ mixedfini
+ mixedcontext
+ introwcount
+
+
+
+ context
+
+
+ Holds the return value from the very last call to the step function.
+
+
+
+
+ rowcount
+
+
+ Holds the number of rows over which the aggregate was performed.
+
+
+
+
+ The return value of this function will be used as the return value for
+ the aggregate.
+
+
+
+
+ numArgs
+
+
+ Hint to the SQLite parser if the callback function accepts a
+ predetermined number of arguments.
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &return.success;
+
+
+
+
+ &reftitle.examples;
+
+ Pdo\Sqlite::createAggregate example
+
+ In this example we will create a custom aggregate function named
+ max_length that can be used in SQL queries.
+
+
+ In this example, we are creating an aggregating function,
+ named max_length, that will calculate the length
+ of the longest string in one of the columns of the table.
+ For each row, the max_len_step function is called and
+ passed a $context parameter.
+ The context parameter is just like any other PHP variable and be set to
+ hold an array or even an object.
+ In this example, we are using it to hold the maximum length we have seen so far;
+ if the $string has a length longer than the current maximum,
+ we update the context to hold this new maximum length.
+
+
+ After all the rows have been processed,
+ SQLite calls the max_len_finalize function to determine
+ the aggregate result.
+ It is possible to perform some kind of calculation based on the data in $context.
+ In this basic example the result was calculated as the query progressed,
+ thus so the context value can be directly returned.
+
+
+exec("CREATE TABLE strings(a)");
+$insert = $db->prepare('INSERT INTO strings VALUES (?)');
+foreach ($data as $str) {
+ $insert->execute(array($str));
+}
+$insert = null;
+
+function max_len_step($context, $row_number, $string)
+{
+ if (strlen($string) > $context) {
+ $context = strlen($string);
+ }
+ return $context;
+}
+
+function max_len_finalize($context, $row_count)
+{
+ return $context === null ? 0 : $context;
+}
+
+$db->createAggregate('max_len', 'max_len_step', 'max_len_finalize');
+
+var_dump($db->query('SELECT max_len(a) from strings')->fetchAll());
+
+?>
+]]>
+
+
+
+
+ It is NOT recommended for you to store a copy of the values in the context
+ and then process them at the end, as you would cause SQLite to use a lot of
+ memory to process the query - just think of how much memory you would need
+ if a million rows were stored in memory, each containing a string 32 bytes
+ in length.
+
+
+
+
+
+
+ &reftitle.seealso;
+
+ Pdo\Sqlite::createFunction
+ Pdo\Sqlite::createCollation
+ sqlite_create_function
+ sqlite_create_aggregate
+
+
+
+
+
diff --git a/reference/pdo_sqlite/pdo/sqlite/createcollation.xml b/reference/pdo_sqlite/pdo/sqlite/createcollation.xml
new file mode 100644
index 000000000000..f913eff8ef3b
--- /dev/null
+++ b/reference/pdo_sqlite/pdo/sqlite/createcollation.xml
@@ -0,0 +1,134 @@
+
+
+
+ Pdo\Sqlite::createCollation
+
+ Registers a user-defined function for use as a collating function in SQL statements
+
+
+
+
+ &reftitle.description;
+
+ publicboolPdo\Sqlite::createCollation
+ stringname
+ callablecallback
+
+
+ This method is similar to Pdo\Sqlite::createFunction
+ except that it registers functions that are used to collate strings.
+
+
+
+
+ &reftitle.parameters;
+
+
+ name
+
+
+ Name of the SQL collating function to be created or redefined.
+
+
+
+
+ callback
+
+
+ Callback function that defines the behaviour of a collation.
+ It must accept two strings and return
+ -1, 0, or 1
+ if the first string sorts before, sorts identically, or sorts after
+ the second string respectively.
+ An internal function that behaves like this is strcmp.
+
+
+ This function need to be defined as:
+
+ intcollation
+ stringstring1
+ stringstring2
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &return.success;
+
+
+
+
+ &reftitle.examples;
+
+ Pdo\Sqlite::createCollation example
+
+exec("CREATE TABLE test (col1 string)");
+$db->exec("INSERT INTO test VALUES ('a1')");
+$db->exec("INSERT INTO test VALUES ('a10')");
+$db->exec("INSERT INTO test VALUES ('a2')");
+
+$db->sqliteCreateCollation('NATURAL_CMP', 'strnatcmp');
+foreach ($db->query("SELECT col1 FROM test ORDER BY col1") as $row) {
+ echo $row['col1'] . "\n";
+}
+echo "\n";
+foreach ($db->query("SELECT col1 FROM test ORDER BY col1 COLLATE NATURAL_CMP") as $row) {
+ echo $row['col1'] . "\n";
+}
+?>
+]]>
+
+ &example.outputs;
+
+
+
+
+
+
+
+ &reftitle.seealso;
+
+ Pdo\Sqlite::createFunction
+ Pdo\Sqlite::createAggregate
+ sqlite_create_function
+ sqlite_create_aggregate
+
+
+
+
+
diff --git a/reference/pdo_sqlite/pdo/sqlite/createfunction.xml b/reference/pdo_sqlite/pdo/sqlite/createfunction.xml
new file mode 100644
index 000000000000..44dd2263b040
--- /dev/null
+++ b/reference/pdo_sqlite/pdo/sqlite/createfunction.xml
@@ -0,0 +1,183 @@
+
+
+
+ Pdo\Sqlite::createFunction
+
+ Registers a user-defined function for use in SQL statements
+
+
+
+
+ &reftitle.description;
+
+ publicboolPdo\Sqlite::createFunction
+ stringfunction_name
+ callablecallback
+ intnum_args-1
+ intflags0
+
+
+ This method allows PHP function to be registered with SQLite as a
+ user-defined function, so that it can be called within SQL queries.
+ The defined function can be used in any SQL query that allows function calls,
+ for example SELECT, UPDATE, or triggers.
+
+
+
+ By using this method it is possible to override native SQL functions.
+
+
+
+
+
+ &reftitle.parameters;
+
+
+ function_name
+
+
+ The name of the function used in SQL statements.
+
+
+
+
+ callback
+
+
+ Callback function to handle the defined SQL function.
+
+
+
+ Callback functions should return a type understood by SQLite (i.e.
+ scalar type).
+
+
+
+ This function need to be defined as:
+
+ mixedcallback
+ mixedvalue
+ mixedvalues
+
+
+
+ value
+
+
+ The first argument passed to the SQL function.
+
+
+
+
+ values
+
+
+ Further arguments passed to the SQL function.
+
+
+
+
+
+
+
+
+ num_args
+
+
+ The number of arguments that the SQL function takes.
+ If this parameter is -1,
+ then the SQL function may take any number of arguments.
+
+
+
+
+ flags
+
+
+ A bitmask of flags.
+ Currently, only Pdo\Sqlite::DETERMINISTIC is supported,
+ which specifies that the function always returns the same result given
+ the same inputs within a single SQL statement.
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &return.success;
+
+
+
+
+ &reftitle.examples;
+
+ Pdo\Sqlite::createFunction example
+
+ In this example, we have a function that calculates the SHA256 sum of a
+ string, and then reverses it. When the SQL statement executes, it
+ returns the value of the filename transformed by our function.
+ The data returned in $rows contains the processed result.
+
+
+ The beauty of this technique is that there is no need to process the
+ result using a &foreach; loop after the query.
+
+
+sqliteCreateFunction('sha256rev', 'sha256_and_reverse', 1);
+$rows = $db->query('SELECT sha256rev(filename) FROM files')->fetchAll();
+?>
+]]>
+
+
+
+
+
+
+ &reftitle.seealso;
+
+ Pdo\Sqlite::createAggregate
+ Pdo\Sqlite::createCollation
+ sqlite_create_function
+ sqlite_create_aggregate
+
+
+
+
+
diff --git a/reference/pdo_sqlite/reference.xml b/reference/pdo_sqlite/reference.xml
index 6a205be15e1f..e0fdd2a8b678 100644
--- a/reference/pdo_sqlite/reference.xml
+++ b/reference/pdo_sqlite/reference.xml
@@ -7,7 +7,7 @@
SQLite (PDO)
-
+
&reftitle.intro;
PDO_SQLITE is a driver that implements the PHP
@@ -91,6 +91,7 @@ sqlite:
&reference.pdo-sqlite.entities.PDO;
+ &reference.pdo-sqlite.pdo-sqlite;
+
+
+
+
+
+
+
+