@@ -101,7 +101,7 @@ QgsOracleFeatureIterator::QgsOracleFeatureIterator( QgsOracleFeatureSource *sour
101
101
" )" );
102
102
103
103
whereClause = QStringLiteral ( " sdo_filter(%1,%2)='TRUE'" )
104
- .arg ( QgsOracleProvider::quotedIdentifier ( mSource ->mGeometryColumn ) ). arg ( bbox );
104
+ .arg ( QgsOracleProvider::quotedIdentifier ( mSource ->mGeometryColumn ), bbox );
105
105
106
106
args << ( mSource ->mSrid < 1 ? QVariant ( QVariant::Int ) : mSource ->mSrid ) << mFilterRect .xMinimum () << mFilterRect .yMinimum () << mFilterRect .xMaximum () << mFilterRect .yMaximum ();
107
107
@@ -110,9 +110,9 @@ QgsOracleFeatureIterator::QgsOracleFeatureIterator( QgsOracleFeatureSource *sour
110
110
// sdo_relate requires Spatial
111
111
if ( mConnection ->hasSpatial () )
112
112
{
113
- whereClause += QString ( " AND sdo_relate(%1,%2,'mask=ANYINTERACT')='TRUE'" )
114
- .arg ( QgsOracleProvider::quotedIdentifier ( mSource ->mGeometryColumn ) )
115
- . arg ( bbox );
113
+ whereClause += QStringLiteral ( " AND sdo_relate(%1,%2,'mask=ANYINTERACT')='TRUE'" )
114
+ .arg ( QgsOracleProvider::quotedIdentifier ( mSource ->mGeometryColumn ),
115
+ bbox );
116
116
args << ( mSource ->mSrid < 1 ? QVariant ( QVariant::Int ) : mSource ->mSrid ) << mFilterRect .xMinimum () << mFilterRect .yMinimum () << mFilterRect .xMaximum () << mFilterRect .yMaximum ();
117
117
}
118
118
else
@@ -131,7 +131,7 @@ QgsOracleFeatureIterator::QgsOracleFeatureIterator( QgsOracleFeatureSource *sour
131
131
}
132
132
else if ( !mFilterRect .isNull () )
133
133
{
134
- QgsDebugMsg ( " filterRect without geometry ignored" );
134
+ QgsDebugMsg ( QStringLiteral ( " filterRect without geometry ignored" ) );
135
135
}
136
136
137
137
switch ( mRequest .filterType () )
@@ -162,16 +162,16 @@ QgsOracleFeatureIterator::QgsOracleFeatureIterator( QgsOracleFeatureSource *sour
162
162
if ( mSource ->mRequestedGeomType != QgsWkbTypes::Unknown && mSource ->mRequestedGeomType != mSource ->mDetectedGeomType )
163
163
{
164
164
if ( !whereClause.isEmpty () )
165
- whereClause += " AND " ;
165
+ whereClause += QStringLiteral ( " AND " ) ;
166
166
167
- whereClause += QgsOracleConn::databaseTypeFilter ( " FEATUREREQUEST" , mSource ->mGeometryColumn , mSource ->mRequestedGeomType );
167
+ whereClause += QgsOracleConn::databaseTypeFilter ( QStringLiteral ( " FEATUREREQUEST" ) , mSource ->mGeometryColumn , mSource ->mRequestedGeomType );
168
168
}
169
169
170
170
if ( !mSource ->mSqlWhereClause .isEmpty () )
171
171
{
172
172
if ( !whereClause.isEmpty () )
173
- whereClause += " AND " ;
174
- whereClause += " ( " + mSource ->mSqlWhereClause + " ) " ;
173
+ whereClause += QStringLiteral ( " AND " ) ;
174
+ whereClause += ' ( ' + mSource ->mSqlWhereClause + ' ) ' ;
175
175
}
176
176
177
177
// NOTE - must be last added!
@@ -181,7 +181,7 @@ QgsOracleFeatureIterator::QgsOracleFeatureIterator( QgsOracleFeatureSource *sour
181
181
bool useFallback = false ;
182
182
if ( request.filterType () == QgsFeatureRequest::FilterExpression )
183
183
{
184
- if ( QgsSettings ().value ( " qgis/compileExpressions" , true ).toBool () )
184
+ if ( QgsSettings ().value ( QStringLiteral ( " qgis/compileExpressions" ) , true ).toBool () )
185
185
{
186
186
QgsOracleExpressionCompiler compiler ( mSource );
187
187
QgsSqlExpressionCompiler::Result result = compiler.compile ( mRequest .filterExpression () );
@@ -215,7 +215,7 @@ QgsOracleFeatureIterator::QgsOracleFeatureIterator( QgsOracleFeatureSource *sour
215
215
if ( mRequest .limit () >= 0 && limitAtProvider )
216
216
{
217
217
if ( !whereClause.isEmpty () )
218
- whereClause += " AND " ;
218
+ whereClause += QStringLiteral ( " AND " ) ;
219
219
220
220
whereClause += QStringLiteral ( " rownum<=?" );
221
221
fallbackStatement += QStringLiteral ( " rownum<=?" );
@@ -265,8 +265,8 @@ bool QgsOracleFeatureIterator::fetchFeature( QgsFeature &feature )
265
265
if ( !QgsOracleProvider::exec ( mQry , mSql , mArgs ) )
266
266
{
267
267
QgsMessageLog::logMessage ( QObject::tr ( " Fetching features failed.\n SQL: %1\n Error: %2" )
268
- .arg ( mQry .lastQuery () )
269
- . arg ( mQry .lastError ().text () ),
268
+ .arg ( mQry .lastQuery (),
269
+ mQry .lastError ().text () ),
270
270
QObject::tr ( " Oracle" ) );
271
271
return false ;
272
272
}
@@ -296,7 +296,7 @@ bool QgsOracleFeatureIterator::fetchFeature( QgsFeature &feature )
296
296
{
297
297
if ( !feature.hasGeometry () )
298
298
{
299
- QgsDebugMsg ( " no geometry to intersect" );
299
+ QgsDebugMsg ( QStringLiteral ( " no geometry to intersect" ) );
300
300
continue ;
301
301
}
302
302
@@ -309,7 +309,7 @@ bool QgsOracleFeatureIterator::fetchFeature( QgsFeature &feature )
309
309
if ( !feature.geometry ().boundingBox ().intersects ( mFilterRect ) )
310
310
{
311
311
// skip feature that don't intersect with our rectangle
312
- QgsDebugMsg ( " no bbox intersect" );
312
+ QgsDebugMsg ( QStringLiteral ( " no bbox intersect" ) );
313
313
continue ;
314
314
}
315
315
}
@@ -320,7 +320,7 @@ bool QgsOracleFeatureIterator::fetchFeature( QgsFeature &feature )
320
320
if ( !feature.geometry ().intersects ( mFilterRect ) )
321
321
{
322
322
// skip feature that don't intersect with our rectangle
323
- QgsDebugMsg ( " no exact intersect" );
323
+ QgsDebugMsg ( QStringLiteral ( " no exact intersect" ) );
324
324
continue ;
325
325
}
326
326
}
@@ -334,15 +334,14 @@ bool QgsOracleFeatureIterator::fetchFeature( QgsFeature &feature )
334
334
case PktInt:
335
335
// get 64bit integer from result
336
336
fid = mQry .value ( col++ ).toLongLong ();
337
- if ( mAttributeList .contains ( mSource ->mPrimaryKeyAttrs [ 0 ] ) )
338
- feature.setAttribute ( mSource ->mPrimaryKeyAttrs [ 0 ] , fid );
337
+ if ( mAttributeList .contains ( mSource ->mPrimaryKeyAttrs . value ( 0 ) ) )
338
+ feature.setAttribute ( mSource ->mPrimaryKeyAttrs . value ( 0 ) , fid );
339
339
break ;
340
340
341
341
case PktRowId:
342
342
case PktFidMap:
343
343
{
344
344
QVariantList primaryKeyVals;
345
-
346
345
if ( mSource ->mPrimaryKeyType == PktFidMap )
347
346
{
348
347
Q_FOREACH ( int idx, mSource ->mPrimaryKeyAttrs )
@@ -375,7 +374,7 @@ bool QgsOracleFeatureIterator::fetchFeature( QgsFeature &feature )
375
374
}
376
375
377
376
feature.setId ( fid );
378
- QgsDebugMsgLevel ( QString ( " fid=%1" ).arg ( fid ), 5 );
377
+ QgsDebugMsgLevel ( QStringLiteral ( " fid=%1" ).arg ( fid ), 5 );
379
378
380
379
// iterate attributes
381
380
Q_FOREACH ( int idx, mAttributeList )
@@ -386,7 +385,7 @@ bool QgsOracleFeatureIterator::fetchFeature( QgsFeature &feature )
386
385
QgsField fld = mSource ->mFields .at ( idx );
387
386
388
387
QVariant v = mQry .value ( col );
389
- if ( fld.type () == QVariant::ByteArray && fld.typeName ().endsWith ( " .SDO_GEOMETRY" ) )
388
+ if ( fld.type () == QVariant::ByteArray && fld.typeName ().endsWith ( QStringLiteral ( " .SDO_GEOMETRY" ) ) )
390
389
{
391
390
QByteArray ba ( v.toByteArray () );
392
391
if ( ba.size () > 0 )
@@ -440,42 +439,42 @@ bool QgsOracleFeatureIterator::close()
440
439
return true ;
441
440
}
442
441
443
- bool QgsOracleFeatureIterator::openQuery ( QString whereClause, QVariantList args, bool showLog )
442
+ bool QgsOracleFeatureIterator::openQuery ( const QString & whereClause, const QVariantList & args, bool showLog )
444
443
{
445
444
try
446
445
{
447
- QString query = " SELECT " , delim = " " ;
446
+ QString query = QStringLiteral ( " SELECT " );
447
+ QString delim;
448
448
449
449
if ( mFetchGeometry )
450
450
{
451
451
query += QgsOracleProvider::quotedIdentifier ( mSource ->mGeometryColumn );
452
- delim = " , " ;
452
+ delim = ' , ' ;
453
453
}
454
454
455
455
switch ( mSource ->mPrimaryKeyType )
456
456
{
457
457
case PktRowId:
458
- query += delim + QgsOracleProvider::quotedIdentifier ( " ROWID" );
459
- delim = " , " ;
458
+ query += delim + QgsOracleProvider::quotedIdentifier ( QStringLiteral ( " ROWID" ) );
459
+ delim = ' , ' ;
460
460
break ;
461
461
462
462
case PktInt:
463
463
query += delim + QgsOracleProvider::quotedIdentifier ( mSource ->mFields .at ( mSource ->mPrimaryKeyAttrs [0 ] ).name () );
464
- delim = " , " ;
464
+ delim = ' , ' ;
465
465
break ;
466
466
467
467
case PktFidMap:
468
468
Q_FOREACH ( int idx, mSource ->mPrimaryKeyAttrs )
469
469
{
470
470
query += delim + mConnection ->fieldExpression ( mSource ->mFields .at ( idx ) );
471
- delim = " , " ;
471
+ delim = ' , ' ;
472
472
}
473
473
break ;
474
474
475
475
case PktUnknown:
476
- QgsDebugMsg ( " Cannot query without primary key." );
476
+ QgsDebugMsg ( QStringLiteral ( " Cannot query without primary key." ) );
477
477
return false ;
478
- break ;
479
478
}
480
479
481
480
Q_FOREACH ( int idx, mAttributeList )
@@ -486,21 +485,21 @@ bool QgsOracleFeatureIterator::openQuery( QString whereClause, QVariantList args
486
485
query += delim + mConnection ->fieldExpression ( mSource ->mFields .at ( idx ) );
487
486
}
488
487
489
- query += QString ( " FROM %1 \" FEATUREREQUEST\" " ).arg ( mSource ->mQuery );
488
+ query += QStringLiteral ( " FROM %1 \" FEATUREREQUEST\" " ).arg ( mSource ->mQuery );
490
489
491
490
if ( !whereClause.isEmpty () )
492
- query += QString ( " WHERE %1" ).arg ( whereClause );
491
+ query += QStringLiteral ( " WHERE %1" ).arg ( whereClause );
493
492
494
- QgsDebugMsg ( QString ( " Fetch features: %1" ).arg ( query ) );
493
+ QgsDebugMsg ( QStringLiteral ( " Fetch features: %1" ).arg ( query ) );
495
494
mSql = query;
496
495
mArgs = args;
497
496
if ( !QgsOracleProvider::exec ( mQry , query, args ) )
498
497
{
499
498
if ( showLog )
500
499
{
501
500
QgsMessageLog::logMessage ( QObject::tr ( " Fetching features failed.\n SQL: %1\n Error: %2" )
502
- .arg ( mQry .lastQuery () )
503
- . arg ( mQry .lastError ().text () ),
501
+ .arg ( mQry .lastQuery (),
502
+ mQry .lastError ().text () ),
504
503
QObject::tr ( " Oracle" ) );
505
504
}
506
505
return false ;
0 commit comments