@@ -411,11 +411,18 @@ QgsSpatiaLiteProvider::createEmptyLayer(
411
411
412
412
QgsSpatiaLiteProvider::QgsSpatiaLiteProvider ( QString const &uri )
413
413
: QgsVectorDataProvider( uri )
414
+ , valid( false )
415
+ , isQuery( false )
416
+ , mTableBased( false )
417
+ , mViewBased( false )
418
+ , mVShapeBased( false )
419
+ , mReadOnly( false )
414
420
, geomType( QGis::WKBUnknown )
415
421
, sqliteHandle( NULL )
416
422
, mSrid( -1 )
417
423
, spatialIndexRTree( false )
418
424
, spatialIndexMbrCache( false )
425
+ , enabledCapabilities( 0 )
419
426
, mGotSpatialiteVersion( false )
420
427
, mSpatialiteVersionMajor( 0 )
421
428
, mSpatialiteVersionMinor( 0 )
@@ -433,11 +440,9 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
433
440
434
441
// trying to open the SQLite DB
435
442
spatialite_init ( 0 );
436
- valid = true ;
437
443
handle = QgsSqliteHandle::openDb ( mSqlitePath );
438
444
if ( handle == NULL )
439
445
{
440
- valid = false ;
441
446
return ;
442
447
}
443
448
sqliteHandle = handle->handle ();
@@ -486,7 +491,6 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
486
491
{
487
492
// invalid metadata
488
493
numberFeatures = 0 ;
489
- valid = false ;
490
494
491
495
QgsDebugMsg ( " Invalid SpatiaLite layer" );
492
496
closeDb ();
@@ -514,7 +518,6 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
514
518
{
515
519
// the table is not a geometry table
516
520
numberFeatures = 0 ;
517
- valid = false ;
518
521
QgsDebugMsg ( " Invalid SpatiaLite layer" );
519
522
closeDb ();
520
523
gaiaFreeVectorLayersList ( list );
@@ -523,7 +526,6 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
523
526
if ( !getTableSummaryAbstractInterface ( lyr ) ) // gets the extent and feature count
524
527
{
525
528
numberFeatures = 0 ;
526
- valid = false ;
527
529
QgsDebugMsg ( " Invalid SpatiaLite layer" );
528
530
closeDb ();
529
531
gaiaFreeVectorLayersList ( list );
@@ -543,15 +545,13 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
543
545
{
544
546
// the table is not a geometry table
545
547
numberFeatures = 0 ;
546
- valid = false ;
547
548
QgsDebugMsg ( " Invalid SpatiaLite layer" );
548
549
closeDb ();
549
550
return ;
550
551
}
551
552
if ( !getTableSummary () ) // gets the extent and feature count
552
553
{
553
554
numberFeatures = 0 ;
554
- valid = false ;
555
555
QgsDebugMsg ( " Invalid SpatiaLite layer" );
556
556
closeDb ();
557
557
return ;
@@ -561,7 +561,6 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
561
561
}
562
562
if ( sqliteHandle == NULL )
563
563
{
564
- valid = false ;
565
564
QgsDebugMsg ( " Invalid SpatiaLite layer" );
566
565
return ;
567
566
}
@@ -576,6 +575,7 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
576
575
<< QgsVectorDataProvider::NativeType ( tr ( " Decimal number (double)" ), " FLOAT" , QVariant::Double )
577
576
<< QgsVectorDataProvider::NativeType ( tr ( " Whole number (integer)" ), " INTEGER" , QVariant::LongLong )
578
577
;
578
+ valid = true ;
579
579
}
580
580
581
581
QgsSpatiaLiteProvider::~QgsSpatiaLiteProvider ()
@@ -4145,7 +4145,7 @@ bool QgsSpatiaLiteProvider::checkLayerType()
4145
4145
4146
4146
QString sql;
4147
4147
4148
- if ( mGeometryColumn .isEmpty () && !(mQuery .startsWith ( " (" ) && mQuery .endsWith ( " )" )) )
4148
+ if ( mGeometryColumn .isEmpty () && !( mQuery .startsWith ( " (" ) && mQuery .endsWith ( " )" ) ) )
4149
4149
{
4150
4150
// checking if is a non-spatial table
4151
4151
sql = QString ( " SELECT type FROM sqlite_master "
0 commit comments