Automattic\WooCommerce\Blueprint\Importers

ImportRunSql::is_allowed_query_typeprivateWC 1.0

Check if the SQL query type is allowed.

Method of the class: ImportRunSql{}

No Hooks.

Returns

true|false. True if the query type is allowed, false otherwise.

Usage

// private - for code of main (parent) class only
$result = $this->is_allowed_query_type( $sql_content ): bool;
$sql_content(string) (required)
The SQL query to check.

ImportRunSql::is_allowed_query_type() code WC 9.9.5

private function is_allowed_query_type( string $sql_content ): bool {
	$uppercase_sql_content = strtoupper( trim( $sql_content ) );

	foreach ( self::ALLOWED_QUERY_TYPES as $query_type ) {
		if ( 0 === stripos( $uppercase_sql_content, $query_type ) ) {
			return true;
		}
	}
	return false;
}