Skip to content

Commit

Permalink
[oracle] Fix some clazy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 22, 2018
1 parent 3032ab7 commit a2fbf5e
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/providers/oracle/qgsoracleprovider.cpp
Expand Up @@ -1187,7 +1187,7 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist, QgsFeatureSink::Flag

bool returnvalue = true;

if ( !( flags & QgsFeatureSink::FastInsert ) && !getWorkspace().isEmpty() && getWorkspace().toUpper() != "LIVE" )
if ( !( flags & QgsFeatureSink::FastInsert ) && !getWorkspace().isEmpty() && getWorkspace().compare( QStringLiteral( "LIVE" ), Qt::CaseInsensitive ) != 0 )
{
static bool warn = true;
if ( warn )
Expand All @@ -1210,37 +1210,37 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist, QgsFeatureSink::Flag
}

// Prepare the INSERT statement
QString insert = QString( "INSERT INTO %1(" ).arg( mQuery );
QString values = ") VALUES (";
QString delim = "";
QString insert = QStringLiteral( "INSERT INTO %1(" ).arg( mQuery );
QString values = QStringLiteral( ") VALUES (" );
QString delim;

QStringList defaultValues;
QList<int> fieldId;

if ( !mGeometryColumn.isNull() )
{
insert += quotedIdentifier( mGeometryColumn );
values += "?";
delim = ",";
values += '?';
delim = ',';
}

if ( mPrimaryKeyType == PktInt || mPrimaryKeyType == PktFidMap )
{
QString keys, kdelim = "";
QString keys, kdelim;

Q_FOREACH ( int idx, mPrimaryKeyAttrs )
{
QgsField fld = field( idx );
insert += delim + quotedIdentifier( fld.name() );
keys += kdelim + quotedIdentifier( fld.name() );
values += delim + "?";
delim = ",";
kdelim = ",";
values += delim + '?';
delim = ',';
kdelim = ',';
fieldId << idx;
defaultValues << defaultValue( idx ).toString();
}

if ( !getfid.prepare( QString( "SELECT %1 FROM %2 WHERE ROWID=?" ).arg( keys ).arg( mQuery ) ) )
if ( !getfid.prepare( QStringLiteral( "SELECT %1 FROM %2 WHERE ROWID=?" ).arg( keys ).arg( mQuery ) ) )
{
throw OracleException( tr( "Could not prepare get feature id statement" ), getfid );
}
Expand Down Expand Up @@ -1270,16 +1270,16 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist, QgsFeatureSink::Flag

QString defVal = defaultValue( idx ).toString();

values += delim + "?";
values += delim + '?';
defaultValues.append( defVal );
fieldId.append( idx );

delim = ",";
delim = ',';
}

insert += values + ")";

QgsDebugMsgLevel( QString( "SQL prepare: %1" ).arg( insert ), 4 );
QgsDebugMsgLevel( QStringLiteral( "SQL prepare: %1" ).arg( insert ), 4 );
if ( !ins.prepare( insert ) )
{
throw OracleException( tr( "Could not prepare insert statement" ), ins );
Expand All @@ -1289,7 +1289,7 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist, QgsFeatureSink::Flag
{
QgsAttributes attributevec = features->attributes();

QgsDebugMsgLevel( QString( "insert feature %1" ).arg( features->id() ), 4 );
QgsDebugMsgLevel( QStringLiteral( "insert feature %1" ).arg( features->id() ), 4 );

if ( !mGeometryColumn.isNull() )
{
Expand Down Expand Up @@ -1318,7 +1318,7 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist, QgsFeatureSink::Flag
}
}

QgsDebugMsgLevel( QString( "addBindValue: %1" ).arg( v ), 4 );
QgsDebugMsgLevel( QStringLiteral( "addBindValue: %1" ).arg( v ), 4 );
ins.addBindValue( v );
}

Expand All @@ -1330,7 +1330,7 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist, QgsFeatureSink::Flag
if ( mPrimaryKeyType == PktRowId )
{
features->setId( mShared->lookupFid( QList<QVariant>() << QVariant( ins.lastInsertId() ) ) );
QgsDebugMsgLevel( QString( "new fid=%1" ).arg( features->id() ), 4 );
QgsDebugMsgLevel( QStringLiteral( "new fid=%1" ).arg( features->id() ), 4 );
}
else if ( mPrimaryKeyType == PktInt || mPrimaryKeyType == PktFidMap )
{
Expand Down Expand Up @@ -1383,7 +1383,7 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist, QgsFeatureSink::Flag

features->setId( mShared->lookupFid( primaryKeyVals ) );
}
QgsDebugMsgLevel( QString( "new fid=%1" ).arg( features->id() ), 4 );
QgsDebugMsgLevel( QStringLiteral( "new fid=%1" ).arg( features->id() ), 4 );
}
}
}
Expand All @@ -1392,7 +1392,7 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist, QgsFeatureSink::Flag
}
catch ( OracleException &e )
{
QgsDebugMsg( QString( "Oracle error: %1" ).arg( e.errorMessage() ) );
QgsDebugMsg( QStringLiteral( "Oracle error: %1" ).arg( e.errorMessage() ) );
pushError( tr( "Oracle error while adding features: %1" ).arg( e.errorMessage() ) );
if ( !db.rollback() )
{
Expand Down

0 comments on commit a2fbf5e

Please sign in to comment.