connectivity/source/drivers/firebird/PreparedStatement.cxx | 6 ++++++ 1 file changed, 6 insertions(+)
New commits: commit 30fb61f80bba3b119d2fbfb450e3cf1ae7e65d59 Author: Julien Nabet <serval2...@yahoo.fr> AuthorDate: Mon Dec 27 16:58:05 2021 +0100 Commit: Julien Nabet <serval2...@yahoo.fr> CommitDate: Mon Dec 27 20:39:59 2021 +0100 tdf#130595: Parameter query with :parameter IS NULL doesn't work Problematic SQL here: SELECT * FROM "Table1" WHERE "Name" = :name OR :name IS NULL Firebird considers there are 2 parameters. When providing an empty string, no pb, OPreparedStatement::setNull is called which is ok for both parameters When providing a non empty string, we go to OPreparedStatement::setString. For first param no pb but for second param, sql type is SQL_NULL so it must be taken into account See https://www.firebirdsql.org/file/documentation/html/en/refdocs/fblangref25/firebird-25-language-reference.html#fblangref25-datatypes-special-sqlnull for full details Change-Id: I80dff259d85957e8547c098e4c48b642cce26804 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127572 Reviewed-by: Lionel Mamane <lio...@mamane.lu> Tested-by: Jenkins diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx index 3b5511518957..db49ad2e4d8d 100644 --- a/connectivity/source/drivers/firebird/PreparedStatement.cxx +++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx @@ -264,6 +264,12 @@ void SAL_CALL OPreparedStatement::setString(sal_Int32 nParameterIndex, setBoolean(nParameterIndex, boolValue); break; } + case SQL_NULL: + { + // See https://www.firebirdsql.org/file/documentation/html/en/refdocs/fblangref25/firebird-25-language-reference.html#fblangref25-datatypes-special-sqlnull + pVar->sqldata = nullptr; + break; + } default: ::dbtools::throwSQLException( "Incorrect type for setString",