Changeset 52423
- Timestamp:
- 12/29/2021 11:12:28 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/wp-db.php
r52422 r52423 138 138 139 139 /** 140 * MySQLquery result.140 * Database query result. 141 141 * 142 142 * Possible values: 143 143 * 144 * - For successful SELECT, SHOW, DESCRIBE, or EXPLAIN queries: 145 * - `mysqli_result` instance when the `mysqli` driver is in use 146 * - `resource` when the older `mysql` driver is in use 147 * - `true` for other query types that were successful 144 148 * - `null` if a query is yet to be made or if the result has since been flushed 145 * - `mysqli_result` instance when the MySQLi driver is in use, or `resource` when the older146 * MySQL driver is in use, for successful SELECT, SHOW, DESCRIBE, or EXPLAIN queries147 * - `true` for other query types that were successful148 149 * - `false` if the query returned an error 149 150 * … … 164 165 165 166 /** 166 * Calculated character sets on tables.167 * Calculated character sets keyed by table name. 167 168 * 168 169 * @since 4.2.0 169 170 * 170 * @var array171 * @var string[] 171 172 */ 172 173 protected $table_charset = array(); 173 174 174 175 /** 175 * Whether text fields in the current query need to be sanity checked. Default false.176 * Whether text fields in the current query need to be sanity checked. 176 177 * 177 178 * @since 4.2.0 … … 209 210 * 210 211 * @var array[] { 211 * Array of queries that were executed.212 * Array of arrays containing information about queries that were executed. 212 213 * 213 214 * @type array ...$0 { … … 235 236 236 237 /** 237 * WordPress table prefix 238 * WordPress table prefix. 238 239 * 239 240 * You can set this to have multiple WordPress installations in a single database. … … 283 284 284 285 /** 285 * List of WordPress per- blogtables.286 * List of WordPress per-site tables. 286 287 * 287 288 * @since 2.5.0 … … 594 595 * Possible values: 595 596 * 597 * - `mysqli` instance when the `mysqli` driver is in use 598 * - `resource` when the older `mysql` driver is in use 596 599 * - `null` if the connection is yet to be made or has been closed 597 * - `mysqli` instance when the MySQLi driver is in use598 * - `resource` when the older MySQL driver is in use599 600 * - `false` if the connection has failed 600 601 * … … 685 686 * Connects to the database server and selects a database. 686 687 * 687 * PHP5 style constructor for compatibility with PHP5.Does the actual setting up688 * Does the actual setting up 688 689 * of the class properties and connection to the database. 689 690 * … … 692 693 * @link https://core.trac.wordpress.org/ticket/3354 693 694 * 694 * @param string $dbuser MySQL database user.695 * @param string $dbpassword MySQL database password.696 * @param string $dbname MySQL database name.697 * @param string $dbhost MySQL database host.695 * @param string $dbuser Database user. 696 * @param string $dbpassword Database password. 697 * @param string $dbname Database name. 698 * @param string $dbhost Database host. 698 699 */ 699 700 public function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) { … … 702 703 } 703 704 704 // Use ext/mysqli if it exists unless WP_USE_EXT_MYSQLis defined as true.705 // Use the `mysqli` extension if it exists unless `WP_USE_EXT_MYSQL` is defined as true. 705 706 if ( function_exists( 'mysqli_connect' ) ) { 706 707 $this->use_mysqli = true; … … 1075 1076 * Returns an array of WordPress tables. 1076 1077 * 1077 * Also allows for the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLEto override the WordPress users1078 * Also allows for the `CUSTOM_USER_TABLE` and `CUSTOM_USER_META_TABLE` to override the WordPress users 1078 1079 * and usermeta tables that would otherwise be determined by the prefix. 1079 1080 * 1080 * The $scopeargument can take one of the following:1081 * 1082 * 'all' - returns 'all' and 'global' tables. No old tables are returned.1083 * 'blog' - returns the blog-level tables for the queried blog.1084 * 'global' - returns the global tables for the installation, returning multisite tables only on multisite.1085 * 'ms_global' - returns the multisite global tables, regardless if current installation is multisite.1086 * 'old' - returns tables which are deprecated.1081 * The `$scope` argument can take one of the following: 1082 * 1083 * - 'all' - returns 'all' and 'global' tables. No old tables are returned. 1084 * - 'blog' - returns the blog-level tables for the queried blog. 1085 * - 'global' - returns the global tables for the installation, returning multisite tables only on multisite. 1086 * - 'ms_global' - returns the multisite global tables, regardless if current installation is multisite. 1087 * - 'old' - returns tables which are deprecated. 1087 1088 * 1088 1089 * @since 3.0.0 … … 1098 1099 * then the custom users and usermeta tables will be mapped. Default true. 1099 1100 * @param int $blog_id Optional. The blog_id to prefix. Used only when prefix is requested. 1100 * Defaults to wpdb::$blogid.1101 * Defaults to `wpdb::$blogid`. 1101 1102 * @return string[] Table names. When a prefix is requested, the key is the unprefixed table name. 1102 1103 */ … … 1164 1165 * @since 0.71 1165 1166 * 1166 * @param string $db MySQL database name.1167 * @param string $db Database name. 1167 1168 * @param mysqli|resource $dbh Optional database connection. 1168 1169 */ … … 1351 1352 * 1352 1353 * Uses sprintf()-like syntax. The following placeholders can be used in the query string: 1353 * %d (integer) 1354 * %f (float) 1355 * %s (string) 1354 * 1355 * - %d (integer) 1356 * - %f (float) 1357 * - %s (string) 1356 1358 * 1357 1359 * All placeholders MUST be left unquoted in the query string. A corresponding argument … … 1359 1361 * 1360 1362 * Note: There is one exception to the above: for compatibility with old behavior, 1361 * numbered or formatted string placeholders (eg, %1$s, %5s) will not have quotes1363 * numbered or formatted string placeholders (eg, `%1$s`, `%5s`) will not have quotes 1362 1364 * added by this function, so should be passed with appropriate quotes around them. 1363 1365 * 1364 * Literal percentage signs ( %) in the query string must be written as %%. Percentage wildcards1366 * Literal percentage signs (`%`) in the query string must be written as `%%`. Percentage wildcards 1365 1367 * (for example, to use in LIKE syntax) must be passed via a substitution argument containing 1366 1368 * the complete LIKE string, these cannot be inserted directly in the query string. … … 1371 1373 * 1372 1374 * Examples: 1375 * 1373 1376 * $wpdb->prepare( "SELECT * FROM `table` WHERE `column` = %s AND `field` = %d OR `other_field` LIKE %s", array( 'foo', 1337, '%bar' ) ); 1374 1377 * $wpdb->prepare( "SELECT DATE_FORMAT(`field`, '%%c') FROM `table` WHERE `column` = %s", 'foo' ); … … 1511 1514 1512 1515 /** 1513 * First half of escaping for LIKE special characters % and _ before preparing for MySQL.1516 * First half of escaping for `LIKE` special characters `%` and `_` before preparing for SQL. 1514 1517 * 1515 1518 * Use this only before wpdb::prepare() or esc_sql(). Reversing the order is very bad for security. … … 1700 1703 * Connects to and selects database. 1701 1704 * 1702 * If $allow_bailis false, the lack of database connection will need to be handled manually.1705 * If `$allow_bail` is false, the lack of database connection will need to be handled manually. 1703 1706 * 1704 1707 * @since 3.0.0 … … 1899 1902 * after the {@see 'template_redirect'} hook has been fired, return false instead. 1900 1903 * 1901 * If $allow_bailis false, the lack of database connection will need to be handled manually.1904 * If `$allow_bail` is false, the lack of database connection will need to be handled manually. 1902 1905 * 1903 1906 * @since 3.9.0 … … 1983 1986 1984 1987 /** 1985 * Performs a MySQLdatabase query, using current database connection.1988 * Performs a database query, using current database connection. 1986 1989 * 1987 1990 * More information can be found on the documentation page. … … 2048 2051 $this->_do_query( $query ); 2049 2052 2050 // MySQLserver has gone away, try to reconnect.2053 // Database server has gone away, try to reconnect. 2051 2054 $mysql_errno = 0; 2052 2055 if ( ! empty( $this->dbh ) ) { … … 2273 2276 * 2274 2277 * Examples: 2278 * 2275 2279 * wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 'bar' ) ) 2276 2280 * wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) ) … … 2302 2306 * 2303 2307 * Examples: 2308 * 2304 2309 * wpdb::replace( 'table', array( 'column' => 'foo', 'field' => 'bar' ) ) 2305 2310 * wpdb::replace( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) ) … … 2389 2394 * 2390 2395 * Examples: 2396 * 2391 2397 * wpdb::update( 'table', array( 'column' => 'foo', 'field' => 'bar' ), array( 'ID' => 1 ) ) 2392 2398 * wpdb::update( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( 'ID' => 1 ), array( '%s', '%d' ), array( '%d' ) ) … … 2468 2474 * 2469 2475 * Examples: 2476 * 2470 2477 * wpdb::delete( 'table', array( 'ID' => 1 ) ) 2471 2478 * wpdb::delete( 'table', array( 'ID' => 1 ), array( '%d' ) ) … … 2882 2889 * @since 4.2.0 2883 2890 * 2884 * @param string|null $charset The character set to use. Default null. 2885 * @param string $table The name of the table being checked. 2891 * @param string|WP_Error|null $charset The character set to use, WP_Error object 2892 * if it couldn't be found. Default null. 2893 * @param string $table The name of the table being checked. 2886 2894 */ 2887 2895 $charset = apply_filters( 'pre_get_table_charset', null, $table ); … … 3638 3646 } 3639 3647 3640 3641 3648 /** 3642 3649 * Closes the current database connection. … … 3784 3791 3785 3792 /** 3786 * Retrieves the MySQLserver version.3793 * Retrieves the database server version. 3787 3794 * 3788 3795 * @since 2.7.0 … … 3795 3802 3796 3803 /** 3797 * Retrieves full MySQLserver information.3804 * Retrieves full database server information. 3798 3805 * 3799 3806 * @since 5.5.0
Note: See TracChangeset
for help on using the changeset viewer.