rewrite_statement_for_null_parameters
Description:
[ Version ( since = "4.2.9" ) ]
public bool rewrite_statement_for_null_parameters (Statement stmt, Set @params, owned Statement? out_stmt) throws Error
Modifies stmt to take into account any parameter which might be null: if stmt contains the equivalent of
"xxx = <parameter definition>" and if that parameter is in params and its value is of type GDA_TYPE_NUL, then that part is
replaced with "xxx IS NULL".
It also handles the "xxx IS NOT NULL" transformation.
For example the following SELECT:
SELECT * FROM data WHERE id = ##id::int:null AND name = ##name::string
in case the "id" parameter is set to NULL, is converted to:
SELECT * FROM data WHERE id IS NULL AND name = ##name::string
if out_stmt is not null, then it will contain:
- the modified statement if some modifications were required and no error occured (the function returns
true) nullif no modification tostmtwere required and no erro occurred (the function returnsfalse)nullif an error occured (the function returnstrue)
This function is used by provider's implementations to make sure one can use parameters with NULL values in statements without having to rewrite statements, as database usually don't consider that "xxx = NULL" is the same as "xxx IS NULL" when using parameters.
Parameters:
| stmt | |
| out_stmt |
a place to store the new Statement, or |
| params |
a Set to be used as parameters when executing |
Returns:
|
|