Changeset 32641
- Timestamp:
- 05/28/2015 08:09:54 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/wp-db.php
r32640 r32641 608 608 * @since 2.0.8 609 609 * 610 * @param string $dbuser MySQL database user 610 * @global string $wp_version 611 * 612 * @param string $dbuser MySQL database user 611 613 * @param string $dbpassword MySQL database password 612 * @param string $dbname MySQL database name613 * @param string $dbhost MySQL database host614 * @param string $dbname MySQL database name 615 * @param string $dbhost MySQL database host 614 616 */ 615 617 public function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) { … … 653 655 * @see wpdb::__construct() 654 656 * @since 2.0.8 655 * @return booltrue657 * @return true 656 658 */ 657 659 public function __destruct() { … … 860 862 * @since 2.5.0 861 863 * 862 * @param string $prefix Alphanumeric name for the new prefix.863 * @param bool $set_table_names Optional. Whether the table names, e.g. wpdb::$posts, should be updated or not.864 * @param string $prefix Alphanumeric name for the new prefix. 865 * @param bool $set_table_names Optional. Whether the table names, e.g. wpdb::$posts, should be updated or not. 864 866 * @return string|WP_Error Old prefix or WP_Error on error 865 867 */ … … 899 901 * @since 3.0.0 900 902 * @access public 903 * 901 904 * @param int $blog_id 902 905 * @param int $site_id Optional. … … 963 966 * @uses wpdb::$ms_global_tables 964 967 * 965 * @param string $scope Optional. Can be all, global, ms_global, blog, or old tables. Defaults to all.966 * @param bool $prefixOptional. Whether to include table prefixes. Default true. If blog967 * 968 * @param int $blog_id Optional. The blog_id to prefix. Defaults to wpdb::$blogid. Used only when prefix is requested.968 * @param string $scope Optional. Can be all, global, ms_global, blog, or old tables. Defaults to all. 969 * @param bool $prefix Optional. Whether to include table prefixes. Default true. If blog 970 * prefix is requested, then the custom users and usermeta tables will be mapped. 971 * @param int $blog_id Optional. The blog_id to prefix. Defaults to wpdb::$blogid. Used only when prefix is requested. 969 972 * @return array Table names. When a prefix is requested, the key is the unprefixed table name. 970 973 */ … … 1026 1029 * @since 0.71 1027 1030 * 1028 * @param string $db MySQL database name 1029 * @param resource $dbh Optional link identifier. 1030 * @return null Always null. 1031 * @param string $db MySQL database name 1032 * @param resource|null $dbh Optional link identifier. 1031 1033 */ 1032 1034 public function select( $db, $dbh = null ) { … … 1052 1054 <p>If you don\'t know how to set up a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href="https://wordpress.org/support/">WordPress Support Forums</a>.</p>' ), htmlspecialchars( $db, ENT_QUOTES ), htmlspecialchars( $this->dbuser, ENT_QUOTES ) ), 'db_select_fail' ); 1053 1055 } 1054 return;1055 1056 } 1056 1057 } … … 1164 1165 * 1165 1166 * @uses wpdb::_real_escape() 1167 * 1166 1168 * @since 2.3.0 1169 * 1167 1170 * @param string $string to escape 1168 * @return void1169 1171 */ 1170 1172 public function escape_by_ref( &$string ) { … … 1199 1201 * @since 2.3.0 1200 1202 * 1201 * @param string $query Query statement with sprintf()-like placeholders 1202 * @param array|mixed $args The array of variables to substitute into the query's placeholders if being called like 1203 * {@link http://php.net/vsprintf vsprintf()}, or the first variable to substitute into the query's placeholders if 1204 * being called like {@link http://php.net/sprintf sprintf()}. 1205 * @param mixed $args,... further variables to substitute into the query's placeholders if being called like 1206 * {@link http://php.net/sprintf sprintf()}. 1207 * @return null|false|string Sanitized query string, null if there is no query, false if there is an error and string 1208 * if there was something to prepare 1203 * @param string $query Query statement with sprintf()-like placeholders 1204 * @param array|mixed $args The array of variables to substitute into the query's placeholders if being called like 1205 * {@link http://php.net/vsprintf vsprintf()}, or the first variable to substitute into the query's placeholders if 1206 * being called like {@link http://php.net/sprintf sprintf()}. 1207 * @param mixed $args,... further variables to substitute into the query's placeholders if being called like 1208 * {@link http://php.net/sprintf sprintf()}. 1209 * @return string|void Sanitized query string, if there is a query to prepare. 1209 1210 */ 1210 1211 public function prepare( $query, $args ) { … … 1263 1264 * 1264 1265 * @param string $str The error to display 1265 * @return false| nullFalse if the showing of errors is disabled.1266 * @return false|void False if the showing of errors is disabled. 1266 1267 */ 1267 1268 public function print_error( $str = '' ) { … … 1368 1369 * 1369 1370 * @since 0.71 1370 * @return void1371 1371 */ 1372 1372 public function flush() { … … 1405 1405 * 1406 1406 * @param bool $allow_bail Optional. Allows the function to bail. Default true. 1407 * @return null|bool True with a successful connection, false on failure.1407 * @return bool True with a successful connection, false on failure. 1408 1408 */ 1409 1409 public function db_connect( $allow_bail = true ) { 1410 1411 1410 $this->is_mysql = true; 1412 1411 … … 1530 1529 * 1531 1530 * @param bool $allow_bail Optional. Allows the function to bail. Default true. 1532 * @return bool| nullTrue if the connection is up.1531 * @return bool|void True if the connection is up. 1533 1532 */ 1534 1533 public function check_connection( $allow_bail = true ) { … … 1760 1759 * @see wp_set_wpdb_vars() 1761 1760 * 1762 * @param string $table table name 1763 * @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped). 1764 * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. If string, that format will be used for all of the values in $data. 1765 * A format is one of '%d', '%f', '%s' (integer, float, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. 1761 * @param string $table Table name 1762 * @param array $data Data to insert (in column => value pairs). 1763 * Both $data columns and $data values should be "raw" (neither should be SQL escaped). 1764 * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. 1765 * If string, that format will be used for all of the values in $data. 1766 * A format is one of '%d', '%f', '%s' (integer, float, string). 1767 * If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. 1766 1768 * @return int|false The number of rows inserted, or false on error. 1767 1769 */ … … 1781 1783 * @see wp_set_wpdb_vars() 1782 1784 * 1783 * @param string $table table name 1784 * @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped). 1785 * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. If string, that format will be used for all of the values in $data. 1786 * A format is one of '%d', '%f', '%s' (integer, float, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. 1785 * @param string $table Table name 1786 * @param array $data Data to insert (in column => value pairs). 1787 * Both $data columns and $data values should be "raw" (neither should be SQL escaped). 1788 * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. 1789 * If string, that format will be used for all of the values in $data. 1790 * A format is one of '%d', '%f', '%s' (integer, float, string). 1791 * If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. 1787 1792 * @return int|false The number of rows affected, or false on error. 1788 1793 */ … … 1802 1807 * @see wp_set_wpdb_vars() 1803 1808 * 1804 * @param string $table table name 1805 * @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped). 1806 * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. If string, that format will be used for all of the values in $data. 1807 * A format is one of '%d', '%f', '%s' (integer, float, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. 1808 * @param string $type Optional. What type of operation is this? INSERT or REPLACE. Defaults to INSERT. 1809 * @param string $table Table name 1810 * @param array $data Data to insert (in column => value pairs). 1811 * Both $data columns and $data values should be "raw" (neither should be SQL escaped). 1812 * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. 1813 * If string, that format will be used for all of the values in $data. 1814 * A format is one of '%d', '%f', '%s' (integer, float, string). 1815 * If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. 1816 * @param string $type Optional. What type of operation is this? INSERT or REPLACE. Defaults to INSERT. 1809 1817 * @return int|false The number of rows affected, or false on error. 1810 1818 */ … … 1847 1855 * @see wp_set_wpdb_vars() 1848 1856 * 1849 * @param string $table table name 1850 * @param array $data Data to update (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped). 1851 * @param array $where A named array of WHERE clauses (in column => value pairs). Multiple clauses will be joined with ANDs. Both $where columns and $where values should be "raw". 1852 * @param array|string $format Optional. An array of formats to be mapped to each of the values in $data. If string, that format will be used for all of the values in $data. 1853 * A format is one of '%d', '%f', '%s' (integer, float, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. 1854 * @param array|string $where_format Optional. An array of formats to be mapped to each of the values in $where. If string, that format will be used for all of the items in $where. A format is one of '%d', '%f', '%s' (integer, float, string). If omitted, all values in $where will be treated as strings. 1857 * @param string $table Table name 1858 * @param array $data Data to update (in column => value pairs). 1859 * Both $data columns and $data values should be "raw" (neither should be SQL escaped). 1860 * @param array $where A named array of WHERE clauses (in column => value pairs). 1861 * Multiple clauses will be joined with ANDs. 1862 * Both $where columns and $where values should be "raw". 1863 * @param array|string $format Optional. An array of formats to be mapped to each of the values in $data. 1864 * If string, that format will be used for all of the values in $data. 1865 * A format is one of '%d', '%f', '%s' (integer, float, string). 1866 * If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. 1867 * @param array|string $where_format Optional. An array of formats to be mapped to each of the values in $where. 1868 * If string, that format will be used for all of the items in $where. 1869 * A format is one of '%d', '%f', '%s' (integer, float, string). 1870 * If omitted, all values in $where will be treated as strings. 1855 1871 * @return int|false The number of rows updated, or false on error. 1856 1872 */ … … 1899 1915 * @see wp_set_wpdb_vars() 1900 1916 * 1901 * @param string $table table name 1902 * @param array $where A named array of WHERE clauses (in column => value pairs). Multiple clauses will be joined with ANDs. Both $where columns and $where values should be "raw". 1903 * @param array|string $where_format Optional. An array of formats to be mapped to each of the values in $where. If string, that format will be used for all of the items in $where. A format is one of '%d', '%f', '%s' (integer, float, string). If omitted, all values in $where will be treated as strings unless otherwise specified in wpdb::$field_types. 1917 * @param string $table Table name 1918 * @param array $where A named array of WHERE clauses (in column => value pairs). 1919 * Multiple clauses will be joined with ANDs. 1920 * Both $where columns and $where values should be "raw". 1921 * @param array|string $where_format Optional. An array of formats to be mapped to each of the values in $where. 1922 * If string, that format will be used for all of the items in $where. 1923 * A format is one of '%d', '%f', '%s' (integer, float, string). 1924 * If omitted, all values in $where will be treated as strings unless otherwise specified in wpdb::$field_types. 1904 1925 * @return int|false The number of rows updated, or false on error. 1905 1926 */ … … 1943 1964 * @param array $data Field/value pair. 1944 1965 * @param mixed $format Format for each field. 1945 * @return array| boolReturns an array of fields that contain paired values1966 * @return array|false Returns an array of fields that contain paired values 1946 1967 * and formats. Returns false for invalid values. 1947 1968 */ … … 2015 2036 * @param array $data As it comes from the wpdb::process_field_formats() method. 2016 2037 * @param string $table Table name. 2017 * @return The same array as $data with additional 'charset' keys.2038 * @return array|false The same array as $data with additional 'charset' keys. 2018 2039 */ 2019 2040 protected function process_field_charsets( $data, $table ) { … … 2044 2065 * @param array $data As it comes from the wpdb::process_field_charsets() method. 2045 2066 * @param string $table Table name. 2046 * @return array| False The same array as $data with additional 'length' keys, or false if2067 * @return array|false The same array as $data with additional 'length' keys, or false if 2047 2068 * any of the values were too long for their corresponding field. 2048 2069 */ … … 2076 2097 * 2077 2098 * @param string|null $query Optional. SQL query. Defaults to null, use the result from the previous query. 2078 * @param int $xOptional. Column of value to return. Indexed from 0.2079 * @param int $yOptional. Row of value to return. Indexed from 0.2099 * @param int $x Optional. Column of value to return. Indexed from 0. 2100 * @param int $y Optional. Row of value to return. Indexed from 0. 2080 2101 * @return string|null Database query result (as string), or null on failure 2081 2102 */ … … 2107 2128 * @since 0.71 2108 2129 * 2109 * @param string|null $query SQL query. 2110 * @param string $output Optional. one of ARRAY_A | ARRAY_N | OBJECT constants. Return an associative array (column => value, ...), 2111 * a numerically indexed array (0 => value, ...) or an object ( ->column = value ), respectively. 2112 * @param int $y Optional. Row to return. Indexed from 0. 2113 * @return mixed Database query result in format specified by $output or null on failure 2130 * @param string|null $query SQL query. 2131 * @param string $output Optional. one of ARRAY_A | ARRAY_N | OBJECT constants. 2132 * Return an associative array (column => value, ...), 2133 * a numerically indexed array (0 => value, ...) or 2134 * an object ( ->column = value ), respectively. 2135 * @param int $y Optional. Row to return. Indexed from 0. 2136 * @return array|object|null|void Database query result in format specified by $output or null on failure 2114 2137 */ 2115 2138 public function get_row( $query = null, $output = OBJECT, $y = 0 ) { … … 2153 2176 * 2154 2177 * @param string|null $query Optional. SQL query. Defaults to previous query. 2155 * @param int $xOptional. Column to return. Indexed from 0.2178 * @param int $x Optional. Column to return. Indexed from 0. 2156 2179 * @return array Database query result. Array indexed from 0 by SQL result row number. 2157 2180 */ … … 2180 2203 * @since 0.71 2181 2204 * 2182 * @param string $query SQL query. 2183 * @param string $output Optional. Any of ARRAY_A | ARRAY_N | OBJECT | OBJECT_K constants. With one of the first three, return an array of rows indexed from 0 by SQL result row number. 2184 * Each row is an associative array (column => value, ...), a numerically indexed array (0 => value, ...), or an object. ( ->column = value ), respectively. 2185 * With OBJECT_K, return an associative array of row objects keyed by the value of each row's first column's value. Duplicate keys are discarded. 2186 * @return mixed Database query results 2205 * @param string $query SQL query. 2206 * @param string $output Optional. Any of ARRAY_A | ARRAY_N | OBJECT | OBJECT_K constants. 2207 * With one of the first three, return an array of rows indexed from 0 by SQL result row number. 2208 * Each row is an associative array (column => value, ...), a numerically indexed array (0 => value, ...), or an object. ( ->column = value ), respectively. 2209 * With OBJECT_K, return an associative array of row objects keyed by the value of each row's first column's value. 2210 * Duplicate keys are discarded. 2211 * @return array|object|null Database query results 2187 2212 */ 2188 2213 public function get_results( $query = null, $output = OBJECT ) { … … 2343 2368 * @param string $table Table name. 2344 2369 * @param string $column Column name. 2345 * @return mixedColumn character set as a string. False if the column has no2346 * character set. WP_Error object if there was an error.2370 * @return string|false|WP_Error Column character set as a string. False if the column has no 2371 * character set. WP_Error object if there was an error. 2347 2372 */ 2348 2373 public function get_col_charset( $table, $column ) { … … 2408 2433 * @param string $table Table name. 2409 2434 * @param string $column Column name. 2410 * @return mixedarray( 'length' => (int), 'type' => 'byte' | 'char' )2411 * false if the column has no length (for example, numeric column)2412 * WP_Error object if there was an error.2435 * @return array|false|WP_Error array( 'length' => (int), 'type' => 'byte' | 'char' ) 2436 * false if the column has no length (for example, numeric column) 2437 * WP_Error object if there was an error. 2413 2438 */ 2414 2439 public function get_col_length( $table, $column ) { … … 2911 2936 * @since 0.71 2912 2937 * 2913 * @param string $info_type Optional. Type one of name, table, def, max_length, not_null, primary_key, multiple_key, unique_key, numeric, blob, type, unsigned, zerofill2914 * @param int $col_offset Optional. 0: col name. 1: which table the col's in. 2: col's max length. 3: if the col is numeric. 4: col's type2938 * @param string $info_type Optional. Type one of name, table, def, max_length, not_null, primary_key, multiple_key, unique_key, numeric, blob, type, unsigned, zerofill 2939 * @param int $col_offset Optional. 0: col name. 1: which table the col's in. 2: col's max length. 3: if the col is numeric. 4: col's type 2915 2940 * @return mixed Column Results 2916 2941 */ … … 2938 2963 * @since 1.5.0 2939 2964 * 2940 * @return bool2965 * @return true 2941 2966 */ 2942 2967 public function timer_start() { … … 2963 2988 * @since 1.5.0 2964 2989 * 2965 * @param string $message The Error message2990 * @param string $message The Error message 2966 2991 * @param string $error_code Optional. A Computer readable string to identify the error. 2967 2992 * @return false|void … … 2982 3007 * 2983 3008 * @since 2.5.0 2984 * @uses $wp_version 2985 * @uses $required_mysql_version 2986 * 2987 * @return WP_Error 3009 * 3010 * @global string $wp_version 3011 * @global string $required_mysql_version 3012 * 3013 * @return WP_Error|void 2988 3014 */ 2989 3015 public function check_database_version() { … … 3039 3065 * 'group_concat', 'subqueries', 'set_charset', 3040 3066 * or 'utf8mb4'. 3041 * @return boolWhether the database feature is supported, false otherwise.3067 * @return int|false Whether the database feature is supported, false otherwise. 3042 3068 */ 3043 3069 public function has_cap( $db_cap ) { … … 3084 3110 * @since 2.5.0 3085 3111 * 3086 * @return string The name of the calling function3112 * @return string|array The name of the calling function 3087 3113 */ 3088 3114 public function get_caller() {
Note: See TracChangeset
for help on using the changeset viewer.