diff options
-rw-r--r-- | connectivity/source/drivers/firebird/ResultSetMetaData.cxx | 12 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/Util.cxx | 16 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/Util.hxx | 1 |
3 files changed, 6 insertions, 23 deletions
diff --git a/connectivity/source/drivers/firebird/ResultSetMetaData.cxx b/connectivity/source/drivers/firebird/ResultSetMetaData.cxx index 5653d29c4211..31a6796f5399 100644 --- a/connectivity/source/drivers/firebird/ResultSetMetaData.cxx +++ b/connectivity/source/drivers/firebird/ResultSetMetaData.cxx @@ -53,8 +53,8 @@ OUString OResultSetMetaData::getCharacterSet( sal_Int32 nIndex ) "JOIN RDB$RELATION_FIELDS relfields " "ON (fields.RDB$FIELD_NAME = relfields.RDB$FIELD_SOURCE) " "WHERE relfields.RDB$RELATION_NAME = '" - + escapeWith(sTable, '\'', '\'') + "' AND " - "relfields.RDB$FIELD_NAME = '"+ escapeWith(sColumnName, '\'', '\'') +"'"; + + sTable.replaceAll("'", "''") + "' AND " + "relfields.RDB$FIELD_NAME = '"+ sColumnName.replaceAll("'", "''") +"'"; Reference<XStatement> xStmt= m_pConnection->createStatement(); @@ -197,8 +197,8 @@ sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement(sal_Int32 column) OUString sSql = "SELECT RDB$IDENTITY_TYPE FROM RDB$RELATION_FIELDS " "WHERE RDB$RELATION_NAME = '" - + escapeWith(sTable, '\'', '\'') + "' AND " - "RDB$FIELD_NAME = '"+ escapeWith(sColumnName, '\'', '\'') +"'"; + + sTable.replaceAll("'", "''") + "' AND " + "RDB$FIELD_NAME = '"+ sColumnName.replaceAll("'", "''") +"'"; Reference<XStatement> xStmt =m_pConnection ->createStatement(); @@ -242,9 +242,9 @@ sal_Int32 SAL_CALL OResultSetMetaData::getPrecision(sal_Int32 column) " INNER JOIN RDB$RELATION_FIELDS " " ON RDB$RELATION_FIELDS.RDB$FIELD_SOURCE = RDB$FIELDS.RDB$FIELD_NAME " "WHERE RDB$RELATION_FIELDS.RDB$RELATION_NAME = '" - + escapeWith(getTableName(column), '\'', '\'') + "' AND " + + getTableName(column).replaceAll("'", "''") + "' AND " "RDB$RELATION_FIELDS.RDB$FIELD_NAME = '" - + escapeWith(sColumnName, '\'', '\'') +"'"; + + sColumnName.replaceAll("'", "''") +"'"; Reference<XStatement> xStmt= m_pConnection->createStatement(); Reference<XResultSet> xRes = diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx index a792e032939c..1fd1bd03e7a2 100644 --- a/connectivity/source/drivers/firebird/Util.cxx +++ b/connectivity/source/drivers/firebird/Util.cxx @@ -411,22 +411,6 @@ void firebird::freeSQLVAR(XSQLDA* pSqlda) } -OUString firebird::escapeWith( const OUString& sText, const char aKey, const char aEscapeChar) -{ - OUString sRet(sText); - sal_Int32 aIndex = 0; - for (;;) - { - aIndex = sRet.indexOf(aKey, aIndex); - if ( aIndex <= 0 || aIndex >= sRet.getLength()) - break; - sRet = sRet.replaceAt(aIndex, 1, rtl::Concat2View(OUStringChar(aEscapeChar) + OUStringChar(aKey)) ); - aIndex += 2; - } - - return sRet; -} - sal_Int64 firebird::pow10Integer(int nDecimalCount) { sal_Int64 nRet = 1; diff --git a/connectivity/source/drivers/firebird/Util.hxx b/connectivity/source/drivers/firebird/Util.hxx index bfbfb62c22fc..db407ef98b38 100644 --- a/connectivity/source/drivers/firebird/Util.hxx +++ b/connectivity/source/drivers/firebird/Util.hxx @@ -119,7 +119,6 @@ public: void freeSQLVAR(XSQLDA* pSqlda); - OUString escapeWith( const OUString& sText, const char aKey, const char aEscapeChar); sal_Int64 pow10Integer( int nDecimalCount ); } |