connectivity/source/drivers/firebird/PreparedStatement.cxx | 16 +++++++++++++ connectivity/source/drivers/firebird/PreparedStatement.hxx | 2 + 2 files changed, 18 insertions(+)
New commits: commit 35ab624acdfb78db429e118c51bea783ace57e95 Author: Andrzej J.R. Hunt <andr...@ahunt.org> Date: Fri Aug 23 12:57:05 2013 +0100 Set Null indicator in input SQLDA as appropriate. (firebird-sdbc) If this is incorrectly (or randomly set) then firebird will end up just ignoring any input parameters (previously the case). The documentation claims that -1 is the null indicator, however the inevitably-random values previously provided (from malloc) also caused firebird to treat all input data as null. Change-Id: I79b9704df0a307ec493e74e782551b9b0ff109a2 diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx index 506e145..9f4637a 100644 --- a/connectivity/source/drivers/firebird/PreparedStatement.cxx +++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx @@ -207,6 +207,7 @@ void SAL_CALL OPreparedStatement::setString(sal_Int32 nParameterIndex, ensurePrepared(); checkParameterIndex(nParameterIndex); + setParameterNull(nParameterIndex, false); OString str = OUStringToOString(x , RTL_TEXTENCODING_UTF8 ); @@ -590,5 +591,17 @@ void OPreparedStatement::checkParameterIndex(sal_Int32 nParameterIndex) // TODO: sane error message here. } +void OPreparedStatement::setParameterNull(sal_Int32 nParameterIndex, + bool bSetNull) +{ + XSQLVAR* pVar = m_pInSqlda->sqlvar + (nParameterIndex - 1); + if (pVar->sqltype & 1) + { + if (bSetNull) + *pVar->sqlind = -1; + else + *pVar->sqlind = 0; + } +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/PreparedStatement.hxx b/connectivity/source/drivers/firebird/PreparedStatement.hxx index 8d4a0e1..eca8562 100644 --- a/connectivity/source/drivers/firebird/PreparedStatement.hxx +++ b/connectivity/source/drivers/firebird/PreparedStatement.hxx @@ -74,6 +74,8 @@ namespace connectivity void checkParameterIndex(sal_Int32 nParameterIndex) throw(::com::sun::star::sdbc::SQLException); + void setParameterNull(sal_Int32 nParameterIndex, bool bSetNull = true); + void ensurePrepared() throw(::com::sun::star::sdbc::SQLException); commit 1f50aee94df71bcd4c99cee44af0464ce46193a3 Author: Andrzej J.R. Hunt <andr...@ahunt.org> Date: Fri Aug 23 12:16:11 2013 +0100 Improve comment. (firebird-sdbc) Change-Id: Iec5c5a434a371d73bba0345362f991a948d28c6a diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx index ddb10e0..506e145 100644 --- a/connectivity/source/drivers/firebird/PreparedStatement.cxx +++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx @@ -269,6 +269,9 @@ sal_Bool SAL_CALL OPreparedStatement::execute() { disposeResultSet(); // Closes the cursor from the last run. + // This doesn't actually free the statement -- using DSQL_close closes + // the cursor and keeps the statement, using DSQL_drop frees the statement + // (and associated cursors). aErr = isc_dsql_free_statement(m_statusVector, &m_aStatementHandle, DSQL_close); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits