Skip to content

Commit 7579596

Browse files
author
wonder
committed
Reuse OSM db file on windows.
For some strange reason it was not considering the same QDateTime to be equal. git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12591 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 3415e47 commit 7579596

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/providers/osm/osmprovider.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ QgsOSMDataProvider::QgsOSMDataProvider( QString uri )
152152
QgsDebugMsg( "Opening sqlite3 database failed, OSM provider cannot be constructed." );
153153
closeDatabase();
154154
return;
155-
};
155+
}
156156

157157
// flag determining if OSM file parsing is necessary
158158
bool shouldParse = true;
@@ -161,7 +161,7 @@ QgsOSMDataProvider::QgsOSMDataProvider( QString uri )
161161
shouldParse = false;
162162

163163
// test if db file that belongs to source OSM file already exists and if it has the right version
164-
if ( shouldParse && databaseExists && isDatabaseCompatibleWithInput( mFileName ) && isDatabaseCompatibleWithProvider() )
164+
if ( databaseExists && isDatabaseCompatibleWithInput( mFileName ) && isDatabaseCompatibleWithProvider() )
165165
shouldParse = false;
166166

167167
if ( shouldParse )
@@ -367,7 +367,7 @@ bool QgsOSMDataProvider::isDatabaseCompatibleWithInput( QString mFileName )
367367
// each OSM database schema carry info on last-modified of file from which database was created;
368368
// if value equals to last-modified of current input file then DB file belongs to current input file
369369
// (in such case we say that "database is compatible with input")
370-
if ( mOsmFileLastModif == oldOsmFileLastModif )
370+
if ( mOsmFileLastModif.toTime_t() == oldOsmFileLastModif.toTime_t() )
371371
{
372372
sqlite3_finalize( stmtSelectLastModif );
373373
return true;
@@ -1657,11 +1657,8 @@ bool QgsOSMDataProvider::openDatabase()
16571657
{
16581658
QgsDebugMsg( "Opening database." );
16591659

1660-
QByteArray dbfn_bytes = mDatabaseFileName.toAscii();
1661-
const char *ptr = dbfn_bytes.data();
1662-
16631660
// open database
1664-
if ( sqlite3_open( ptr, &mDatabase ) != SQLITE_OK )
1661+
if ( sqlite3_open( mDatabaseFileName.toUtf8().data(), &mDatabase ) != SQLITE_OK )
16651662
{
16661663
mError = ( char * ) "Opening SQLite3 database failed.";
16671664
sqlite3_close( mDatabase );

0 commit comments

Comments
 (0)