Skip to content

Commit d6f6b6d

Browse files
committed
Bail out with error for unsupported SET statements
1 parent ad474af commit d6f6b6d

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

wp-includes/sqlite-ast/class-wp-sqlite-driver.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1875,10 +1875,14 @@ private function execute_set_statement( WP_Parser_Node $node ): void {
18751875
array_shift( $definition ); // Remove the '='.
18761876
$value = array_shift( $definition );
18771877
$this->execute_set_system_variable_statement( $part, $value, $default_type );
1878+
} else {
1879+
// TODO: Support user variables (in-memory or a temporary table).
1880+
throw $this->new_not_supported_exception(
1881+
sprintf( 'SET statement: %s', $node->rule_name )
1882+
);
18781883
}
18791884
}
18801885

1881-
// TODO: Support user variables (in-memory or a temporary table).
18821886
$this->last_result = 0;
18831887
}
18841888

@@ -1924,6 +1928,12 @@ private function execute_set_system_variable_statement(
19241928
$modes = explode( ',', strtoupper( $value ) );
19251929
$this->active_sql_modes = $modes;
19261930
}
1931+
} elseif ( WP_MySQL_Lexer::GLOBAL_SYMBOL === $type ) {
1932+
throw $this->new_not_supported_exception( "SET statement type: 'GLOBAL'" );
1933+
} elseif ( WP_MySQL_Lexer::PERSIST_SYMBOL === $type ) {
1934+
throw $this->new_not_supported_exception( "SET statement type: 'PERSIST'" );
1935+
} elseif ( WP_MySQL_Lexer::PERSIST_ONLY_SYMBOL === $type ) {
1936+
throw $this->new_not_supported_exception( "SET statement type: 'PERSIST_ONLY'" );
19271937
}
19281938

19291939
// TODO: Handle GLOBAL, PERSIST, and PERSIST_ONLY types.

0 commit comments

Comments
 (0)