[QGIS Commit] r14764 - in trunk/qgis: debian src/app src/plugins/offline_editing

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Nov 25 16:45:21 EST 2010


Author: jef
Date: 2010-11-25 13:45:20 -0800 (Thu, 25 Nov 2010)
New Revision: 14764

Modified:
   trunk/qgis/debian/rules
   trunk/qgis/src/app/qgsnewspatialitelayerdialog.cpp
   trunk/qgis/src/plugins/offline_editing/offline_editing.cpp
Log:
debian packaging: switch to internal spatialite

Modified: trunk/qgis/debian/rules
===================================================================
--- trunk/qgis/debian/rules	2010-11-25 14:37:47 UTC (rev 14763)
+++ trunk/qgis/debian/rules	2010-11-25 21:45:20 UTC (rev 14764)
@@ -32,11 +32,11 @@
 	-D WITH_MAPSERVER=TRUE \
 	-D QGIS_CGIBIN_SUBDIR=/usr/lib/cgi-bin
 
-ifeq (,$(findstring $(DISTRIBUTION),"squeeze lucid maverick natty sid"))
+#ifeq (,$(findstring $(DISTRIBUTION),"squeeze lucid maverick natty sid"))
 	CMAKE_OPTS += -D WITH_INTERNAL_SPATIALITE=TRUE
-else
-	CMAKE_OPTS += -D WITH_INTERNAL_SPATIALITE=FALSE
-endif
+#else
+#	CMAKE_OPTS += -D WITH_INTERNAL_SPATIALITE=FALSE
+#endif
 
 ifneq (,$(findstring $(DISTRIBUTION),"hardy intrepid"))
 LDFLAGS += -Wl,--as-needed -Wl,--no-undefined

Modified: trunk/qgis/src/app/qgsnewspatialitelayerdialog.cpp
===================================================================
--- trunk/qgis/src/app/qgsnewspatialitelayerdialog.cpp	2010-11-25 14:37:47 UTC (rev 14763)
+++ trunk/qgis/src/app/qgsnewspatialitelayerdialog.cpp	2010-11-25 21:45:20 UTC (rev 14764)
@@ -187,7 +187,7 @@
   }
 }
 
-void QgsNewSpatialiteLayerDialog::initializeSpatialMetadata(sqlite3 *sqlite_handle)
+void QgsNewSpatialiteLayerDialog::initializeSpatialMetadata( sqlite3 *sqlite_handle )
 {
 // attempting to perform self-initialization for a newly created DB
   int ret;
@@ -199,37 +199,37 @@
   int rows;
   int columns;
 
-  if (sqlite_handle == NULL)
+  if ( sqlite_handle == NULL )
     return;
-  // checking if this DB is really empty 
-  strcpy(sql, "SELECT Count(*) from sqlite_master");
-  ret = sqlite3_get_table(sqlite_handle, sql, &results, &rows, &columns, NULL);
-  if (ret != SQLITE_OK)
+  // checking if this DB is really empty
+  strcpy( sql, "SELECT Count(*) from sqlite_master" );
+  ret = sqlite3_get_table( sqlite_handle, sql, &results, &rows, &columns, NULL );
+  if ( ret != SQLITE_OK )
     return;
-  if (rows < 1)
+  if ( rows < 1 )
     ;
   else
   {
-      for (i = 1; i <= rows; i++)
-        count = atoi(results[(i * columns) + 0]);
+    for ( i = 1; i <= rows; i++ )
+      count = atoi( results[( i * columns ) + 0] );
   }
-  sqlite3_free_table(results);
+  sqlite3_free_table( results );
 
-  if (count > 0)
+  if ( count > 0 )
     return;
 
   // all right, it's empty: proceding to initialize
-  strcpy(sql, "SELECT InitSpatialMetadata()");
-  ret = sqlite3_exec(sqlite_handle, sql, NULL, NULL, &errMsg);
-  if (ret != SQLITE_OK)
+  strcpy( sql, "SELECT InitSpatialMetadata()" );
+  ret = sqlite3_exec( sqlite_handle, sql, NULL, NULL, &errMsg );
+  if ( ret != SQLITE_OK )
   {
     QString errCause = tr( "Unable to initialize SpatialMetedata:\n" );
-    errCause += QString::fromUtf8(errMsg);
+    errCause += QString::fromUtf8( errMsg );
     QMessageBox::warning( 0, tr( "SpatiaLite Database" ), errCause );
-    sqlite3_free(errMsg);
+    sqlite3_free( errMsg );
     return;
   }
-  spatial_ref_sys_init(sqlite_handle, 0);
+  spatial_ref_sys_init( sqlite_handle, 0 );
 }
 
 bool QgsNewSpatialiteLayerDialog::createDb()
@@ -256,32 +256,32 @@
 
     // creating/opening the new database
     QString dbPath = newDb.fileName();
-    spatialite_init(0);
-    ret = sqlite3_open_v2(dbPath.toUtf8().constData(), &sqlite_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
-    if (ret)
+    spatialite_init( 0 );
+    ret = sqlite3_open_v2( dbPath.toUtf8().constData(), &sqlite_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL );
+    if ( ret )
     {
-    // an error occurred
+      // an error occurred
       QString errCause = tr( "Could not create a new database\n" );
-      errCause += QString::fromUtf8(sqlite3_errmsg(sqlite_handle));
-      sqlite3_close(sqlite_handle);
-	  QMessageBox::warning( 0, tr( "SpatiaLite Database" ), errCause );
+      errCause += QString::fromUtf8( sqlite3_errmsg( sqlite_handle ) );
+      sqlite3_close( sqlite_handle );
+      QMessageBox::warning( 0, tr( "SpatiaLite Database" ), errCause );
       pbnFindSRID->setEnabled( false );
       return false;
     }
     // activating Foreign Key constraints
-    ret = sqlite3_exec(sqlite_handle, "PRAGMA foreign_keys = 1", NULL, 0, &errMsg);
-    if (ret != SQLITE_OK)
+    ret = sqlite3_exec( sqlite_handle, "PRAGMA foreign_keys = 1", NULL, 0, &errMsg );
+    if ( ret != SQLITE_OK )
     {
       QMessageBox::warning( 0, tr( "SpatiaLite Database" ), tr( "Unable to activate FOREIGN_KEY constraints" ) );
-      sqlite3_free(errMsg);
-	  sqlite3_close(sqlite_handle);
+      sqlite3_free( errMsg );
+      sqlite3_close( sqlite_handle );
       pbnFindSRID->setEnabled( false );
       return false;
     }
-    initializeSpatialMetadata(sqlite_handle);
-	
+    initializeSpatialMetadata( sqlite_handle );
+
     // all done: closing the DB connection
-    sqlite3_close(sqlite_handle);
+    sqlite3_close( sqlite_handle );
   }
 
   QFileInfo fi( newDb );

Modified: trunk/qgis/src/plugins/offline_editing/offline_editing.cpp
===================================================================
--- trunk/qgis/src/plugins/offline_editing/offline_editing.cpp	2010-11-25 14:37:47 UTC (rev 14763)
+++ trunk/qgis/src/plugins/offline_editing/offline_editing.cpp	2010-11-25 21:45:20 UTC (rev 14764)
@@ -253,7 +253,7 @@
   sqlite3_close( db );
 }
 
