connectivity/source/drivers/firebird/PreparedStatement.cxx | 6 ++++++ 1 file changed, 6 insertions(+)
New commits: commit 8cf970d4b3dca4f2f93fcebb8910aaeeb7ccf5fe 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 18:22:20 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/+/127593 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 8d08a207a67c..04e65b9c5e95 100644 --- a/connectivity/source/drivers/firebird/PreparedStatement.cxx +++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx @@ -262,6 +262,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",