<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[52423] trunk/src/wp-includes/wp-db.php: Docs: Further corrections and improvements to the inline documentation for `wpdb`.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/52423">52423</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/52423","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>johnbillion</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-12-29 23:12:28 +0000 (Wed, 29 Dec 2021)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Docs: Further corrections and improvements to the inline documentation for `wpdb`.
See <a href="https://core.trac.wordpress.org/ticket/53399">#53399</a>, <a href="https://core.trac.wordpress.org/ticket/54610">#54610</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludeswpdbphp">trunk/src/wp-includes/wp-db.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludeswpdbphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/wp-db.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/wp-db.php 2021-12-29 17:26:26 UTC (rev 52422)
+++ trunk/src/wp-includes/wp-db.php 2021-12-29 23:12:28 UTC (rev 52423)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -137,14 +137,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public $last_result;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * MySQL query result.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Database query result.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Possible values:
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * - For successful SELECT, SHOW, DESCRIBE, or EXPLAIN queries:
+ * - `mysqli_result` instance when the `mysqli` driver is in use
+ * - `resource` when the older `mysql` driver is in use
+ * - `true` for other query types that were successful
</ins><span class="cx" style="display: block; padding: 0 10px"> * - `null` if a query is yet to be made or if the result has since been flushed
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * - `mysqli_result` instance when the MySQLi driver is in use, or `resource` when the older
- * MySQL driver is in use, for successful SELECT, SHOW, DESCRIBE, or EXPLAIN queries
- * - `true` for other query types that were successful
</del><span class="cx" style="display: block; padding: 0 10px"> * - `false` if the query returned an error
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.71
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -163,16 +164,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected $col_meta = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Calculated character sets on tables.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Calculated character sets keyed by table name.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @var array
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @var string[]
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected $table_charset = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Whether text fields in the current query need to be sanity checked. Default false.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Whether text fields in the current query need to be sanity checked.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -208,7 +209,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.3.0 The fifth element in each query log was added to record custom data.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var array[] {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Array of queries that were executed.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Array of arrays containing information about queries that were executed.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @type array ...$0 {
</span><span class="cx" style="display: block; padding: 0 10px"> * Data for each query.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -234,7 +235,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected $reconnect_retries = 5;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * WordPress table prefix
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * WordPress table prefix.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * You can set this to have multiple WordPress installations in a single database.
</span><span class="cx" style="display: block; padding: 0 10px"> * The second reason is for possible security precautions.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -282,7 +283,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public $siteid = 0;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * List of WordPress per-blog tables.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * List of WordPress per-site tables.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -593,9 +594,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Possible values:
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * - `mysqli` instance when the `mysqli` driver is in use
+ * - `resource` when the older `mysql` driver is in use
</ins><span class="cx" style="display: block; padding: 0 10px"> * - `null` if the connection is yet to be made or has been closed
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * - `mysqli` instance when the MySQLi driver is in use
- * - `resource` when the older MySQL driver is in use
</del><span class="cx" style="display: block; padding: 0 10px"> * - `false` if the connection has failed
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.71
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -684,7 +685,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Connects to the database server and selects a database.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * PHP5 style constructor for compatibility with PHP5. Does the actual setting up
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Does the actual setting up
</ins><span class="cx" style="display: block; padding: 0 10px"> * of the class properties and connection to the database.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.0.8
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -691,10 +692,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @link https://core.trac.wordpress.org/ticket/3354
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $dbuser MySQL database user.
- * @param string $dbpassword MySQL database password.
- * @param string $dbname MySQL database name.
- * @param string $dbhost MySQL database host.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $dbuser Database user.
+ * @param string $dbpassword Database password.
+ * @param string $dbname Database name.
+ * @param string $dbhost Database host.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( WP_DEBUG && WP_DEBUG_DISPLAY ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -701,7 +702,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->show_errors();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Use ext/mysqli if it exists unless WP_USE_EXT_MYSQL is defined as true.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Use the `mysqli` extension if it exists unless `WP_USE_EXT_MYSQL` is defined as true.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( function_exists( 'mysqli_connect' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->use_mysqli = true;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1074,16 +1075,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Returns an array of WordPress tables.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Also allows for the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE to override the WordPress users
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Also allows for the `CUSTOM_USER_TABLE` and `CUSTOM_USER_META_TABLE` to override the WordPress users
</ins><span class="cx" style="display: block; padding: 0 10px"> * and usermeta tables that would otherwise be determined by the prefix.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * The $scope argument can take one of the following:
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * The `$scope` argument can take one of the following:
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * 'all' - returns 'all' and 'global' tables. No old tables are returned.
- * 'blog' - returns the blog-level tables for the queried blog.
- * 'global' - returns the global tables for the installation, returning multisite tables only on multisite.
- * 'ms_global' - returns the multisite global tables, regardless if current installation is multisite.
- * 'old' - returns tables which are deprecated.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * - 'all' - returns 'all' and 'global' tables. No old tables are returned.
+ * - 'blog' - returns the blog-level tables for the queried blog.
+ * - 'global' - returns the global tables for the installation, returning multisite tables only on multisite.
+ * - 'ms_global' - returns the multisite global tables, regardless if current installation is multisite.
+ * - 'old' - returns tables which are deprecated.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1097,7 +1098,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param bool $prefix Optional. Whether to include table prefixes. If blog prefix is requested,
</span><span class="cx" style="display: block; padding: 0 10px"> * then the custom users and usermeta tables will be mapped. Default true.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $blog_id Optional. The blog_id to prefix. Used only when prefix is requested.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Defaults to wpdb::$blogid.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Defaults to `wpdb::$blogid`.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string[] Table names. When a prefix is requested, the key is the unprefixed table name.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function tables( $scope = 'all', $prefix = true, $blog_id = 0 ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1163,7 +1164,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.71
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $db MySQL database name.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $db Database name.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param mysqli|resource $dbh Optional database connection.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function select( $db, $dbh = null ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1350,18 +1351,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Prepares a SQL query for safe execution.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Uses sprintf()-like syntax. The following placeholders can be used in the query string:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * %d (integer)
- * %f (float)
- * %s (string)
</del><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * - %d (integer)
+ * - %f (float)
+ * - %s (string)
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * All placeholders MUST be left unquoted in the query string. A corresponding argument
</span><span class="cx" style="display: block; padding: 0 10px"> * MUST be passed for each placeholder.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Note: There is one exception to the above: for compatibility with old behavior,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * numbered or formatted string placeholders (eg, %1$s, %5s) will not have quotes
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * numbered or formatted string placeholders (eg, `%1$s`, `%5s`) will not have quotes
</ins><span class="cx" style="display: block; padding: 0 10px"> * added by this function, so should be passed with appropriate quotes around them.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Literal percentage signs (%) in the query string must be written as %%. Percentage wildcards
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Literal percentage signs (`%`) in the query string must be written as `%%`. Percentage wildcards
</ins><span class="cx" style="display: block; padding: 0 10px"> * (for example, to use in LIKE syntax) must be passed via a substitution argument containing
</span><span class="cx" style="display: block; padding: 0 10px"> * the complete LIKE string, these cannot be inserted directly in the query string.
</span><span class="cx" style="display: block; padding: 0 10px"> * Also see wpdb::esc_like().
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1370,6 +1372,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * containing all arguments. A combination of the two is not supported.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Examples:
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * $wpdb->prepare( "SELECT * FROM `table` WHERE `column` = %s AND `field` = %d OR `other_field` LIKE %s", array( 'foo', 1337, '%bar' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> * $wpdb->prepare( "SELECT DATE_FORMAT(`field`, '%%c') FROM `table` WHERE `column` = %s", 'foo' );
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1510,7 +1513,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * First half of escaping for LIKE special characters % and _ before preparing for MySQL.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * First half of escaping for `LIKE` special characters `%` and `_` before preparing for SQL.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Use this only before wpdb::prepare() or esc_sql(). Reversing the order is very bad for security.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1699,7 +1702,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Connects to and selects database.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * If $allow_bail is false, the lack of database connection will need to be handled manually.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * If `$allow_bail` is false, the lack of database connection will need to be handled manually.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.9.0 $allow_bail parameter added.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1898,7 +1901,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * If this function is unable to reconnect, it will forcibly die, or if called
</span><span class="cx" style="display: block; padding: 0 10px"> * after the {@see 'template_redirect'} hook has been fired, return false instead.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * If $allow_bail is false, the lack of database connection will need to be handled manually.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * If `$allow_bail` is false, the lack of database connection will need to be handled manually.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1982,7 +1985,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Performs a MySQL database query, using current database connection.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Performs a database query, using current database connection.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * More information can be found on the documentation page.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2047,7 +2050,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->_do_query( $query );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // MySQL server has gone away, try to reconnect.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Database server has gone away, try to reconnect.
</ins><span class="cx" style="display: block; padding: 0 10px"> $mysql_errno = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $this->dbh ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $this->use_mysqli ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2272,6 +2275,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Inserts a row into the table.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Examples:
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 'bar' ) )
</span><span class="cx" style="display: block; padding: 0 10px"> * wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) )
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2301,6 +2305,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Replaces a row in the table.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Examples:
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * wpdb::replace( 'table', array( 'column' => 'foo', 'field' => 'bar' ) )
</span><span class="cx" style="display: block; padding: 0 10px"> * wpdb::replace( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) )
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2388,6 +2393,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Updates a row in the table.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Examples:
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * wpdb::update( 'table', array( 'column' => 'foo', 'field' => 'bar' ), array( 'ID' => 1 ) )
</span><span class="cx" style="display: block; padding: 0 10px"> * wpdb::update( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( 'ID' => 1 ), array( '%s', '%d' ), array( '%d' ) )
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2467,6 +2473,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Deletes a row in the table.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Examples:
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * wpdb::delete( 'table', array( 'ID' => 1 ) )
</span><span class="cx" style="display: block; padding: 0 10px"> * wpdb::delete( 'table', array( 'ID' => 1 ), array( '%d' ) )
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2881,8 +2888,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string|null $charset The character set to use. Default null.
- * @param string $table The name of the table being checked.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string|WP_Error|null $charset The character set to use, WP_Error object
+ * if it couldn't be found. Default null.
+ * @param string $table The name of the table being checked.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $charset = apply_filters( 'pre_get_table_charset', null, $table );
</span><span class="cx" style="display: block; padding: 0 10px"> if ( null !== $charset ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3637,7 +3645,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Closes the current database connection.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3783,7 +3790,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieves the MySQL server version.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves the database server version.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.7.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3794,7 +3801,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieves full MySQL server information.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves full database server information.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span></span></pre>
</div>
</div>
</body>
</html>