Skip to content

Commit 79bda7f

Browse files
author
jef
committed
debian packaging: switch to internal spatialite
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14764 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 5bda422 commit 79bda7f

File tree

3 files changed

+65
-65
lines changed

3 files changed

+65
-65
lines changed

debian/rules

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ CMAKE_OPTS := \
3232
-D WITH_MAPSERVER=TRUE \
3333
-D QGIS_CGIBIN_SUBDIR=/usr/lib/cgi-bin
3434

35-
ifeq (,$(findstring $(DISTRIBUTION),"squeeze lucid maverick natty sid"))
35+
#ifeq (,$(findstring $(DISTRIBUTION),"squeeze lucid maverick natty sid"))
3636
CMAKE_OPTS += -D WITH_INTERNAL_SPATIALITE=TRUE
37-
else
38-
CMAKE_OPTS += -D WITH_INTERNAL_SPATIALITE=FALSE
39-
endif
37+
#else
38+
# CMAKE_OPTS += -D WITH_INTERNAL_SPATIALITE=FALSE
39+
#endif
4040

4141
ifneq (,$(findstring $(DISTRIBUTION),"hardy intrepid"))
4242
LDFLAGS += -Wl,--as-needed -Wl,--no-undefined

src/app/qgsnewspatialitelayerdialog.cpp

+31-31
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ void QgsNewSpatialiteLayerDialog::on_pbnFindSRID_clicked()
187187
}
188188
}
189189

