summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-09-26 15:49:48 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-09-27 07:58:41 +0200
commit23a7bdecee5278673a7c79286fb3faea553a85b2 (patch)
tree1189ba2a67c4ef47f70cbcb4a0cb9ee90a9898b9 /connectivity
parent0d3dd0aa54ad792f91d0905f3d46c13df3512d89 (diff)
use more string_view in connectivity
Change-Id: I313fe10ce3166a0cd96ae0a98e571fd4356da3b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140620 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/hsqldb/HStorageMap.cxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_statement.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_statement.hxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.cxx28
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.hxx4
-rw-r--r--connectivity/source/inc/hsqldb/HStorageMap.hxx2
6 files changed, 23 insertions, 23 deletions
diff --git a/connectivity/source/drivers/hsqldb/HStorageMap.cxx b/connectivity/source/drivers/hsqldb/HStorageMap.cxx
index 4d4863619186..01a9c3d34be3 100644
--- a/connectivity/source/drivers/hsqldb/HStorageMap.cxx
+++ b/connectivity/source/drivers/hsqldb/HStorageMap.cxx
@@ -132,9 +132,9 @@ namespace connectivity::hsqldb
return OUString::number(s_nCount++);
}
- OUString StorageContainer::removeURLPrefix(std::u16string_view _sURL,const OUString& _sFileURL)
+ OUString StorageContainer::removeURLPrefix(std::u16string_view _sURL, std::u16string_view _sFileURL)
{
- return OUString(_sURL.substr(_sFileURL.getLength()+1));
+ return OUString(_sURL.substr(_sFileURL.size()+1));
}
OUString StorageContainer::removeOldURLPrefix(const OUString& _sURL)
diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx
index 1dc5e8c420f6..9622bfee6b7a 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.cxx
@@ -590,7 +590,7 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert(
ConnectionSettings *pConnectionSettings,
const Reference< XConnection > &connection,
sal_Int32 nLastOid,
- const OUString & lastTableInserted,
+ std::u16string_view lastTableInserted,
const OString & lastQuery )
{
Reference< XResultSet > ret;
@@ -599,7 +599,7 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert(
splitConcatenatedIdentifier(
lastTableInserted, &schemaName, &tableName );
- if( nLastOid && lastTableInserted.getLength() )
+ if( nLastOid && lastTableInserted.size() )
{
OUStringBuffer buf( 128 );
buf.append( "SELECT * FROM " );
@@ -611,7 +611,7 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert(
buf.append( nLastOid );
query = buf.makeStringAndClear();
}
- else if ( lastTableInserted.getLength() && lastQuery.getLength() )
+ else if ( lastTableInserted.size() && lastQuery.getLength() )
{
// extract nameValue Pairs
String2StringMap namedValues;
diff --git a/connectivity/source/drivers/postgresql/pq_statement.hxx b/connectivity/source/drivers/postgresql/pq_statement.hxx
index fae6568bb505..816d2a55afaa 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.hxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.hxx
@@ -189,7 +189,7 @@ css::uno::Reference< css::sdbc::XResultSet > getGeneratedValuesFromLastInsert(
ConnectionSettings *pConnectionSettings,
const css::uno::Reference< css::sdbc::XConnection > &connection,
sal_Int32 nLastOid,
- const OUString & lastTableInserted,
+ std::u16string_view lastTableInserted,
const OString & lastQuery );
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index 94f032f8c128..b9ff495a5105 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -315,30 +315,30 @@ bool isWhitespace( sal_Unicode c )
return ' ' == c || 9 == c || 10 == c || 13 == c;
}
-OUString extractTableFromInsert( const OUString & sql )
+OUString extractTableFromInsert( std::u16string_view sql )
{
OUString ret;
- int i = 0;
- while (i < sql.getLength() && isWhitespace(sql[i])) { i++; }
+ size_t i = 0;
+ while (i < sql.size() && isWhitespace(sql[i])) { i++; }
- if( sql.matchIgnoreAsciiCase("insert", i) )
+ if( o3tl::matchIgnoreAsciiCase(sql, u"insert", i) )
{
i += 6;
- while (i < sql.getLength() && isWhitespace(sql[i])) { i++; }
- if( sql.matchIgnoreAsciiCase("into", i) )
+ while (i < sql.size() && isWhitespace(sql[i])) { i++; }
+ if( o3tl::matchIgnoreAsciiCase(sql, u"into", i) )
{
i +=4;
- while (i < sql.getLength() && isWhitespace(sql[i])) { i++; }
+ while (i < sql.size() && isWhitespace(sql[i])) { i++; }
int start = i;
bool quote = (sql[i] == '"');
- for( i++ ; i < sql.getLength() ; i ++ )
+ for( i++ ; i < sql.size() ; i ++ )
{
if( quote && sql[i] == '"' )
{
- while (i < sql.getLength() && isWhitespace(sql[i])) { i++; }
+ while (i < sql.size() && isWhitespace(sql[i])) { i++; }
if( '.' == sql[i] )
{
- while (i < sql.getLength() && isWhitespace(sql[i])) { i++; }
+ while (i < sql.size() && isWhitespace(sql[i])) { i++; }
if( '"' == sql[i] )
{
// the second part of the table name does not use quotes
@@ -361,7 +361,7 @@ OUString extractTableFromInsert( const OUString & sql )
}
}
}
- ret = o3tl::trim(sql.subView(start, i - start ));
+ ret = o3tl::trim(sql.substr(start, i - start ));
// printf( "pq_statement: parsed table name %s from insert\n" ,
// OUStringToOString( ret, RTL_TEXTENCODING_ASCII_US).getStr() );
}
@@ -596,12 +596,12 @@ OUString array2String( const css::uno::Sequence< Any > &seq )
}
-std::vector< Any > parseArray( const OUString & str )
+std::vector< Any > parseArray( std::u16string_view str )
{
- int len = str.getLength();
+ size_t len = str.size();
bool doubleQuote = false;
int brackets = 0;
- int i = 0;
+ size_t i = 0;
OUStringBuffer current;
std::vector<Any> elements;
diff --git a/connectivity/source/drivers/postgresql/pq_tools.hxx b/connectivity/source/drivers/postgresql/pq_tools.hxx
index 1f9356ed41d3..8a31e207cc1b 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.hxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.hxx
@@ -106,7 +106,7 @@ bool extractBoolProperty(
void disposeNoThrow( const css::uno::Reference< css::uno::XInterface > & r );
void disposeObject( const css::uno::Reference< css::uno::XInterface > & r );
-OUString extractTableFromInsert( const OUString & sql );
+OUString extractTableFromInsert( std::u16string_view sql );
OString extractSingleTableFromSelect( const std::vector< OString > &vec );
OUString getColExprForDefaultSettingVal(ConnectionSettings const *settings);
@@ -115,7 +115,7 @@ void tokenizeSQL( const OString & sql, std::vector< OString > &vec );
void splitSQL( const OString & sql, std::vector< OString > &vec );
std::vector< sal_Int32 > parseIntArray( const OUString & str );
/// @throws css::sdbc::SQLException
-std::vector< css::uno::Any > parseArray( const OUString & str );
+std::vector< css::uno::Any > parseArray( std::u16string_view str );
OUString array2String( const css::uno::Sequence< css::uno::Any > &seq );
diff --git a/connectivity/source/inc/hsqldb/HStorageMap.hxx b/connectivity/source/inc/hsqldb/HStorageMap.hxx
index 06f31e6df326..1186c680ac07 100644
--- a/connectivity/source/inc/hsqldb/HStorageMap.hxx
+++ b/connectivity/source/inc/hsqldb/HStorageMap.hxx
@@ -86,7 +86,7 @@ namespace connectivity::hsqldb
static TStreamMap::mapped_type getRegisteredStream( JNIEnv * env, jstring name, jstring key);
static OUString jstring2ustring(JNIEnv * env, jstring jstr);
- static OUString removeURLPrefix(std::u16string_view _sURL,const OUString& _sFileURL);
+ static OUString removeURLPrefix(std::u16string_view _sURL, std::u16string_view _sFileURL);
static OUString removeOldURLPrefix(const OUString& _sURL);
static void throwJavaException(const css::uno::Exception& _aException,JNIEnv * env);
};