summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-10-11 13:46:43 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-10-11 14:31:56 +0200
commite61fc957f199930728854831b0223ee192054d50 (patch)
treea4d4b54bbd23763a28d00a4d2bdae768259a83ee /connectivity
parentabd42a63f65f810c821085149c095682247e0d0d (diff)
escapeWith is just a substitution for OUString::replaceAll
Change-Id: Ib0b84826a47474f58fa87ed4e1ca1d16c89e1620 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141217 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/firebird/ResultSetMetaData.cxx12
-rw-r--r--connectivity/source/drivers/firebird/Util.cxx16
-rw-r--r--connectivity/source/drivers/firebird/Util.hxx1
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 );
}