Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support :auto_vacuum, :foreign_keys, :synchronous, and :temp_store Da…
…tabase options on SQLite, for thread-safe PRAGMA setting As mentioned to in the last commit message, previously Sequel's support for setting PRAGMAs on SQLite was not thread safe. This commit adds a thread safe method to set PRAGMAs by adding database options for each supported PRAGMA. Thread safe support for other PRAGMAs can be done using the :after_connect option proc. Because of the connection pool implementation, the only thread safe way to make per connection modifications is before the connection is added to the pool. So in the native sqlite adapter and the do and jdbc sqlite subadapters, the PRAGMA modification SQL statements are executed on connection object object before the connection is returned. To reduce the amount of duplicated code, the private connection_pragmas method is added to the shared SQL adapter. Now that PRAGMAs can be modified safely, enable the foreign_keys PRAGMA unless it is specifically disabled. The only fallout in the test suite from this is the need to change the order of dropping of tables in the class table interitance plugin tests. If you want to specifically disable the foreign_keys pragma, set the :foreign_keys option to false when instantiating the database. This does break backwards compatibility, but allows greater consistency with other databases.
- Loading branch information
1 parent
34dbeb5
commit b4ca833
Showing
6 changed files
with
60 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters