open CRS database readonly by default (fixes permission timeouts on windows)

This commit is contained in:
Juergen E. Fischer 2012-04-02 15:43:48 +02:00
parent 51011559c4
commit 9154e4e046
2 changed files with 6 additions and 4 deletions

View File

@ -1244,10 +1244,12 @@ QString QgsCoordinateReferenceSystem::proj4FromSrsId( const int theSrsId )
return myProjString; return myProjString;
} }
int QgsCoordinateReferenceSystem::openDb( QString path, sqlite3 **db ) int QgsCoordinateReferenceSystem::openDb( QString path, sqlite3 **db, bool readonly )
{ {
QgsDebugMsgLevel( "path = " + path, 3 ); QgsDebugMsgLevel( "path = " + path, 3 );
int myResult = sqlite3_open( path.toUtf8().data(), db ); int myResult = readonly
? sqlite3_open_v2( path.toUtf8().data(), db, SQLITE_OPEN_READONLY, NULL )
: sqlite3_open( path.toUtf8().data(), db );
if ( myResult != SQLITE_OK ) if ( myResult != SQLITE_OK )
{ {

View File

@ -398,9 +398,9 @@ class CORE_EXPORT QgsCoordinateReferenceSystem
*/ */
RecordMap getRecord( QString theSql ); RecordMap getRecord( QString theSql );
// Open SQLite db and show message if ccannot be opened // Open SQLite db and show message if cannot be opened
// returns the same code as sqlite3_open // returns the same code as sqlite3_open
static int openDb( QString path, sqlite3 **db ); static int openDb( QString path, sqlite3 **db, bool readonly = true );
//!The internal sqlite3 srs.db primary key for this srs //!The internal sqlite3 srs.db primary key for this srs
long mSrsId; long mSrsId;