From 14ba1dcb170285b74d4a76ecb8417936c34dc467 Mon Sep 17 00:00:00 2001 From: Christoph Michael Becker Date: Sun, 8 Nov 2020 12:25:50 +0000 Subject: [PATCH] Updating mysqli: bring overview up to date Patch contributed by Dharman . git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@351329 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/mysqli/overview.xml | 110 ++++++---------------------------- 1 file changed, 17 insertions(+), 93 deletions(-) diff --git a/reference/mysqli/overview.xml b/reference/mysqli/overview.xml index b84d0cadc2..8b79779993 100644 --- a/reference/mysqli/overview.xml +++ b/reference/mysqli/overview.xml @@ -23,11 +23,11 @@ - APIs can be procedural or object-oriented. With a procedural API you + APIs can be procedural or object-oriented. With a procedural API, you call functions to carry out tasks, with the object-oriented API you instantiate classes and then call methods on the resulting objects. - Of the two the latter is usually the preferred interface, as it is - more modern and leads to better organized code. + Of the two, the latter is usually the preferred interface, as it is + more modern and leads to better-organized code. @@ -51,7 +51,7 @@ If your PHP application needs to communicate with a database server you will need to write PHP code to perform such activities as - connecting to the database server, querying the database and other + connecting to the database server, querying the database, and other database-related functions. Software is required to provide the API that your PHP application will use, and also handle the communication between your application and the database server, @@ -95,8 +95,8 @@ In the PHP documentation you will come across another term - extension. The PHP code consists of a core, with optional extensions to the core functionality. PHP's - MySQL-related extensions, such as the mysqli - extension, and the mysql extension, are + MySQL-related extensions, such as the mysqli + extension, and the PDO MySQL driver extension, are implemented using the PHP extension framework. @@ -125,18 +125,12 @@ - There are three main API options when considering connecting to a + There are two main API options when considering connecting to a MySQL database server: - - - PHP's MySQL Extension - - - PHP's mysqli Extension @@ -157,37 +151,6 @@ each API. - - What is PHP's MySQL Extension? - - - - This is the original extension designed to allow you to develop PHP - applications that interact with a MySQL database. The - mysql extension provides a procedural interface - and is intended for use only with MySQL versions older than 4.1.3. - This extension can be used with versions of MySQL 4.1.3 or newer, - but not all of the latest MySQL server features will be available. - - - - - If you are using MySQL versions 4.1.3 or later it is - strongly recommended that you use the - mysqli extension instead. - - - - - The mysql extension source code is located in the - PHP extension directory ext/mysql. - - - - For further information on the mysql extension, - see . - - What is PHP's mysqli Extension? @@ -240,14 +203,6 @@ - - - If you are using MySQL versions 4.1.3 or later it is - strongly recommended that you use this - extension. - - - As well as the object-oriented interface the extension also provides a procedural interface. @@ -307,7 +262,7 @@ The PDO MYSQL driver is not an API as such, at least from the PHP - programmer's perspective. In fact the PDO MYSQL driver sits in the + programmer's perspective. In fact, the PDO MYSQL driver sits in the layer below PDO itself and provides MySQL-specific functionality. The programmer still calls the PDO API, but PDO uses the PDO MYSQL driver to carry out communication with the MySQL server. @@ -336,8 +291,7 @@ - In order to communicate with the MySQL database server the - mysql extension, mysqli and + In order to communicate with the MySQL database server, mysqli and the PDO MYSQL driver each use a low-level library that implements the required protocol. In the past, the only available library was the MySQL Client Library, otherwise known as @@ -348,14 +302,13 @@ However, the interface presented by libmysqlclient was not optimized for communication with PHP applications, as libmysqlclient was originally designed with C - applications in mind. For this reason the MySQL Native Driver, + applications in mind. For this reason, the MySQL Native Driver, mysqlnd, was developed as an alternative to libmysqlclient for PHP applications. - The mysql extension, the - mysqli extension and the PDO MySQL driver can + Both, the mysqli extension and the PDO MySQL driver can each be individually configured to use either libmysqlclient or mysqlnd. As mysqlnd is designed specifically to be utilised @@ -364,13 +317,6 @@ advantage of these improvements. - - - The MySQL Native Driver can only be used with MySQL server - versions 4.1.3 and later. - - - The MySQL Native Driver is implemented using the PHP extension framework. The source code is located in @@ -390,23 +336,21 @@ - The following table compares the functionality of the three main + The following table compares the functionality of the main methods of connecting to MySQL from PHP: Comparison of MySQL API options for PHP - - - - - + + + + PHP's mysqli Extension PDO (Using PDO MySQL Driver and MySQL Native Driver) - PHP's MySQL Extension @@ -414,61 +358,41 @@ PHP version introduced5.05.0 - Prior to 3.0 - - - Included with PHP 5.x - yes - yes - Yes MySQL development status Active development - Active development as of PHP 5.3 - Maintenance only - - - Recommended by MySQL for new projects - Yes - preferred option - Yes - No + Active development API supports Charsets Yes Yes - No API supports server-side Prepared Statements Yes Yes - No API supports client-side Prepared Statements No Yes - No API supports Stored Procedures Yes Yes - No API supports Multiple Statements Yes Most - No Supports all MySQL 4.1+ functionality Yes Most - No