Skip to content

Commit 9154e4e

Browse files
committed
open CRS database readonly by default (fixes permission timeouts on windows)
1 parent 5101155 commit 9154e4e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/core/qgscoordinatereferencesystem.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -1244,10 +1244,12 @@ QString QgsCoordinateReferenceSystem::proj4FromSrsId( const int theSrsId )
12441244
return myProjString;
12451245
}
12461246

1247-
int QgsCoordinateReferenceSystem::openDb( QString path, sqlite3 **db )
1247+
int QgsCoordinateReferenceSystem::openDb( QString path, sqlite3 **db, bool readonly )
12481248
{
12491249
QgsDebugMsgLevel( "path = " + path, 3 );
1250-
int myResult = sqlite3_open( path.toUtf8().data(), db );
1250+
int myResult = readonly
1251+
? sqlite3_open_v2( path.toUtf8().data(), db, SQLITE_OPEN_READONLY, NULL )
1252+
: sqlite3_open( path.toUtf8().data(), db );
12511253

12521254
if ( myResult != SQLITE_OK )
12531255
{

src/core/qgscoordinatereferencesystem.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,9 @@ class CORE_EXPORT QgsCoordinateReferenceSystem
398398
*/
399399
RecordMap getRecord( QString theSql );
400400

401-
// Open SQLite db and show message if ccannot be opened
401+
// Open SQLite db and show message if cannot be opened
402402
// returns the same code as sqlite3_open
403-
static int openDb( QString path, sqlite3 **db );
403+
static int openDb( QString path, sqlite3 **db, bool readonly = true );
404404

405405
//!The internal sqlite3 srs.db primary key for this srs
406406
long mSrsId;

0 commit comments

Comments
 (0)