-void QgsOfflineEditing::initializeSpatialMetadata(sqlite3 *sqlite_handle)
+void QgsOfflineEditing::initializeSpatialMetadata( sqlite3 *sqlite_handle )
 {
 // attempting to perform self-initialization for a newly created DB
   int ret;
@@ -265,37 +265,37 @@
   int rows;
   int columns;
 
-  if (sqlite_handle == NULL)
+  if ( sqlite_handle == NULL )
     return;
-  // checking if this DB is really empty 
-  strcpy(sql, "SELECT Count(*) from sqlite_master");
-  ret = sqlite3_get_table(sqlite_handle, sql, &results, &rows, &columns, NULL);
-  if (ret != SQLITE_OK)
+  // checking if this DB is really empty
+  strcpy( sql, "SELECT Count(*) from sqlite_master" );
+  ret = sqlite3_get_table( sqlite_handle, sql, &results, &rows, &columns, NULL );
+  if ( ret != SQLITE_OK )
     return;
-  if (rows < 1)
+  if ( rows < 1 )
     ;
   else
   {
-      for (i = 1; i <= rows; i++)
-        count = atoi(results[(i * columns) + 0]);
+    for ( i = 1; i <= rows; i++ )
+      count = atoi( results[( i * columns ) + 0] );
   }
-  sqlite3_free_table(results);
+  sqlite3_free_table( results );
 
-  if (count > 0)
+  if ( count > 0 )
     return;
 
   // all right, it's empty: proceding to initialize
-  strcpy(sql, "SELECT InitSpatialMetadata()");
-  ret = sqlite3_exec(sqlite_handle, sql, NULL, NULL, &errMsg);
-  if (ret != SQLITE_OK)
+  strcpy( sql, "SELECT InitSpatialMetadata()" );
+  ret = sqlite3_exec( sqlite_handle, sql, NULL, NULL, &errMsg );
+  if ( ret != SQLITE_OK )
   {
     QString errCause = tr( "Unable to initialize SpatialMetedata:\n" );
-    errCause += QString::fromUtf8(errMsg);
+    errCause += QString::fromUtf8( errMsg );
     showWarning( errCause );
-    sqlite3_free(errMsg);
+    sqlite3_free( errMsg );
     return;
   }
-  spatial_ref_sys_init(sqlite_handle, 0);
+  spatial_ref_sys_init( sqlite_handle, 0 );
 }
 
 bool QgsOfflineEditing::createSpatialiteDB( const QString& offlineDbPath )
@@ -319,30 +319,30 @@
 
   // creating/opening the new database
   QString dbPath = newDb.fileName();
-  spatialite_init(0);
-  ret = sqlite3_open_v2(dbPath.toUtf8().constData(), &sqlite_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
-  if (ret)
+  spatialite_init( 0 );
+  ret = sqlite3_open_v2( dbPath.toUtf8().constData(), &sqlite_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL );
+  if ( ret )
   {
-  // an error occurred
+    // an error occurred
     QString errCause = tr( "Could not create a new database\n" );
-    errCause += QString::fromUtf8(sqlite3_errmsg(sqlite_handle));
-    sqlite3_close(sqlite_handle);
+    errCause += QString::fromUtf8( sqlite3_errmsg( sqlite_handle ) );
+    sqlite3_close( sqlite_handle );
     showWarning( errCause );
     return false;
   }
   // activating Foreign Key constraints
-  ret = sqlite3_exec(sqlite_handle, "PRAGMA foreign_keys = 1", NULL, 0, &errMsg);
-  if (ret != SQLITE_OK)
+  ret = sqlite3_exec( sqlite_handle, "PRAGMA foreign_keys = 1", NULL, 0, &errMsg );
+  if ( ret != SQLITE_OK )
   {
     showWarning( tr( "Unable to activate FOREIGN_KEY constraints" ) );
-    sqlite3_free(errMsg);
-    sqlite3_close(sqlite_handle);
+    sqlite3_free( errMsg );
+    sqlite3_close( sqlite_handle );
     return false;
   }
-  initializeSpatialMetadata(sqlite_handle);
-	
+  initializeSpatialMetadata( sqlite_handle );
+
   // all done: closing the DB connection
-  sqlite3_close(sqlite_handle);
+  sqlite3_close( sqlite_handle );
 
   return true;
 }



More information about the QGIS-commit mailing list