Make WordPress Core

Changeset 32641


Ignore:
Timestamp:
05/28/2015 08:09:54 PM (10 years ago)
Author:
wonderboymusic
Message:

Add missing/alter existing doc blocks for wp-db.php.

See #32444.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/wp-db.php

    r32640 r32641  
    608608     * @since 2.0.8
    609609     *
    610      * @param string $dbuser MySQL database user
     610     * @global string $wp_version
     611     *
     612     * @param string $dbuser     MySQL database user
    611613     * @param string $dbpassword MySQL database password
    612      * @param string $dbname MySQL database name
    613      * @param string $dbhost MySQL database host
     614     * @param string $dbname     MySQL database name
     615     * @param string $dbhost     MySQL database host
    614616     */
    615617    public function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
     
    653655     * @see wpdb::__construct()
    654656     * @since 2.0.8
    655      * @return bool true
     657     * @return true
    656658     */
    657659    public function __destruct() {
     
    860862     * @since 2.5.0
    861863     *
    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.
    864866     * @return string|WP_Error Old prefix or WP_Error on error
    865867     */
     
    899901     * @since 3.0.0
    900902     * @access public
     903     *
    901904     * @param int $blog_id
    902905     * @param int $site_id Optional.
     
    963966     * @uses wpdb::$ms_global_tables
    964967     *
    965      * @param string $scope Optional. Can be all, global, ms_global, blog, or old tables. Defaults to all.
    966      * @param bool $prefix Optional. Whether to include table prefixes. Default true. If blog
    967      *  prefix is requested, then the custom users and usermeta tables will be mapped.
    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.
    969972     * @return array Table names. When a prefix is requested, the key is the unprefixed table name.
    970973     */
     
    10261029     * @since 0.71
    10271030     *
    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.
    10311033     */
    10321034    public function select( $db, $dbh = null ) {
     
    10521054<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' );
    10531055            }
    1054             return;
    10551056        }
    10561057    }
     
    11641165     *
    11651166     * @uses wpdb::_real_escape()
     1167     *
    11661168     * @since 2.3.0
     1169     *
    11671170     * @param string $string to escape
    1168      * @return void
    11691171     */
    11701172    public function escape_by_ref( &$string ) {
     
    11991201     * @since 2.3.0
    12001202     *
    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.
    12091210     */
    12101211    public function prepare( $query, $args ) {
     
    12631264     *
    12641265     * @param string $str The error to display
    1265      * @return false|null False if the showing of errors is disabled.
     1266     * @return false|void False if the showing of errors is disabled.
    12661267     */
    12671268    public function print_error( $str = '' ) {
     
    13681369     *
    13691370     * @since 0.71
    1370      * @return void
    13711371     */
    13721372    public function flush() {
     
    14051405     *
    14061406     * @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.
    14081408     */
    14091409    public function db_connect( $allow_bail = true ) {
    1410 
    14111410        $this->is_mysql = true;
    14121411
     
    15301529     *
    15311530     * @param bool $allow_bail Optional. Allows the function to bail. Default true.
    1532      * @return bool|null True if the connection is up.
     1531     * @return bool|void True if the connection is up.
    15331532     */
    15341533    public function check_connection( $allow_bail = true ) {
     
    17601759     * @see wp_set_wpdb_vars()
    17611760     *
    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.
    17661768     * @return int|false The number of rows inserted, or false on error.
    17671769     */
     
    17811783     * @see wp_set_wpdb_vars()
    17821784     *
    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.
    17871792     * @return int|false The number of rows affected, or false on error.
    17881793     */
     
    18021807     * @see wp_set_wpdb_vars()
    18031808     *
    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.
    18091817     * @return int|false The number of rows affected, or false on error.
    18101818     */
     
    18471855     * @see wp_set_wpdb_vars()
    18481856     *
    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.
    18551871     * @return int|false The number of rows updated, or false on error.
    18561872     */
     
    18991915     * @see wp_set_wpdb_vars()
    19001916     *
    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.
    19041925     * @return int|false The number of rows updated, or false on error.
    19051926     */
     
    19431964     * @param array  $data   Field/value pair.
    19441965     * @param mixed  $format Format for each field.
    1945      * @return array|bool Returns an array of fields that contain paired values
     1966     * @return array|false Returns an array of fields that contain paired values
    19461967     *                    and formats. Returns false for invalid values.
    19471968     */
     
    20152036     * @param array  $data  As it comes from the wpdb::process_field_formats() method.
    20162037     * @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.
    20182039     */
    20192040    protected function process_field_charsets( $data, $table ) {
     
    20442065     * @param array  $data  As it comes from the wpdb::process_field_charsets() method.
    20452066     * @param string $table Table name.
    2046      * @return array|False The same array as $data with additional 'length' keys, or false if
     2067     * @return array|false The same array as $data with additional 'length' keys, or false if
    20472068     *                     any of the values were too long for their corresponding field.
    20482069     */
     
    20762097     *
    20772098     * @param string|null $query Optional. SQL query. Defaults to null, use the result from the previous query.
    2078      * @param int $x Optional. Column of value to return. Indexed from 0.
    2079      * @param int $y Optional. 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.
    20802101     * @return string|null Database query result (as string), or null on failure
    20812102     */
     
    21072128     * @since 0.71
    21082129     *
    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
    21142137     */
    21152138    public function get_row( $query = null, $output = OBJECT, $y = 0 ) {
     
    21532176     *
    21542177     * @param string|null $query Optional. SQL query. Defaults to previous query.
    2155      * @param int $x Optional. Column to return. Indexed from 0.
     2178     * @param int         $x    Optional. Column to return. Indexed from 0.
    21562179     * @return array Database query result. Array indexed from 0 by SQL result row number.
    21572180     */
     
    21802203     * @since 0.71
    21812204     *
    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
    21872212     */
    21882213    public function get_results( $query = null, $output = OBJECT ) {
     
    23432368     * @param string $table  Table name.
    23442369     * @param string $column Column name.
    2345      * @return mixed Column character set as a string. False if the column has no
    2346      *               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.
    23472372     */
    23482373    public function get_col_charset( $table, $column ) {
     
    24082433     * @param string $table  Table name.
    24092434     * @param string $column Column name.
    2410      * @return mixed array( '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.
    24132438     */
    24142439    public function get_col_length( $table, $column ) {
     
    29112936     * @since 0.71
    29122937     *
    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, zerofill
    2914      * @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
     2938     * @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
    29152940     * @return mixed Column Results
    29162941     */
     
    29382963     * @since 1.5.0
    29392964     *
    2940      * @return bool
     2965     * @return true
    29412966     */
    29422967    public function timer_start() {
     
    29632988     * @since 1.5.0
    29642989     *
    2965      * @param string $message The Error message
     2990     * @param string $message    The Error message
    29662991     * @param string $error_code Optional. A Computer readable string to identify the error.
    29672992     * @return false|void
     
    29823007     *
    29833008     * @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
    29883014     */
    29893015    public function check_database_version() {
     
    30393065     *                       'group_concat', 'subqueries', 'set_charset',
    30403066     *                       or 'utf8mb4'.
    3041      * @return bool Whether the database feature is supported, false otherwise.
     3067     * @return int|false Whether the database feature is supported, false otherwise.
    30423068     */
    30433069    public function has_cap( $db_cap ) {
     
    30843110     * @since 2.5.0
    30853111     *
    3086      * @return string The name of the calling function
     3112     * @return string|array The name of the calling function
    30873113     */
    30883114    public function get_caller() {
Note: See TracChangeset for help on using the changeset viewer.