Skip to content

Commit 09cc759

Browse files
committedJul 19, 2016
[oracle] Fix minor Coverity issues
(cherry-picked from b94fbc0)
1 parent 8784312 commit 09cc759

File tree

5 files changed

+19
-10
lines changed

5 files changed

+19
-10
lines changed
 

‎src/providers/oracle/qgsoracleconn.cpp

Lines changed: 2 additions & 2 deletions
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 = toPoolName( uri );
3737
if ( sConnections.contains( conninfo ) )
@@ -140,7 +140,7 @@ QgsOracleConn::~QgsOracleConn()
140140
mDatabase.close();
141141
}
142142

143-
QString QgsOracleConn::toPoolName( QgsDataSourceURI uri )
143+
QString QgsOracleConn::toPoolName( const QgsDataSourceURI &uri )
144144
{
145145
QString conninfo = uri.connectionInfo();
146146
if ( uri.hasParam( "dbworkspace" ) )

‎src/providers/oracle/qgsoracleconn.h

Lines changed: 6 additions & 2 deletions
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.
@@ -160,7 +164,7 @@ class QgsOracleConn : public QObject
160164
static bool onlyExistingTypes( QString theConnName );
161165
static void deleteConnection( QString theConnName );
162166
static QString databaseName( QString database, QString host, QString port );
163-
static QString toPoolName( QgsDataSourceURI uri );
167+
static QString toPoolName( const QgsDataSourceURI& uri );
164168

165169
operator QSqlDatabase() { return mDatabase; }
166170

‎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
@@ -1863,7 +1863,6 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry
18631863
g.eleminfo.clear();
18641864
g.ordinates.clear();
18651865

1866-
QString expr;
18671866
int iOrdinate = 1;
18681867
QGis::WkbType type = ( QGis::WkbType ) * ptr.iPtr++;
18691868
int dim = 2;
@@ -1872,6 +1871,8 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry
18721871
{
18731872
case QGis::WKBPoint25D:
18741873
dim = 3;
1874+
FALLTHROUGH;
1875+
18751876
case QGis::WKBPoint:
18761877
g.srid = mSrid;
18771878
g.gtype = SDO_GTYPE( dim, gtPoint );
@@ -1883,6 +1884,8 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry
18831884
case QGis::WKBLineString25D:
18841885
case QGis::WKBMultiLineString25D:
18851886
dim = 3;
1887+
FALLTHROUGH;
1888+
18861889
case QGis::WKBLineString:
18871890
case QGis::WKBMultiLineString:
18881891
{
@@ -1918,6 +1921,8 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry
19181921
case QGis::WKBPolygon25D:
19191922
case QGis::WKBMultiPolygon25D:
19201923
dim = 3;
1924+
FALLTHROUGH;
1925+
19211926
case QGis::WKBPolygon:
19221927
case QGis::WKBMultiPolygon:
19231928
{
@@ -1957,6 +1962,8 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry
19571962

19581963
case QGis::WKBMultiPoint25D:
19591964
dim = 3;
1965+
FALLTHROUGH;
1966+
19601967
case QGis::WKBMultiPoint:
19611968
{
19621969
g.gtype = SDO_GTYPE( dim, gtMultiPoint );
@@ -2830,7 +2837,7 @@ QgsVectorLayerImport::ImportError QgsOracleProvider::createEmptyLayer(
28302837

28312838
QgsDebugMsg( QString( "layer %1 created" ).arg( ownerTableName ) );
28322839

2833-
// use the provider to edit the table
2840+
// use the provider to edit the table1
28342841
dsUri.setDataSource( ownerName, tableName, geometryColumn, QString(), primaryKey );
28352842
QgsOracleProvider *provider = new QgsOracleProvider( dsUri.uri() );
28362843
if ( !provider->isValid() )
@@ -2845,8 +2852,7 @@ QgsVectorLayerImport::ImportError QgsOracleProvider::createEmptyLayer(
28452852
QgsDebugMsg( "layer loaded" );
28462853

28472854
// add fields to the layer
2848-
if ( oldToNewAttrIdxMap )
2849-
oldToNewAttrIdxMap->clear();
2855+
oldToNewAttrIdxMap->clear();
28502856

28512857
if ( fields.size() > 0 )
28522858
{

‎src/providers/oracle/qgsoracleprovider.h

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

413-
bool mHasSpatial; //! Oracle Spatial is installed
414413
bool mHasSpatialIndex; //! Geometry column is indexed
415414
QString mSpatialIndexName; //! name of spatial index of geometry column
416415

0 commit comments

Comments
 (0)