mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Pass MDB_RDONLY to the LMDB environment for readonly DBs
This commit is contained in:
parent
0887a1d7ab
commit
79d831ff9f
@ -46,6 +46,11 @@ DBA_OPEN_FUNC(lmdb)
|
||||
|
||||
ZEND_ASSERT(map_size >= 0);
|
||||
|
||||
/* Add readonly flag if DB is opened in read only mode */
|
||||
if (info->mode == DBA_READER) {
|
||||
flags |= MDB_RDONLY;
|
||||
}
|
||||
|
||||
rc = mdb_env_create(&env);
|
||||
if (rc) {
|
||||
*error = mdb_strerror(rc);
|
||||
@ -69,7 +74,7 @@ DBA_OPEN_FUNC(lmdb)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
rc = mdb_txn_begin(env, NULL, 0, &txn);
|
||||
rc = mdb_txn_begin(env, NULL, /* flags */ MDB_RDONLY, &txn);
|
||||
if (rc) {
|
||||
mdb_env_close(env);
|
||||
*error = mdb_strerror(rc);
|
||||
|
Loading…
Reference in New Issue
Block a user