gcdb::process_field_charsets()
最后更新于:2021-11-26 09:03:22
gcdb::process_field_charsets( array$data, string$table)Adds field charsets to field/value/format arrays generated by gcdb::process_field_formats().
参数
- $data
-
(array) (Required) As it comes from the gcdb::process_field_formats() method.
- $table
-
(string) (Required) Table name.
响应
(array|false) The same array as $data with additional ‘charset’ keys. False on failure.
源文件
文件: gc-includes/gc-db.php
protected function process_field_charsets( $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['charset'] = false;
} else {
$value['charset'] = $this->get_col_charset( $table, $field );
if ( is_gc_error( $value['charset'] ) ) {
return false;
}
}
$data[ $field ] = $value;
}
return $data;
}