wpdb::process_field_lengths( array $data, string $table ): array|false
For string fields, records the maximum string length that field can safely save.
Parameters
-
$data
array Required -
Array of values, formats, and charsets keyed by their field names, as it comes from the wpdb::process_field_charsets() method.
...$0
arrayValue, format, and charset for this field.value
mixedThe value to be formatted.format
stringThe format to be mapped to the value.charset
string|falseThe charset to be used for the value.
More Arguments from wpdb::process_field_charsets( ... $data )
Array of values keyed by their field names.$table
string RequiredTable name.
Return
array|false The same array of data with additional 'length' keys, or false if information for the table cannot be found.
...$0
arrayValue, format, charset, and length for this field.value
mixedThe value to be formatted.format
stringThe format to be mapped to the value.charset
string|falseThe charset to be used for the value.length
array|falseInformation about the maximum length of the value.
False if the column has no length.type
stringOne of'byte'
or'char'
.length
intThe column length.
}
Source
File:
wp-includes/class-wpdb.php
. View all referencesprotected function process_field_lengths( $data, $table ) { foreach ( $data as $field => $value ) { if ( '%d' === $value['format'] || '%f' === $value['format'] ) { /* * We can skip this field if we know it isn't a string. * This checks %d/%f versus ! %s because its sprintf() could take more. */ $value['length'] = false; } else { $value['length'] = $this->get_col_length( $table, $field ); if ( is_wp_error( $value['length'] ) ) { return false; } } $data[ $field ] = $value; } return $data; }
Changelog
Changelog Version Description 4.2.1 Introduced.
User Contributed Notes