Skip to content

Commit

Permalink
Reuse OSM db file on windows.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
wonder committed Dec 23, 2009
1 parent 3415e47 commit 7579596
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/providers/osm/osmprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ QgsOSMDataProvider::QgsOSMDataProvider( QString uri )
QgsDebugMsg( "Opening sqlite3 database failed, OSM provider cannot be constructed." );
closeDatabase();
return;
};
}

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

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

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

QByteArray dbfn_bytes = mDatabaseFileName.toAscii();
const char *ptr = dbfn_bytes.data();

// open database
if ( sqlite3_open( ptr, &mDatabase ) != SQLITE_OK )
if ( sqlite3_open( mDatabaseFileName.toUtf8().data(), &mDatabase ) != SQLITE_OK )
{
mError = ( char * ) "Opening SQLite3 database failed.";
sqlite3_close( mDatabase );
Expand Down

0 comments on commit 7579596

Please sign in to comment.