190-
void QgsNewSpatialiteLayerDialog::initializeSpatialMetadata(sqlite3 *sqlite_handle)
190+
void QgsNewSpatialiteLayerDialog::initializeSpatialMetadata( sqlite3 *sqlite_handle )
191191
{
192192
// attempting to perform self-initialization for a newly created DB
193193
int ret;
@@ -199,37 +199,37 @@ void QgsNewSpatialiteLayerDialog::initializeSpatialMetadata(sqlite3 *sqlite_hand
199199
int rows;
200200
int columns;
201201

202-
if (sqlite_handle == NULL)
202+
if ( sqlite_handle == NULL )
203203
return;
204-
// checking if this DB is really empty
205-
strcpy(sql, "SELECT Count(*) from sqlite_master");
206-
ret = sqlite3_get_table(sqlite_handle, sql, &results, &rows, &columns, NULL);
207-
if (ret != SQLITE_OK)
204+
// checking if this DB is really empty
205+
strcpy( sql, "SELECT Count(*) from sqlite_master" );
206+
ret = sqlite3_get_table( sqlite_handle, sql, &results, &rows, &columns, NULL );
207+
if ( ret != SQLITE_OK )
208208
return;
209-
if (rows < 1)
209+
if ( rows < 1 )
210210
;
211211
else
212212
{
213-
for (i = 1; i <= rows; i++)
214-
count = atoi(results[(i * columns) + 0]);
213+
for ( i = 1; i <= rows; i++ )
214+
count = atoi( results[( i * columns ) + 0] );
215215
}
216-
sqlite3_free_table(results);
216+
sqlite3_free_table( results );
217217

218-
if (count > 0)
218+
if ( count > 0 )
219219
return;
220220

221221
// all right, it's empty: proceding to initialize
222-
strcpy(sql, "SELECT InitSpatialMetadata()");
223-
ret = sqlite3_exec(sqlite_handle, sql, NULL, NULL, &errMsg);
224-
if (ret != SQLITE_OK)
222+
strcpy( sql, "SELECT InitSpatialMetadata()" );
223+
ret = sqlite3_exec( sqlite_handle, sql, NULL, NULL, &errMsg );
224+
if ( ret != SQLITE_OK )
225225
{
226226
QString errCause = tr( "Unable to initialize SpatialMetedata:\n" );
227-
errCause += QString::fromUtf8(errMsg);
227+
errCause += QString::fromUtf8( errMsg );
228228
QMessageBox::warning( 0, tr( "SpatiaLite Database" ), errCause );
229-
sqlite3_free(errMsg);
229+
sqlite3_free( errMsg );
230230
return;
231231
}
232-
spatial_ref_sys_init(sqlite_handle, 0);
232+
spatial_ref_sys_init( sqlite_handle, 0 );
233233
}
234234

235235
bool QgsNewSpatialiteLayerDialog::createDb()
@@ -256,32 +256,32 @@ bool QgsNewSpatialiteLayerDialog::createDb()
256256

257257
// creating/opening the new database
258258
QString dbPath = newDb.fileName();
259-
spatialite_init(0);
260-
ret = sqlite3_open_v2(dbPath.toUtf8().constData(), &sqlite_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
261-
if (ret)
259+
spatialite_init( 0 );
260+
ret = sqlite3_open_v2( dbPath.toUtf8().constData(), &sqlite_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL );
261+
if ( ret )
262262
{
263-
// an error occurred
263+
// an error occurred
264264
QString errCause = tr( "Could not create a new database\n" );
265-
errCause += QString::fromUtf8(sqlite3_errmsg(sqlite_handle));
266-
sqlite3_close(sqlite_handle);
267-
QMessageBox::warning( 0, tr( "SpatiaLite Database" ), errCause );
265+
errCause += QString::fromUtf8( sqlite3_errmsg( sqlite_handle ) );
266+
sqlite3_close( sqlite_handle );
267+
QMessageBox::warning( 0, tr( "SpatiaLite Database" ), errCause );
268268
pbnFindSRID->setEnabled( false );
269269
return false;
270270
}
271271
// activating Foreign Key constraints
272-
ret = sqlite3_exec(sqlite_handle, "PRAGMA foreign_keys = 1", NULL, 0, &errMsg);
273-
if (ret != SQLITE_OK)
272+
ret = sqlite3_exec( sqlite_handle, "PRAGMA foreign_keys = 1", NULL, 0, &errMsg );
273+
if ( ret != SQLITE_OK )
274274
{
275275
QMessageBox::warning( 0, tr( "SpatiaLite Database" ), tr( "Unable to activate FOREIGN_KEY constraints" ) );
276-
sqlite3_free(errMsg);
277-
sqlite3_close(sqlite_handle);
276+
sqlite3_free( errMsg );
277+
sqlite3_close( sqlite_handle );
278278
pbnFindSRID->setEnabled( false );
279279
return false;
280280
}
281-
initializeSpatialMetadata(sqlite_handle);
282-
281+
initializeSpatialMetadata( sqlite_handle );
282+
283283
// all done: closing the DB connection
284-
sqlite3_close(sqlite_handle);
284+
sqlite3_close( sqlite_handle );
285285
}
286286

287287
QFileInfo fi( newDb );

src/plugins/offline_editing/offline_editing.cpp

+30-30
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ void QgsOfflineEditing::synchronize( QgsLegendInterface* legendInterface )
253253
sqlite3_close( db );
254254
}
255255

256-
void QgsOfflineEditing::initializeSpatialMetadata(sqlite3 *sqlite_handle)
256+
void QgsOfflineEditing::initializeSpatialMetadata( sqlite3 *sqlite_handle )
257257
{
258258
// attempting to perform self-initialization for a newly created DB
259259
int ret;
@@ -265,37 +265,37 @@ void QgsOfflineEditing::initializeSpatialMetadata(sqlite3 *sqlite_handle)
265265
int rows;
266266
int columns;
267267

268-
if (sqlite_handle == NULL)
268+
if ( sqlite_handle == NULL )
269269
return;
270-
// checking if this DB is really empty
271-
strcpy(sql, "SELECT Count(*) from sqlite_master");
272-
ret = sqlite3_get_table(sqlite_handle, sql, &results, &rows, &columns, NULL);
273-
if (ret != SQLITE_OK)
270+
// checking if this DB is really empty
271+
strcpy( sql, "SELECT Count(*) from sqlite_master" );
272+
ret = sqlite3_get_table( sqlite_handle, sql, &results, &rows, &columns, NULL );
273+
if ( ret != SQLITE_OK )
274274
return;
275-
if (rows < 1)
275+
if ( rows < 1 )
276276
;
277277
else
278278
{
279-
for (i = 1; i <= rows; i++)
280-
count = atoi(results[(i * columns) + 0]);
279+
for ( i = 1; i <= rows; i++ )
280+
count = atoi( results[( i * columns ) + 0] );
281281
}
282-
sqlite3_free_table(results);
282+
sqlite3_free_table( results );
283283

284-
if (count > 0)
284+
if ( count > 0 )
285285
return;
286286

287287
// all right, it's empty: proceding to initialize
288-
strcpy(sql, "SELECT InitSpatialMetadata()");
289-
ret = sqlite3_exec(sqlite_handle, sql, NULL, NULL, &errMsg);
290-
if (ret != SQLITE_OK)
288+
strcpy( sql, "SELECT InitSpatialMetadata()" );
289+
ret = sqlite3_exec( sqlite_handle, sql, NULL, NULL, &errMsg );
290+
if ( ret != SQLITE_OK )
291291
{
292292
QString errCause = tr( "Unable to initialize SpatialMetedata:\n" );
293-
errCause += QString::fromUtf8(errMsg);
293+
errCause += QString::fromUtf8( errMsg );
294294
showWarning( errCause );
295-
sqlite3_free(errMsg);
295+
sqlite3_free( errMsg );
296296
return;
297297
}
298-
spatial_ref_sys_init(sqlite_handle, 0);
298+
spatial_ref_sys_init( sqlite_handle, 0 );
299299
}
300300

301301
bool QgsOfflineEditing::createSpatialiteDB( const QString& offlineDbPath )
@@ -319,30 +319,30 @@ bool QgsOfflineEditing::createSpatialiteDB( const QString& offlineDbPath )
319319

320320
// creating/opening the new database
321321
QString dbPath = newDb.fileName();
322-
spatialite_init(0);
323-
ret = sqlite3_open_v2(dbPath.toUtf8().constData(), &sqlite_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
324-
if (ret)
322+
spatialite_init( 0 );
323+
ret = sqlite3_open_v2( dbPath.toUtf8().constData(), &sqlite_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL );
324+
if ( ret )
325325
{
326-
// an error occurred
326+
// an error occurred
327327
QString errCause = tr( "Could not create a new database\n" );
328-
errCause += QString::fromUtf8(sqlite3_errmsg(sqlite_handle));
329-
sqlite3_close(sqlite_handle);
328+
errCause += QString::fromUtf8( sqlite3_errmsg( sqlite_handle ) );
329+
sqlite3_close( sqlite_handle );
330330
showWarning( errCause );
331331
return false;
332332
}
333333
// activating Foreign Key constraints
334-
ret = sqlite3_exec(sqlite_handle, "PRAGMA foreign_keys = 1", NULL, 0, &errMsg);
335-
if (ret != SQLITE_OK)
334+
ret = sqlite3_exec( sqlite_handle, "PRAGMA foreign_keys = 1", NULL, 0, &errMsg );
335+
if ( ret != SQLITE_OK )
336336
{
337337
showWarning( tr( "Unable to activate FOREIGN_KEY constraints" ) );
338-
sqlite3_free(errMsg);
339-
sqlite3_close(sqlite_handle);
338+
sqlite3_free( errMsg );
339+
sqlite3_close( sqlite_handle );
340340
return false;
341341
}
342-
initializeSpatialMetadata(sqlite_handle);
343-
342+
initializeSpatialMetadata( sqlite_handle );
343+
344344
// all done: closing the DB connection
345-
sqlite3_close(sqlite_handle);
345+
sqlite3_close( sqlite_handle );
346346

347347
return true;
348348
}

0 commit comments

Comments
 (0)