Skip to content

Commit 8a51e08

Browse files
committed
[oracle] Fix minor Coverity issues
(cherry-picked from b94fbc0)
1 parent 8d30b36 commit 8a51e08

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

src/providers/oracle/qgsoracleconn.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ QMap<QString, QgsOracleConn *> QgsOracleConn::sConnections;
3131
int QgsOracleConn::snConnections = 0;
3232
const int QgsOracleConn::sGeomTypeSelectLimit = 100;
3333

34-
QgsOracleConn *QgsOracleConn::connectDb( QgsDataSourceURI uri )
34+
QgsOracleConn *QgsOracleConn::connectDb( const QgsDataSourceURI& uri )
3535
{
3636
QString conninfo = uri.connectionInfo();
3737

src/providers/oracle/qgsoracleconn.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ struct QgsOracleLayerProperty
4545
QStringList pkCols;
4646
QString sql;
4747

48+
QgsOracleLayerProperty()
49+
: isView( false )
50+
{}
51+
4852
int size() const { Q_ASSERT( types.size() == srids.size() ); return types.size(); }
4953

5054
bool operator==( const QgsOracleLayerProperty& other )
@@ -107,7 +111,7 @@ class QgsOracleConn : public QObject
107111
{
108112
Q_OBJECT
109113
public:
110-
static QgsOracleConn *connectDb( QgsDataSourceURI uri );
114+
static QgsOracleConn *connectDb( const QgsDataSourceURI &uri );
111115
void disconnect();
112116

113117
/** Double quote a Oracle identifier for placement in a SQL string.

src/providers/oracle/qgsoracleconnpool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ inline QString qgsConnectionPool_ConnectionToName( QgsOracleConn* c )
2525
return c->connInfo();
2626
}
2727

28-
inline void qgsConnectionPool_ConnectionCreate( QgsDataSourceURI uri, QgsOracleConn*& c )
28+
inline void qgsConnectionPool_ConnectionCreate( const QgsDataSourceURI& uri, QgsOracleConn*& c )
2929
{
3030
c = QgsOracleConn::connectDb( uri );
3131
}

src/providers/oracle/qgsoracleprovider.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,7 +1772,6 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry
17721772
g.eleminfo.clear();
17731773
g.ordinates.clear();
17741774

1775-
QString expr;
17761775
int iOrdinate = 1;
17771776
QGis::WkbType type = ( QGis::WkbType ) * ptr.iPtr++;
17781777
int dim = 2;
@@ -1781,6 +1780,8 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry
17811780
{
17821781
case QGis::WKBPoint25D:
17831782
dim = 3;
1783+
FALLTHROUGH;
1784+
17841785
case QGis::WKBPoint:
17851786
g.srid = mSrid;
17861787
g.gtype = SDO_GTYPE( dim, gtPoint );
@@ -1792,6 +1793,8 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry
17921793
case QGis::WKBLineString25D:
17931794
case QGis::WKBMultiLineString25D:
17941795
dim = 3;
1796+
FALLTHROUGH;
1797+
17951798
case QGis::WKBLineString:
17961799
case QGis::WKBMultiLineString:
17971800
{
@@ -1827,6 +1830,8 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry
18271830
case QGis::WKBPolygon25D:
18281831
case QGis::WKBMultiPolygon25D:
18291832
dim = 3;
1833+
FALLTHROUGH;
1834+
18301835
case QGis::WKBPolygon:
18311836
case QGis::WKBMultiPolygon:
18321837
{
@@ -1866,6 +1871,8 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry
18661871

18671872
case QGis::WKBMultiPoint25D:
18681873
dim = 3;
1874+
FALLTHROUGH;
1875+
18691876
case QGis::WKBMultiPoint:
18701877
{
18711878
g.gtype = SDO_GTYPE( dim, gtMultiPoint );
@@ -2734,7 +2741,7 @@ QgsVectorLayerImport::ImportError QgsOracleProvider::createEmptyLayer(
27342741

27352742
QgsDebugMsg( QString( "layer %1 created" ).arg( ownerTableName ) );
27362743

2737-
// use the provider to edit the table
2744+
// use the provider to edit the table1
27382745
dsUri.setDataSource( ownerName, tableName, geometryColumn, QString(), primaryKey );
27392746
QgsOracleProvider *provider = new QgsOracleProvider( dsUri.uri() );
27402747
if ( !provider->isValid() )
@@ -2749,8 +2756,7 @@ QgsVectorLayerImport::ImportError QgsOracleProvider::createEmptyLayer(
27492756
QgsDebugMsg( "layer loaded" );
27502757

27512758
// add fields to the layer
2752-
if ( oldToNewAttrIdxMap )
2753-
oldToNewAttrIdxMap->clear();
2759+
oldToNewAttrIdxMap->clear();
27542760

27552761
if ( fields.size() > 0 )
27562762
{

src/providers/oracle/qgsoracleprovider.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ class QgsOracleProvider : public QgsVectorDataProvider
400400
QgsFeatureId mFidCounter; //! next feature id if map is used
401401
QgsOracleConn *mConnection;
402402

403-
bool mHasSpatial; //! Oracle Spatial is installed
404403
bool mHasSpatialIndex; //! Geometry column is indexed
405404
QString mSpatialIndexName; //! name of spatial index of geometry column
406405

0 commit comments

Comments
 (0)