Kaydet (Commit) 08004507 authored tarafından Matteo Casalin's avatar Matteo Casalin

Further reduction of OUString copy operations

Change-Id: I79339e7cf8fa6b6a6f19ba598fc66d9e0df558ae
Reviewed-on: https://gerrit.libreoffice.org/65669
Tested-by: Jenkins
Reviewed-by: 's avatarMatteo Casalin <matteo.casalin@yahoo.com>
üst 3bfe1012
...@@ -27,25 +27,24 @@ namespace connectivity ...@@ -27,25 +27,24 @@ namespace connectivity
{ {
OSL_ENSURE( m_bAutoRetrievingEnabled,"Illegal call here. isAutoRetrievingEnabled is false!"); OSL_ENSURE( m_bAutoRetrievingEnabled,"Illegal call here. isAutoRetrievingEnabled is false!");
OUString sStmt = _sInsertStatement.toAsciiUpperCase(); OUString sStmt = _sInsertStatement.toAsciiUpperCase();
OUString sStatement;
if ( sStmt.startsWith("INSERT") ) if ( sStmt.startsWith("INSERT") )
{ {
sStatement = m_sGeneratedValueStatement;
static const char sTable[] = "$table"; static const char sTable[] = "$table";
const sal_Int32 nColumnIndex {sStatement.indexOf("$column")}; const sal_Int32 nColumnIndex {m_sGeneratedValueStatement.indexOf("$column")};
if ( nColumnIndex>=0 ) if ( nColumnIndex>=0 )
{ // we need a column { // we need a column
} }
const sal_Int32 nTableIndex {sStatement.indexOf(sTable)}; const sal_Int32 nTableIndex {m_sGeneratedValueStatement.indexOf(sTable)};
if ( nTableIndex>=0 ) if ( nTableIndex>=0 )
{ // we need a table name { // we need a table name
sal_Int32 nIntoIndex = sStmt.indexOf("INTO ") + 5; sal_Int32 nIntoIndex = sStmt.indexOf("INTO ") + 5;
while (nIntoIndex<sStmt.getLength() && sStmt[nIntoIndex]==' ') ++nIntoIndex; while (nIntoIndex<sStmt.getLength() && sStmt[nIntoIndex]==' ') ++nIntoIndex;
const OUString sTableName = sStmt.getToken(0, ' ', nIntoIndex); const OUString sTableName = sStmt.getToken(0, ' ', nIntoIndex);
sStatement = sStatement.replaceAt(nTableIndex, strlen(sTable), sTableName); return m_sGeneratedValueStatement.replaceAt(nTableIndex, strlen(sTable), sTableName);
} }
return m_sGeneratedValueStatement;
} }
return sStatement; return OUString();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment