Skip to content
Permalink
Browse files

[oracle] Fix minor Coverity issues

(cherry-picked from b94fbc0)
  • Loading branch information
nyalldawson committed Jul 19, 2016
1 parent 8d30b36 commit 8a51e08a6db7f31e62fcca5a68f1a2d702fd65a4
@@ -31,7 +31,7 @@ QMap<QString, QgsOracleConn *> QgsOracleConn::sConnections;
int QgsOracleConn::snConnections = 0;
const int QgsOracleConn::sGeomTypeSelectLimit = 100;

QgsOracleConn *QgsOracleConn::connectDb( QgsDataSourceURI uri )
QgsOracleConn *QgsOracleConn::connectDb( const QgsDataSourceURI& uri )
{
QString conninfo = uri.connectionInfo();

@@ -45,6 +45,10 @@ struct QgsOracleLayerProperty
QStringList pkCols;
QString sql;

QgsOracleLayerProperty()
: isView( false )
{}

int size() const { Q_ASSERT( types.size() == srids.size() ); return types.size(); }

bool operator==( const QgsOracleLayerProperty& other )
@@ -107,7 +111,7 @@ class QgsOracleConn : public QObject
{
Q_OBJECT
public:
static QgsOracleConn *connectDb( QgsDataSourceURI uri );
static QgsOracleConn *connectDb( const QgsDataSourceURI &uri );
void disconnect();

/** Double quote a Oracle identifier for placement in a SQL string.
@@ -25,7 +25,7 @@ inline QString qgsConnectionPool_ConnectionToName( QgsOracleConn* c )
return c->connInfo();
}

inline void qgsConnectionPool_ConnectionCreate( QgsDataSourceURI uri, QgsOracleConn*& c )
inline void qgsConnectionPool_ConnectionCreate( const QgsDataSourceURI& uri, QgsOracleConn*& c )
{
c = QgsOracleConn::connectDb( uri );
}
@@ -1772,7 +1772,6 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry
g.eleminfo.clear();
g.ordinates.clear();

QString expr;
int iOrdinate = 1;
QGis::WkbType type = ( QGis::WkbType ) * ptr.iPtr++;
int dim = 2;
@@ -1781,6 +1780,8 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry
{
case QGis::WKBPoint25D:
dim = 3;
FALLTHROUGH;

case QGis::WKBPoint:
g.srid = mSrid;
g.gtype = SDO_GTYPE( dim, gtPoint );
@@ -1792,6 +1793,8 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry
case QGis::WKBLineString25D:
case QGis::WKBMultiLineString25D:
dim = 3;
FALLTHROUGH;

case QGis::WKBLineString:
case QGis::WKBMultiLineString:
{
@@ -1827,6 +1830,8 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry
case QGis::WKBPolygon25D:
case QGis::WKBMultiPolygon25D:
dim = 3;
FALLTHROUGH;

case QGis::WKBPolygon:
case QGis::WKBMultiPolygon:
{
@@ -1866,6 +1871,8 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry

case QGis::WKBMultiPoint25D:
dim = 3;
FALLTHROUGH;

case QGis::WKBMultiPoint:
{
g.gtype = SDO_GTYPE( dim, gtMultiPoint );
@@ -2734,7 +2741,7 @@ QgsVectorLayerImport::ImportError QgsOracleProvider::createEmptyLayer(

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

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

// add fields to the layer
if ( oldToNewAttrIdxMap )
oldToNewAttrIdxMap->clear();
oldToNewAttrIdxMap->clear();

if ( fields.size() > 0 )
{
@@ -400,7 +400,6 @@ class QgsOracleProvider : public QgsVectorDataProvider
QgsFeatureId mFidCounter; //! next feature id if map is used
QgsOracleConn *mConnection;

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

0 comments on commit 8a51e08

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