summaryrefslogtreecommitdiffstats
path: root/connectivity
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-05-18 09:18:34 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-05-18 13:18:38 +0200
commit454eb3bc05f861712bff0f7593f9aa9809e4ee7c (patch)
treeea5ca6dbd4efe716bcdcb9ae196849053235c8af /connectivity
parentRevert "make: map slowcheck to gbuild's build and slowcheck" (diff)
downloadcore-454eb3bc05f861712bff0f7593f9aa9809e4ee7c.tar.gz
core-454eb3bc05f861712bff0f7593f9aa9809e4ee7c.zip
use for-range on Sequence in cli_ure..connectivity
Change-Id: Ic5254e402d153a13c29928b59738cbe1603d0139 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94399 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/commontools/dbtools.cxx13
-rw-r--r--connectivity/source/drivers/firebird/DatabaseMetaData.cxx8
-rw-r--r--connectivity/source/drivers/flat/ETable.cxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_connection.cxx8
-rw-r--r--connectivity/source/drivers/postgresql/pq_statement.cxx8
-rw-r--r--connectivity/source/drivers/postgresql/pq_xbase.cxx8
6 files changed, 23 insertions, 24 deletions
diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx
index a16549ba3b50..419cd26e7c07 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -946,11 +946,10 @@ try
Reference< XPropertySetInfo> xOldInfo( xOldProps->getPropertySetInfo());
Reference< XPropertySetInfo> xNewInfo( xNewProps->getPropertySetInfo());
- Sequence< Property> aOldProperties = xOldInfo->getProperties();
+ const Sequence< Property> aOldProperties = xOldInfo->getProperties();
Sequence< Property> aNewProperties = xNewInfo->getProperties();
int nNewLen = aNewProperties.getLength();
- Property* pOldProps = aOldProperties.getArray();
Property* pNewProps = aNewProperties.getArray();
OUString sPropFormatsSupplier("FormatsSupplier");
@@ -968,18 +967,18 @@ try
OUString sPropClassId("ClassId");
OUString sFormattedServiceName( "com.sun.star.form.component.FormattedField" );
- for (sal_Int32 i=0; i<aOldProperties.getLength(); ++i)
+ for (const Property& rOldProp : aOldProperties)
{
- if ( pOldProps[i].Name != "DefaultControl" && pOldProps[i].Name != "LabelControl" )
+ if ( rOldProp.Name != "DefaultControl" && rOldProp.Name != "LabelControl" )
{
// binary search
Property* pResult = std::lower_bound(
- pNewProps, pNewProps + nNewLen, pOldProps[i], ::comphelper::PropertyCompareByName());
+ pNewProps, pNewProps + nNewLen, rOldProp, ::comphelper::PropertyCompareByName());
if ( ( pResult != aNewProperties.end() )
- && ( pResult->Name == pOldProps[i].Name )
+ && ( pResult->Name == rOldProp.Name )
&& ( (pResult->Attributes & PropertyAttribute::READONLY) == 0 )
- && ( pResult->Type.equals(pOldProps[i].Type)) )
+ && ( pResult->Type.equals(rOldProp.Type)) )
{ // Attributes match and the property is not read-only
try
{
diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index 661dd7dc95d0..3823e7874f34 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -1338,13 +1338,13 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
else
{
queryBuf.append("( (0 = 1) ");
- for (int i = 0; i < types.getLength(); i++)
+ for (OUString const & t : types)
{
- if (types[i] == "SYSTEM TABLE")
+ if (t == "SYSTEM TABLE")
queryBuf.append("OR (RDB$SYSTEM_FLAG = 1 AND RDB$VIEW_BLR IS NULL) ");
- else if (types[i] == "TABLE")
+ else if (t == "TABLE")
queryBuf.append("OR (RDB$SYSTEM_FLAG IS NULL OR RDB$SYSTEM_FLAG = 0 AND RDB$VIEW_BLR IS NULL) ");
- else if (types[i] == "VIEW")
+ else if (t == "VIEW")
queryBuf.append("OR (RDB$SYSTEM_FLAG IS NULL OR RDB$SYSTEM_FLAG = 0 AND RDB$VIEW_BLR IS NOT NULL) ");
else
throw SQLException(); // TODO: implement other types, see above.
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index 43bc75225b1d..0dceba05b641 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -662,7 +662,7 @@ bool OFlatTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool
}
else
aBuf.append(cChar);
- } // for (j = 0; j < aStr.getLength(); ++j)
+ } // for (j = 0; j < aStr.(); ++j)
aStrConverted = aBuf.makeStringAndClear();
} // if ( DataType::INTEGER != nType )
else
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx
index fd1b9fd1297d..66c30c893aed 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -397,12 +397,12 @@ static void properties2arrays( const Sequence< PropertyValue > & args,
"requiressl"
};
- for( int i = 0; i < args.getLength() ; ++i )
+ for( PropertyValue const & prop : args )
{
bool append = false;
for(const char* j : keyword_list)
{
- if( args[i].Name.equalsIgnoreAsciiCaseAscii( j ))
+ if( prop.Name.equalsIgnoreAsciiCaseAscii( j ))
{
keywords.push_back( j, SAL_NO_ACQUIRE );
append = true;
@@ -413,14 +413,14 @@ static void properties2arrays( const Sequence< PropertyValue > & args,
if( append )
{
OUString value;
- tc->convertTo( args[i].Value, cppu::UnoType<decltype(value)>::get() ) >>= value;
+ tc->convertTo( prop.Value, cppu::UnoType<decltype(value)>::get() ) >>= value;
char *v = strdup(OUStringToOString(value, enc).getStr());
values.push_back ( v );
}
else
{
// ignore for now
- SAL_WARN("connectivity.postgresql", "sdbc-postgresql: unknown argument '" << args[i].Name << "' having value: " << args[i].Value );
+ SAL_WARN("connectivity.postgresql", "sdbc-postgresql: unknown argument '" << prop.Name << "' having value: " << prop.Value );
}
}
}
diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx
index 6c2deef8fe0f..dd7ab576b37f 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.cxx
@@ -637,7 +637,7 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert(
// TODO: make also unqualified tables names work here. Have a look at 2.8.3. The Schema Search Path
// in postgresql doc
- Sequence< OUString > keyColumnNames = getPrimaryKeyColumnNames( connection, schemaName, tableName );
+ const Sequence< OUString > keyColumnNames = getPrimaryKeyColumnNames( connection, schemaName, tableName );
if( keyColumnNames.hasElements() )
{
OUStringBuffer buf( 128 );
@@ -646,10 +646,10 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert(
buf.append( " WHERE " );
bool bAdditionalCondition = false;
String2StringMap autoValues;
- for( int i = 0 ; i < keyColumnNames.getLength() ; i ++ )
+ for( OUString const & columnNameUnicode : keyColumnNames )
{
OUString value;
- OString columnName = OUStringToOString( keyColumnNames[i], ConnectionSettings::encoding );
+ OString columnName = OUStringToOString( columnNameUnicode, ConnectionSettings::encoding );
bool bColumnMatchNamedValue = false;
for (auto const& namedValue : namedValues)
{
@@ -701,7 +701,7 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert(
if( bAdditionalCondition )
buf.append( " AND " );
- bufferQuoteIdentifier( buf, keyColumnNames[i], pConnectionSettings );
+ bufferQuoteIdentifier( buf, columnNameUnicode, pConnectionSettings );
buf.append( " = " );
buf.append( value );
bAdditionalCondition = true;
diff --git a/connectivity/source/drivers/postgresql/pq_xbase.cxx b/connectivity/source/drivers/postgresql/pq_xbase.cxx
index 377b3dd4b99b..1fec4130a9db 100644
--- a/connectivity/source/drivers/postgresql/pq_xbase.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xbase.cxx
@@ -178,12 +178,12 @@ void ReflectionBase::copyValuesFrom( const Reference< XPropertySet > & set )
{
Reference< XPropertySetInfo > myPropInfo = getPropertySetInfo();
- Sequence< Property > props = info->getProperties();
- for( int i = 0 ; i < props.getLength() ; i ++ )
+ const Sequence< Property > props = info->getProperties();
+ for( Property const & prop : props )
{
- if( myPropInfo->hasPropertyByName( props[i].Name ) )
+ if( myPropInfo->hasPropertyByName( prop.Name ) )
setPropertyValue_NoBroadcast_public(
- props[i].Name, set->getPropertyValue( props[i].Name ) );
+ prop.Name, set->getPropertyValue( prop.Name ) );
}
}
}