rewriteStatementForNullParameters

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: <programlisting>SELECT * FROM data WHERE id = ##id::int::null AND name = ##name::string</programlisting> in case the "id" parameter is set to NULL, is converted to: <programlisting>SELECT * FROM data WHERE id IS NULL AND name = ##name::string</programlisting>

if out_stmt is not null, then it will contain: <itemizedlist> <listitem><para>the modified statement if some modifications were required and no error occured (the function returns true)</para></listitem> <listitem><para>null if no modification to stmt were required and no erro occurred (the function returns false)</para></listitem> <listitem><para>null if an error occured (the function returns true)</para></listitem> </itemizedlist>

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.

bool
rewriteStatementForNullParameters

Parameters

stmt gda.statement.Statement

a #GdaStatement

params gda.set.Set

a #GdaSet to be used as parameters when executing stmt

outStmt gda.statement.Statement

a place to store the new #GdaStatement, or null

Return Value

Type: bool

true if stmt needs to be transformed to handle NULL parameters, and false otherwise

Throws