@@ 2205-2222 (lines=18) @@ | ||
2202 | * @param string $table Table name. |
|
2203 | * @return array|false The same array as $data with additional 'charset' keys. |
|
2204 | */ |
|
2205 | protected function process_field_charsets( $data, $table ) { |
|
2206 | foreach ( $data as $field => $value ) { |
|
2207 | if ( '%d' === $value['format'] || '%f' === $value['format'] ) { |
|
2208 | /* |
|
2209 | * We can skip this field if we know it isn't a string. |
|
2210 | * This checks %d/%f versus ! %s because its sprintf() could take more. |
|
2211 | */ |
|
2212 | $value['charset'] = false; |
|
2213 | } else { |
|
2214 | $value['charset'] = $this->get_col_charset( $table, $field ); |
|
2215 | if ( is_wp_error( $value['charset'] ) ) { |
|
2216 | return false; |
|
2217 | } |
|
2218 | } |
|
2219 | ||
2220 | $data[ $field ] = $value; |
|
2221 | } |
|
2222 | ||
2223 | return $data; |
|
2224 | } |
|
2225 | ||
@@ 2237-2254 (lines=18) @@ | ||
2234 | * @return array|false The same array as $data with additional 'length' keys, or false if |
|
2235 | * any of the values were too long for their corresponding field. |
|
2236 | */ |
|
2237 | protected function process_field_lengths( $data, $table ) { |
|
2238 | foreach ( $data as $field => $value ) { |
|
2239 | if ( '%d' === $value['format'] || '%f' === $value['format'] ) { |
|
2240 | /* |
|
2241 | * We can skip this field if we know it isn't a string. |
|
2242 | * This checks %d/%f versus ! %s because its sprintf() could take more. |
|
2243 | */ |
|
2244 | $value['length'] = false; |
|
2245 | } else { |
|
2246 | $value['length'] = $this->get_col_length( $table, $field ); |
|
2247 | if ( is_wp_error( $value['length'] ) ) { |
|
2248 | return false; |
|
2249 | } |
|
2250 | } |
|
2251 | ||
2252 | $data[ $field ] = $value; |
|
2253 | } |
|
2254 | ||
2255 | return $data; |
|
2256 | } |
|
2257 |