From 3506814b9b11f835af565373aafcda03922aeac5 Mon Sep 17 00:00:00 2001 From: Philip Olson Date: Tue, 6 Mar 2012 02:07:32 +0000 Subject: [PATCH] Slight rewording, and fixed a few typos git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@323933 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/mysqli/quickstart.xml | 135 ++++++++++++++++---------------- 1 file changed, 68 insertions(+), 67 deletions(-) diff --git a/reference/mysqli/quickstart.xml b/reference/mysqli/quickstart.xml index 5a74a3943e..190ce34b14 100644 --- a/reference/mysqli/quickstart.xml +++ b/reference/mysqli/quickstart.xml @@ -209,8 +209,8 @@ Localhost via UNIX socket Depending on the connection function used, assorted parameters - can be omitted. If a parameter is not given the extension attempts to - use defaults values set in the PHP configuration file. + can be omitted. If a parameter is not provided, then the extension attempts to + use the default values that are set in the PHP configuration file. @@ -228,29 +228,29 @@ mysqli.default_socket=/tmp/mysql.sock The resulting parameter values are then passed to the client library - used by the extension. If the client library detects empty or unset - parameters, it may default to library built-in values. + that is used by the extension. If the client library detects empty or unset + parameters, then it may default to the library built-in values. Built-in connection library defaults - If the host value is unset or empty, the client library will - default to a Unix socket connection on localhost. - If socket is unset or empty and a Unix socket connection is requested, - a connection to the default socket on /tmp/mysql.sock + If the host value is unset or empty, then the client library will + default to a Unix socket connection on localhost. + If socket is unset or empty, and a Unix socket connection is requested, + then a connection to the default socket on /tmp/mysql.sock is attempted. - On Windows systems the host name . is interpreted + On Windows systems, the host name . is interpreted by the client library as an attempt to open a Windows named pipe based - connection. In this case the socket parameter is interpreted as the pipes - name. If not given or empty, the socket (here: pipe name) defaults to + connection. In this case the socket parameter is interpreted as the pipe + name. If not given or empty, then the socket (pipe name) defaults to \\.\pipe\MySQL. If neither a Unix domain socket based not a Windows named pipe based connection - is to be bestablished and the port parameter value is unset, the library + is to be be established and the port parameter value is unset, the library will default to port 3306. @@ -261,16 +261,16 @@ mysqli.default_socket=/tmp/mysql.sock Connection options - Various connection options are available, for example, to set - init commands which are executed upon connect or, for requesting use of + Connection options are available to, for example, set + init commands which are executed upon connect, or for requesting use of a certain charset. Connection options must be set before a network connection is established. - For setting a connection option the connect operation has to be + For setting a connection option, the connect operation has to be performed in three steps: creating a connection handle with mysqli_init, setting the requested options using - mysqli_options and establishing the network + mysqli_options, and establishing the network connection with mysqli_real_connect. @@ -278,7 +278,7 @@ mysqli.default_socket=/tmp/mysql.sock The mysqli extension supports persistent database connections, which - are a special kind of pooled connections. By default every database + are a special kind of pooled connections. By default, every database connection opened by a script is either explicitly closed by the user during runtime or released automatically at the end of the script. A persistent connection is not. Instead it is put into a pool for later reuse, if @@ -287,7 +287,7 @@ mysqli.default_socket=/tmp/mysql.sock Every PHP process is using its own mysqli connection pool. - Depending on the web server deployment model a PHP process may serve + Depending on the web server deployment model, a PHP process may serve one or multiple requests. Therefore, a pooled connection may be used by one or more scripts subsequently. @@ -295,9 +295,9 @@ mysqli.default_socket=/tmp/mysql.sock Persistent connection - If no unused persistent connection for a given combination of host, username, - password, socket, port and default database can be found in the connection pool, - mysqli opens a new connection. The use of persistent connections can be + If a unused persistent connection for a given combination of host, username, + password, socket, port and default database can not be found in the connection pool, + then mysqli opens a new connection. The use of persistent connections can be enabled and disabled using the PHP directive mysqli.allow_persistent. The total number of connections opened by a script can be limited with mysqli.max_links. The maximum number of persistent connections @@ -306,7 +306,7 @@ mysqli.default_socket=/tmp/mysql.sock A common complain about persistent connections is that their state is - not reset before reuse. For example, open, unfinished transactions are not + not reset before reuse. For example, open and unfinished transactions are not automatically rolled back. But also, authorization changes which happened in the time between putting the connection into the pool and reusing it are not reflected. This may be seen as an unwanted side-effect. On the contrary, @@ -315,11 +315,11 @@ mysqli.default_socket=/tmp/mysql.sock The mysqli extension supports both interpretations of a persistent connection: - state persisted and state reset before reuse. The default is reset. + state persisted, and state reset before reuse. The default is reset. Before a persistent connection is reused, the mysqli extension implicitly calls mysqli_change_user to reset the state. The persistent connection appears to the user as if it was just opened. No - artefacts from previous usages are visible. + artifacts from previous usages are visible. The mysqli_change_user function is an expensive operation. @@ -327,10 +327,9 @@ mysqli.default_socket=/tmp/mysql.sock compile flag MYSQLI_NO_CHANGE_USER_ON_PCONNECT being set. - It is left to the user to choose between safe behaviour and best performance. - Both are valid optimization goals. For ease of use, the safe behaviour has - been made the default at the expense of maximum performance. Please, run your - own benchmarks to measure the performance impact for your work load. + It is left to the user to choose between safe behavior and best performance. + Both are valid optimization goals. For ease of use, the safe behavior has + been made the default at the expense of maximum performance. See also @@ -351,11 +350,11 @@ mysqli.default_socket=/tmp/mysql.sock
Executing statements - Statements can be executed by help of the + Statements can be executed with the mysqli_query, mysqli_real_query - and mysqli_multi_query function. + and mysqli_multi_query functions. The mysqli_query function is the most - commonly used one. It combines executing statement and doing a + common, and combines the executing statement with a buffered fetch of its result set, if any, in one call. Calling mysqli_query is identical to calling mysqli_real_query @@ -363,7 +362,7 @@ mysqli.default_socket=/tmp/mysql.sock The mysqli_multi_query function is used - with Multiple Statements and is described elsewhere. + with multiple statements. @@ -400,7 +399,7 @@ if (!$mysqli->query("DROP TABLE IF EXISTS test") || PHP applications can navigate freely through buffered results. - Nagivation is fast because the result sets is hold in client memory. + Navigation is fast because the result sets are held in client memory. Please, keep in mind that it is often easier to scale by client than it is to scale the server. @@ -486,7 +485,7 @@ while ($row = $res->fetch_assoc()) { The mysqli_query, mysqli_real_query and mysqli_multi_query functions are used to execute - non-prepared statements. At the level of the MySQL Client Server Protocol + non-prepared statements. At the level of the MySQL Client Server Protocol, the command COM_QUERY and the text protocol are used for statement execution. With the text protocol, the MySQL server converts all data of a result sets into strings before sending. This conversion is done @@ -532,7 +531,7 @@ label = a (string) It is possible to convert integer and float columns back to PHP numbers by setting the MYSQLI_OPT_INT_AND_FLOAT_NATIVE connection option, - if using the mysqlnd libary. If set, the mysqlnd library will + if using the mysqlnd library. If set, the mysqlnd library will check the result set meta data column types and convert numeric SQL columns to PHP numbers, if the PHP data type value range allows for it. This way, for example, SQL INT columns are returned as integers. @@ -762,7 +761,7 @@ array(4) { Also, consider the use of the MySQL multi-INSERT SQL syntax for INSERTs. - For the example, belows multi-INSERT requires less round-trips between + For the example, multi-INSERT requires less round-trips between the server and client than the prepared statement shown above. @@ -790,7 +789,7 @@ if (!$mysqli->query("INSERT INTO test(id) VALUES (1), (2), (3), (4)")) { strings before sending. The client libraries do not receive strings only. Instead, they will receive binary data and try to convert the values into appropriate PHP data types. For example, results from an SQL - INT column will be provided as PHP integer variables. + INT column will be provided as PHP integer variables. @@ -829,7 +828,7 @@ label = a (string) - This behaviour differes from non-prepared statements. By default, + This behavior differs from non-prepared statements. By default, non-prepared statements return all results as strings. This default can be changed using a connection option. If the connection option is used, there are no differences. @@ -839,7 +838,7 @@ label = a (string) Results from prepared statements can either be retrieved by - binding output variables or by requesting a mysqli_result object. + binding output variables, or by requesting a mysqli_result object. Output variables must be bound after statement execution. @@ -961,7 +960,7 @@ array(1) { - Using the mysqli_result interface this has the additional benefit of + Using the mysqli_result interface offers the additional benefit of flexible client-side result set navigation. @@ -1032,13 +1031,13 @@ array(2) { Bound variables will be escaped automatically by the server. The server inserts their escaped values at the appropriate places into the statement - template before execution. Users must hint the server about the type of the - bound variable for appropriate conversion, - see mysqli_stmt_bind_param. + template before execution. A hint must be provided to the server for the type of + bound variable, to create an appropriate conversion. + See the mysqli_stmt_bind_param function for more information. The automatic escaping of values within the server is sometimes considered - as a security feature to prevent SQL injection. The same degree of security + a security feature to prevent SQL injection. The same degree of security can be achieved with non-prepared statements, if input values are escaped correctly. @@ -1046,13 +1045,13 @@ array(2) { Client-side prepared statement emulation - The API does not include a client-side prepared statement emulation. + The API does not include emulation for client-side prepared statement emulation. Quick prepared - non-prepared statement comparison - The below table gives a quick comparison on server-side prepared and non-prepared statements. + The table below compares server-side prepared and non-prepared statements. @@ -1086,49 +1085,49 @@ array(2) { Input parameter binding API - yes, automatic input escaping - no, manual input escaping + Yes, automatic input escaping + No, manual input escaping Output variable binding API - yes - no + Yes + No Supports use of mysqli_result API - yes, use mysqli_stmt_get_result - yes + Yes, use mysqli_stmt_get_result + Yes Buffered result sets - yes, use mysqli_stmt_get_result() or + Yes, use mysqli_stmt_get_result() or binding with mysqli_stmt_store_result - yes, default of mysqli_query + Yes, default of mysqli_query Unbuffered result sets - yes, use output binding API + Yes, use output binding API - yes, use mysqli_real_query with + Yes, use mysqli_real_query with mysqli_use_result MySQL Client Server protocol data transfer flavour - binary protocol - text protocol + Binary protocol + Text protocol Result set values SQL data types - preserved when fetching - converted to string or preserved when fetching + Preserved when fetching + Converted to string or preserved when fetching Supports all SQL statements Recent MySQL versions support most but not all - yes + Yes @@ -1479,7 +1478,7 @@ do { Multiple statements or multi queries must be executed with mysqli_multi_query. The individual statements - of the statement string are seperated by semicolon. + of the statement string are separated by semicolon. Then, all result sets returned by the executed statements must be fetched. @@ -1555,7 +1554,7 @@ array(1) { - SQL ijnection + SQL Injection @@ -1597,13 +1598,13 @@ Error executing query: (1064) You have an error in your SQL syntax; check the ma API support for transactions The MySQL server supports transactions depending on the storage engine used. - Since MySQL [TODO]x.y[TODO] the default storage engine is InnoDB. + Since MySQL 5.5, the default storage engine is InnoDB. InnoDB has full ACID transaction support. Transactions can either be controlled using SQL or API calls. It is recommended to use API calls for enabling and disabling the - auto commit mode and for comitting and rolling back transactions. + auto commit mode and for committing and rolling back transactions. @@ -1675,7 +1676,7 @@ $mysqli->commit(); A MySQL result set contains metadata. The metadata describes the columns found in the result set. All metadata send by MySQL is accessible through the mysqli interface. - The extension performs no or negliable changes to the + The extension performs no or negligible changes to the information it receives. Differences between MySQL server versions are not aligned.