Skip to content
Permalink
Browse files

[oracle] Fix some clazy warnings

  • Loading branch information
nyalldawson committed Apr 22, 2018
1 parent 3032ab7 commit a2fbf5e1de3f0e1270bb86f8e4e2c461aec0b066
Showing with 19 additions and 19 deletions.
  1. +19 −19 src/providers/oracle/qgsoracleprovider.cpp
@@ -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 )
@@ -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 );
}
@@ -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 );
@@ -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() )
{
@@ -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 );
}

@@ -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 )
{
@@ -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 );
}
}
}
@@ -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() )
{

0 comments on commit a2fbf5e

Please sign in to comment.
You can’t perform that action at this time.