WordPress.org

Make WordPress Core

Changeset 18714


Ignore:
Timestamp:
09/19/11 05:15:44 (3 years ago)
Author:
dd32
Message:

Add documentation for floats (%f) to wpdb::prepare() and friends. Props dllh. Fixes #18407

File:
1 edited

Legend:

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

    r18639 r18714  
    844844     * The following directives can be used in the query format string: 
    845845     *   %d (integer) 
     846     *   %f (float) 
    846847     *   %s (string) 
    847848     *   %% (literal percentage sign - no argument needed) 
    848849     * 
    849      * Both %d and %s are to be left unquoted in the query string and they need an argument passed for them. 
     850     * All of %d, %f, and %s are to be left unquoted in the query string and they need an argument passed for them. 
    850851     * Literals (%) as parts of the query must be properly written as %%. 
    851852     * 
    852      * This function only supports a small subset of the sprintf syntax; it only supports %d (integer), %s (string). 
     853     * This function only supports a small subset of the sprintf syntax; it only supports %d (integer), %f (float), and %s (string). 
    853854     * Does not support sign, padding, alignment, width or precision specifiers. 
    854855     * Does not support argument numbering/swapping. 
     
    11331134     * @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped). 
    11341135     * @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. 
    1135      *  A format is one of '%d', '%s' (integer, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. 
     1136     *  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. 
    11361137     * @return int|false The number of rows inserted, or false on error. 
    11371138     */ 
     
    11561157     * @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped). 
    11571158     * @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. 
    1158      *  A format is one of '%d', '%s' (integer, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. 
     1159     *  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. 
    11591160     * @return int|false The number of rows affected, or false on error. 
    11601161     */ 
     
    11771178     * @param array $data Data to insert (in column => value pairs).  Both $data columns and $data values should be "raw" (neither should be SQL escaped). 
    11781179     * @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. 
    1179      *  A format is one of '%d', '%s' (integer, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. 
     1180     *  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. 
    11801181     * @return int|false The number of rows affected, or false on error. 
    11811182     */ 
     
    12161217     * @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". 
    12171218     * @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. 
    1218      *  A format is one of '%d', '%s' (integer, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. 
    1219      * @param array|string $format_where 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', '%s' (integer, string).  If omitted, all values in $where will be treated as strings. 
     1219     *  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. 
     1220     * @param array|string $format_where 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. 
    12201221     * @return int|false The number of rows updated, or false on error. 
    12211222     */ 
Note: See TracChangeset for help on using the changeset viewer.