Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableFieldQuery::sanitize_cast_type()
Returns the correct type for a given clause 'type'.
Method of the class: OrdersTableFieldQuery{}
No Hooks.
Return
String
. MySQL type.
Usage
// private - for code of main (parent) class only $result = $this->sanitize_cast_type( $type );
- $type(string) (required)
- MySQL type.
OrdersTableFieldQuery::sanitize_cast_type() OrdersTableFieldQuery::sanitize cast type code WC 9.3.3
private function sanitize_cast_type( $type ) { $clause_type = strtoupper( $type ); if ( ! $clause_type || ! preg_match( '/^(?:BINARY|CHAR|DATE|DATETIME|SIGNED|UNSIGNED|TIME|NUMERIC(?:\(\d+(?:,\s?\d+)?\))?|DECIMAL(?:\(\d+(?:,\s?\d+)?\))?)$/', $clause_type ) ) { return 'CHAR'; } if ( 'NUMERIC' === $clause_type ) { $clause_type = 'SIGNED'; } return $clause_type; }