-
-
Notifications
You must be signed in to change notification settings - Fork 225
Make database connection thread-safe #6030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -183,8 +183,8 @@ class DatabaseInterface | |
| void truncateAllTables(); | ||
| bool tableHasColumn(const std::string & tableName, const std::string & columnName); | ||
| bool tableExists(const std::string & name); | ||
| int transactionWriteDepth() { return _transactionWriteDepth; } | ||
| int transactionReadDepth() { return _transactionReadDepth; } | ||
| int transactionWriteDepth(); | ||
| int transactionReadDepth(); | ||
|
|
||
| void preloadInterfaceForThread(); | ||
| void close(); ///< Closes the loaded database and disconnects | ||
|
|
@@ -197,13 +197,10 @@ class DatabaseInterface | |
| void _runStatementsRepeatedly( const std::string & statements, std::function<bool( std::function<void(sqlite3_stmt *stmt)> ** bindParameters, size_t row)> bindParameterFactory, std::function<void(size_t row, size_t repetition, sqlite3_stmt *stmt)> * processRow = nullptr, bool ignoreFails = false); | ||
|
|
||
| void create(); ///< Creates a new sqlite database in sessiondir and loads it | ||
| void load(); ///< Loads a sqlite database from sessiondir (after loading a jaspfile) | ||
| sqlite3* load(); ///< Loads a sqlite database from sessiondir (after loading a jaspfile) | ||
|
||
|
|
||
|
|
||
|
|
||
| int _transactionWriteDepth = 0, | ||
| _transactionReadDepth = 0; | ||
|
|
||
| std::map<std::thread::id, sqlite3*> _dbs; | ||
| std::thread::id _dbCreator; | ||
| sqlite3* _dbCreated = nullptr; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you returning this?