mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-12 13:44:21 +01:00
Add documentation for floats (%f) to wpdb::prepare() and friends. Props dllh. Fixes #18407
git-svn-id: http://svn.automattic.com/wordpress/trunk@18714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bd5cf872c6
commit
4752a8a1aa
@ -843,13 +843,14 @@ class wpdb {
|
|||||||
*
|
*
|
||||||
* The following directives can be used in the query format string:
|
* The following directives can be used in the query format string:
|
||||||
* %d (integer)
|
* %d (integer)
|
||||||
|
* %f (float)
|
||||||
* %s (string)
|
* %s (string)
|
||||||
* %% (literal percentage sign - no argument needed)
|
* %% (literal percentage sign - no argument needed)
|
||||||
*
|
*
|
||||||
* Both %d and %s are to be left unquoted in the query string and they need an argument passed for them.
|
* All of %d, %f, and %s are to be left unquoted in the query string and they need an argument passed for them.
|
||||||
* Literals (%) as parts of the query must be properly written as %%.
|
* Literals (%) as parts of the query must be properly written as %%.
|
||||||
*
|
*
|
||||||
* This function only supports a small subset of the sprintf syntax; it only supports %d (integer), %s (string).
|
* This function only supports a small subset of the sprintf syntax; it only supports %d (integer), %f (float), and %s (string).
|
||||||
* Does not support sign, padding, alignment, width or precision specifiers.
|
* Does not support sign, padding, alignment, width or precision specifiers.
|
||||||
* Does not support argument numbering/swapping.
|
* Does not support argument numbering/swapping.
|
||||||
*
|
*
|
||||||
@ -1132,7 +1133,7 @@ class wpdb {
|
|||||||
* @param string $table table name
|
* @param string $table table name
|
||||||
* @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
|
* @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
|
||||||
* @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.
|
* @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.
|
||||||
* 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.
|
* 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.
|
||||||
* @return int|false The number of rows inserted, or false on error.
|
* @return int|false The number of rows inserted, or false on error.
|
||||||
*/
|
*/
|
||||||
function insert( $table, $data, $format = null ) {
|
function insert( $table, $data, $format = null ) {
|
||||||
@ -1155,7 +1156,7 @@ class wpdb {
|
|||||||
* @param string $table table name
|
* @param string $table table name
|
||||||
* @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
|
* @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
|
||||||
* @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.
|
* @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.
|
||||||
* 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.
|
* 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.
|
||||||
* @return int|false The number of rows affected, or false on error.
|
* @return int|false The number of rows affected, or false on error.
|
||||||
*/
|
*/
|
||||||
function replace( $table, $data, $format = null ) {
|
function replace( $table, $data, $format = null ) {
|
||||||
@ -1176,7 +1177,7 @@ class wpdb {
|
|||||||
* @param string $table table name
|
* @param string $table table name
|
||||||
* @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
|
* @param array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
|
||||||
* @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.
|
* @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.
|
||||||
* 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.
|
* 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.
|
||||||
* @return int|false The number of rows affected, or false on error.
|
* @return int|false The number of rows affected, or false on error.
|
||||||
*/
|
*/
|
||||||
function _insert_replace_helper( $table, $data, $format = null, $type = 'INSERT' ) {
|
function _insert_replace_helper( $table, $data, $format = null, $type = 'INSERT' ) {
|
||||||
@ -1215,8 +1216,8 @@ class wpdb {
|
|||||||
* @param array $data Data to update (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
|
* @param array $data Data to update (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
|
||||||
* @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".
|
* @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".
|
||||||
* @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.
|
* @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.
|
||||||
* 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.
|
* 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.
|
||||||
* @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.
|
* @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.
|
||||||
* @return int|false The number of rows updated, or false on error.
|
* @return int|false The number of rows updated, or false on error.
|
||||||
*/
|
*/
|
||||||
function update( $table, $data, $where, $format = null, $where_format = null ) {
|
function update( $table, $data, $where, $format = null, $where_format = null ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user