diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2013-08-23 12:57:05 +0100 |
---|---|---|
committer | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2013-08-23 17:52:01 +0100 |
commit | 35ab624acdfb78db429e118c51bea783ace57e95 (patch) | |
tree | 39b2dcc715bd4697d2f3cb96f79de0b627288ef0 /connectivity | |
parent | 1f50aee94df71bcd4c99cee44af0464ce46193a3 (diff) |
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
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/firebird/PreparedStatement.cxx | 13 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/PreparedStatement.hxx | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx index 506e14528365..9f4637a31be2 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 8d4a0e1dd429..eca8562bcf4f 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); |