diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2018-01-02 22:49:31 +0100 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2018-01-04 07:50:22 +0100 |
commit | a29d97e6ddab8ec002ba9827bd5fc874117712e0 (patch) | |
tree | cbedfb8885b7980a4ea6ebb1347e2170a969b01a /connectivity/source/drivers/firebird/Connection.cxx | |
parent | 1bbadad79d91005dc18a3c1e34de14d02660f6ab (diff) |
tdf#104986 move named parameters substitution into generic layer
Previously, drivers were responsible for making the substitution themselves.
In practice they all (Firebird, ODBC and JDBC) used the LibreOffice SQL
parser to parse the SQL statement and do the substitution.
This had a few negative consequences:
* The substitition was applied to _all_ SQL commands, including
queries having the "execute SQL directly" bit set. Which means
that the SQL was _not_ sent to the DBMS exactly as typed by
the user. Even if there was no substitution to be made, since
the SQL command was always round-tripped through the parser,
thus "normalising" it (which is what led to tdf#104986).
* "execute SQL directly" queries "magically" behaved slightly
differently depending on whether the LibreOffice SQL parser
succeeded in parsing them or not.
Change-Id: Ieedc643f33467435a139e2565a01e6f398af041f
Reviewed-on: https://gerrit.libreoffice.org/47283
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu>
Diffstat (limited to 'connectivity/source/drivers/firebird/Connection.cxx')
-rw-r--r-- | connectivity/source/drivers/firebird/Connection.cxx | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx index 32e314029f7f..7d0937e3ae99 100644 --- a/connectivity/source/drivers/firebird/Connection.cxx +++ b/connectivity/source/drivers/firebird/Connection.cxx @@ -393,30 +393,6 @@ Reference< XStatement > SAL_CALL Connection::createStatement( ) return xReturn; } -OUString Connection::transformPreparedStatement(const OUString& _sSQL) -{ - OUString sSqlStatement (_sSQL); - try - { - OSQLParser aParser( m_xDriver->getContext() ); - OUString sErrorMessage; - OUString sNewSql; - OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,_sSQL); - if(pNode) - { // special handling for parameters - OSQLParseNode::substituteParameterNames(pNode); - pNode->parseNodeToStr( sNewSql, this ); - delete pNode; - sSqlStatement = sNewSql; - } - } - catch(const Exception&) - { - SAL_WARN("connectivity.firebird", "failed to remove named parameters from '" << _sSQL << "'"); - } - return sSqlStatement; -} - Reference< XPreparedStatement > SAL_CALL Connection::prepareStatement( const OUString& _sSql) { @@ -428,10 +404,7 @@ Reference< XPreparedStatement > SAL_CALL Connection::prepareStatement( if(m_aTypeInfo.empty()) buildTypeInfo(); - OUString sSqlStatement (transformPreparedStatement( _sSql )); - - Reference< XPreparedStatement > xReturn = new OPreparedStatement(this, - sSqlStatement); + Reference< XPreparedStatement > xReturn = new OPreparedStatement(this, _sSql); m_aStatements.push_back(WeakReferenceHelper(xReturn)); return xReturn; |