@@ -1933,7 +1933,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist )
1933
1933
1934
1934
QgsDebugMsg ( QString ( " prepare addfeatures: %1" ).arg ( insert ) );
1935
1935
QgsPostgresResult stmt = mConnectionRW ->PQprepare ( " addfeatures" , insert, fieldId.size () + offset - 1 , NULL );
1936
- if ( stmt.PQresultStatus () == PGRES_FATAL_ERROR )
1936
+ if ( stmt.PQresultStatus () != PGRES_COMMAND_OK )
1937
1937
throw PGException ( stmt );
1938
1938
1939
1939
for ( QgsFeatureList::iterator features = flist.begin (); features != flist.end (); features++ )
@@ -2047,7 +2047,7 @@ bool QgsPostgresProvider::deleteFeatures( const QgsFeatureIds & id )
2047
2047
2048
2048
// send DELETE statement and do error handling
2049
2049
QgsPostgresResult result = mConnectionRW ->PQexec ( sql );
2050
- if ( result.PQresultStatus () == PGRES_FATAL_ERROR )
2050
+ if ( result.PQresultStatus () != PGRES_COMMAND_OK )
2051
2051
throw PGException ( result );
2052
2052
2053
2053
QVariant v = mFidToKey [ *it ];
@@ -2105,7 +2105,7 @@ bool QgsPostgresProvider::addAttributes( const QList<QgsField> &attributes )
2105
2105
2106
2106
// send sql statement and do error handling
2107
2107
QgsPostgresResult result = mConnectionRW ->PQexec ( sql );
2108
- if ( result.PQresultStatus () == PGRES_FATAL_ERROR )
2108
+ if ( result.PQresultStatus () != PGRES_COMMAND_OK )
2109
2109
throw PGException ( result );
2110
2110
2111
2111
if ( !iter->comment ().isEmpty () )
@@ -2115,7 +2115,7 @@ bool QgsPostgresProvider::addAttributes( const QList<QgsField> &attributes )
2115
2115
.arg ( quotedIdentifier ( iter->name () ) )
2116
2116
.arg ( quotedValue ( iter->comment () ) );
2117
2117
result = mConnectionRW ->PQexec ( sql );
2118
- if ( result.PQresultStatus () == PGRES_FATAL_ERROR )
2118
+ if ( result.PQresultStatus () != PGRES_COMMAND_OK )
2119
2119
throw PGException ( result );
2120
2120
}
2121
2121
}
@@ -2160,7 +2160,7 @@ bool QgsPostgresProvider::deleteAttributes( const QgsAttributeIds& ids )
2160
2160
2161
2161
// send sql statement and do error handling
2162
2162
QgsPostgresResult result = mConnectionRW ->PQexec ( sql );
2163
- if ( result.PQresultStatus () == PGRES_FATAL_ERROR )
2163
+ if ( result.PQresultStatus () != PGRES_COMMAND_OK )
2164
2164
throw PGException ( result );
2165
2165
2166
2166
// delete the attribute from mAttributeFields
@@ -2246,7 +2246,7 @@ bool QgsPostgresProvider::changeAttributeValues( const QgsChangedAttributesMap &
2246
2246
sql += QString ( " WHERE %1" ).arg ( whereClause ( fid ) );
2247
2247
2248
2248
QgsPostgresResult result = mConnectionRW ->PQexec ( sql );
2249
- if ( result.PQresultStatus () == PGRES_FATAL_ERROR )
2249
+ if ( result.PQresultStatus () != PGRES_COMMAND_OK )
2250
2250
throw PGException ( result );
2251
2251
2252
2252
// update feature id map if key was changed
@@ -2328,7 +2328,7 @@ bool QgsPostgresProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
2328
2328
QgsDebugMsg ( " updating: " + update );
2329
2329
2330
2330
QgsPostgresResult result = mConnectionRW ->PQprepare ( " updatefeatures" , update, 2 , NULL );
2331
- if ( result.PQresultStatus () == PGRES_FATAL_ERROR )
2331
+ if ( result.PQresultStatus () != PGRES_COMMAND_OK )
2332
2332
throw PGException ( result );
2333
2333
2334
2334
for ( QgsGeometryMap::iterator iter = geometry_map.begin ();
@@ -2350,7 +2350,7 @@ bool QgsPostgresProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
2350
2350
appendPkParams ( iter.key (), params );
2351
2351
2352
2352
result = mConnectionRW ->PQexecPrepared ( " updatefeatures" , params );
2353
- if ( result.PQresultStatus () == PGRES_FATAL_ERROR )
2353
+ if ( result.PQresultStatus () != PGRES_COMMAND_OK )
2354
2354
throw PGException ( result );
2355
2355
} // for each feature
2356
2356
@@ -2398,7 +2398,7 @@ bool QgsPostgresProvider::setSubsetString( QString theSQL, bool updateFeatureCou
2398
2398
sql += " LIMIT 0" ;
2399
2399
2400
2400
QgsPostgresResult res = mConnectionRO ->PQexec ( sql );
2401
- if ( res.PQresultStatus () != PGRES_COMMAND_OK && res. PQresultStatus () != PGRES_TUPLES_OK )
2401
+ if ( res.PQresultStatus () != PGRES_TUPLES_OK )
2402
2402
{
2403
2403
pushError ( res.PQresultErrorMessage () );
2404
2404
mSqlWhereClause = prevWhere;
@@ -2936,7 +2936,7 @@ QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer(
2936
2936
.arg ( quotedValue ( schemaName ) );
2937
2937
2938
2938
QgsPostgresResult result = conn->PQexec ( sql );
2939
- if ( result.PQresultStatus () == PGRES_FATAL_ERROR )
2939
+ if ( result.PQresultStatus () != PGRES_TUPLES_OK )
2940
2940
throw PGException ( result );
2941
2941
2942
2942
bool exists = result.PQntuples () > 0 ;
@@ -2952,7 +2952,7 @@ QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer(
2952
2952
.arg ( quotedValue ( tableName ) );
2953
2953
2954
2954
result = conn->PQexec ( sql );
2955
- if ( result.PQresultStatus () == PGRES_FATAL_ERROR )
2955
+ if ( result.PQresultStatus () != PGRES_TUPLES_OK )
2956
2956
throw PGException ( result );
2957
2957
}
2958
2958
@@ -2962,7 +2962,7 @@ QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer(
2962
2962
.arg ( primaryKeyType );
2963
2963
2964
2964
result = conn->PQexec ( sql );
2965
- if ( result.PQresultStatus () == PGRES_FATAL_ERROR )
2965
+ if ( result.PQresultStatus () != PGRES_COMMAND_OK )
2966
2966
throw PGException ( result );
2967
2967
2968
2968
// get geometry type, dim and srid
@@ -2983,7 +2983,7 @@ QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer(
2983
2983
.arg ( dim );
2984
2984
2985
2985
result = conn->PQexec ( sql );
2986
- if ( result.PQresultStatus () == PGRES_FATAL_ERROR )
2986
+ if ( result.PQresultStatus () != PGRES_TUPLES_OK )
2987
2987
throw PGException ( result );
2988
2988
}
2989
2989
else
0 commit comments