diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-12-09 19:47:06 +0100 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-12-28 16:57:27 +0100 |
commit | 217ec9aba798777ccab58f2382a1d0592f15249f (patch) | |
tree | f7d6794ec1da614d8ca6697798b01182e008944b | |
parent | 97b4ac005269ba35d87151b55abca6a91c9b5e5f (diff) |
Simplify use of indexes in getToken/lastIndexOf
Change-Id: Icb275c611dec8427121fea5e197b976a2c1b8166
Reviewed-on: https://gerrit.libreoffice.org/65667
Tested-by: Jenkins
Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
-rw-r--r-- | connectivity/source/commontools/AutoRetrievingBase.cxx | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/connectivity/source/commontools/AutoRetrievingBase.cxx b/connectivity/source/commontools/AutoRetrievingBase.cxx index e4f10831f12c..75cc214138b1 100644 --- a/connectivity/source/commontools/AutoRetrievingBase.cxx +++ b/connectivity/source/commontools/AutoRetrievingBase.cxx @@ -32,14 +32,12 @@ namespace connectivity { sStatement = m_sGeneratedValueStatement; static const char sTable[] = "$table"; - sal_Int32 nIndex = 0; - nIndex = sStatement.indexOf("$column",nIndex); - if ( -1 != nIndex ) + const sal_Int32 nColumnIndex {sStatement.indexOf("$column")}; + if ( nColumnIndex>=0 ) { // we need a column } - nIndex = 0; - nIndex = sStatement.indexOf(sTable,nIndex); - if ( -1 != nIndex ) + const sal_Int32 nTableIndex {sStatement.indexOf(sTable)}; + if ( nTableIndex>=0 ) { // we need a table name sal_Int32 nIntoIndex = sStmt.indexOf("INTO "); sStmt = sStmt.copy(nIntoIndex+5); @@ -47,10 +45,8 @@ namespace connectivity { sStmt = sStmt.copy(1); } - - nIntoIndex = 0; - OUString sTableName = sStmt.getToken(0,' ',nIntoIndex); - sStatement = sStatement.replaceAt(nIndex, strlen(sTable), sTableName); + const OUString sTableName = sStmt.getToken(0, ' '); + sStatement = sStatement.replaceAt(nTableIndex, strlen(sTable), sTableName); } } return sStatement; |