Automattic\WooCommerce\Internal\Utilities
DatabaseUtil::get_wpdb_format_for_type()
Returns the $wpdb placeholder to use for data type $type.
Method of the class: DatabaseUtil{}
No Hooks.
Return
String
.
Usage
$DatabaseUtil = new DatabaseUtil(); $DatabaseUtil->get_wpdb_format_for_type( $type );
- $type(string) (required)
- Data type.
DatabaseUtil::get_wpdb_format_for_type() DatabaseUtil::get wpdb format for type code WC 9.8.2
public function get_wpdb_format_for_type( string $type ) { static $wpdb_placeholder_for_type = array( 'int' => '%d', 'decimal' => '%f', 'string' => '%s', 'date' => '%s', 'date_epoch' => '%s', 'bool' => '%d', ); if ( ! isset( $wpdb_placeholder_for_type[ $type ] ) ) { throw new \Exception( esc_html( 'Invalid column type: ' . $type ) ); } return $wpdb_placeholder_for_type[ $type ]; }