Skip to content

Commit 722e7e4

Browse files
committed
Restore "open forever" hint
... lost with merge commit f41c81a.
1 parent 9b5b28c commit 722e7e4

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

dev/connection_holder.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#endif
1212

1313
#include "functional/cxx_new.h"
14+
#include "functional/gsl.h"
1415
#include "error_code.h"
1516
#include "vfs_name.h"
1617
#include "db_open_mode.h"
@@ -49,15 +50,15 @@ namespace sqlite_orm {
4950

5051
connection_holder(std::string filename,
5152
std::function<void(sqlite3*)> didOpenDb,
52-
const connection_control& options = {}) :
53-
_didOpenDb{std::move(didOpenDb)}, filename(std::move(filename)), vfs_name(options.vfs_name),
54-
open_mode(options.open_mode) {}
53+
const connection_control& options) :
54+
_openedForeverHint{options.open_forever}, _didOpenDb{std::move(didOpenDb)},
55+
filename{std::move(filename)}, vfs_name{options.vfs_name}, open_mode{options.open_mode} {}
5556

5657
connection_holder(const connection_holder&) = delete;
5758

5859
connection_holder(const connection_holder& other, std::function<void(sqlite3*)> didOpenDb) :
59-
_didOpenDb{std::move(didOpenDb)}, filename{other.filename}, vfs_name(other.vfs_name),
60-
open_mode{other.open_mode} {}
60+
_openedForeverHint{other._openedForeverHint}, _didOpenDb{std::move(didOpenDb)},
61+
filename{other.filename}, vfs_name{other.vfs_name}, open_mode{other.open_mode} {}
6162

6263
void retain() {
6364
const maybe_lock maybeLock{_sync, !_openedForeverHint};
@@ -143,14 +144,14 @@ namespace sqlite_orm {
143144
struct connection_holder {
144145
connection_holder(std::string filename,
145146
std::function<void(sqlite3*)> didOpenDb,
146-
const connection_control& options = {}) :
147-
_didOpenDb{std::move(didOpenDb)}, filename(std::move(filename)), vfs_name(options.vfs_name),
148-
open_mode(options.open_mode) {}
147+
const connection_control& options) :
148+
_didOpenDb{std::move(didOpenDb)}, filename{std::move(filename)}, vfs_name{options.vfs_name},
149+
open_mode{options.open_mode} {}
149150

150151
connection_holder(const connection_holder&) = delete;
151152

152153
connection_holder(const connection_holder& other, std::function<void(sqlite3*)> didOpenDb) :
153-
_didOpenDb{std::move(didOpenDb)}, filename{other.filename}, vfs_name(other.vfs_name),
154+
_didOpenDb{std::move(didOpenDb)}, filename{other.filename}, vfs_name{other.vfs_name},
154155
open_mode{other.open_mode} {}
155156

156157
void retain() {

include/sqlite_orm/sqlite_orm.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14516,6 +14516,8 @@ namespace sqlite_orm {
1451614516
namespace polyfill = internal::polyfill;
1451714517
}
1451814518

14519+
// #include "functional/gsl.h"
14520+
1451914521
// #include "error_code.h"
1452014522

1452114523
// #include "vfs_name.h"
@@ -14675,15 +14677,15 @@ namespace sqlite_orm {
1467514677

1467614678
connection_holder(std::string filename,
1467714679
std::function<void(sqlite3*)> didOpenDb,
14678-
const connection_control& options = {}) :
14679-
_didOpenDb{std::move(didOpenDb)}, filename(std::move(filename)), vfs_name(options.vfs_name),
14680-
open_mode(options.open_mode) {}
14680+
const connection_control& options) :
14681+
_openedForeverHint{options.open_forever}, _didOpenDb{std::move(didOpenDb)},
14682+
filename{std::move(filename)}, vfs_name{options.vfs_name}, open_mode{options.open_mode} {}
1468114683

1468214684
connection_holder(const connection_holder&) = delete;
1468314685

1468414686
connection_holder(const connection_holder& other, std::function<void(sqlite3*)> didOpenDb) :
14685-
_didOpenDb{std::move(didOpenDb)}, filename{other.filename}, vfs_name(other.vfs_name),
14686-
open_mode{other.open_mode} {}
14687+
_openedForeverHint{other._openedForeverHint}, _didOpenDb{std::move(didOpenDb)},
14688+
filename{other.filename}, vfs_name{other.vfs_name}, open_mode{other.open_mode} {}
1468714689

1468814690
void retain() {
1468914691
const maybe_lock maybeLock{_sync, !_openedForeverHint};
@@ -14769,14 +14771,14 @@ namespace sqlite_orm {
1476914771
struct connection_holder {
1477014772
connection_holder(std::string filename,
1477114773
std::function<void(sqlite3*)> didOpenDb,
14772-
const connection_control& options = {}) :
14773-
_didOpenDb{std::move(didOpenDb)}, filename(std::move(filename)), vfs_name(options.vfs_name),
14774-
open_mode(options.open_mode) {}
14774+
const connection_control& options) :
14775+
_didOpenDb{std::move(didOpenDb)}, filename{std::move(filename)}, vfs_name{options.vfs_name},
14776+
open_mode{options.open_mode} {}
1477514777

1477614778
connection_holder(const connection_holder&) = delete;
1477714779

1477814780
connection_holder(const connection_holder& other, std::function<void(sqlite3*)> didOpenDb) :
14779-
_didOpenDb{std::move(didOpenDb)}, filename{other.filename}, vfs_name(other.vfs_name),
14781+
_didOpenDb{std::move(didOpenDb)}, filename{other.filename}, vfs_name{other.vfs_name},
1478014782
open_mode{other.open_mode} {}
1478114783

1478214784
void retain() {

0 commit comments

Comments
 (0)