-
-
Notifications
You must be signed in to change notification settings - Fork 324
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
#1392 : Add support for SQLite VFS and open mode flags #1393
base: dev
Are you sure you want to change the base?
#1392 : Add support for SQLite VFS and open mode flags #1393
Conversation
hey @ancientjpeg . Thank for this PR. Please work in |
13c0562
to
42d717b
Compare
Just rebased. Thanks and apologies again. |
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.
@fnc12 I've added enums to allow for full control over what open mode/VFS options users actually have access to. I'm happy with the state this PR is in, but I have some preliminary evidence that using some VFS modes like unix-dotfile
may interfere with the ability to set certain journal_mode
s. This is detectable by just checking journal_mode
after you've set it, but if you'd like me to brainstorm a layer of protection for that I'd be happy to.
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.
Thanks @ancientjpeg for your contribution! Here come my 2 cents...
@trueqbit Still working through your changes, but something occurred to me while refactoring. I had some of those unnecessary enum class vfs_mode_t; Then it'd be a lot clearer to re-use the same verbiage for defining variables, e.g. vfs_mode_t vfs_mode;
open_mode_t open_mode;
struct storage_options {
vfs_mode_t vfs_mode;
open_mode_t open_mode;
}; Let me know what you think of that. Edit: I ended up implementing this because GCC complains of ambiguity in cases such as |
b96a21f
to
319c614
Compare
Hmm, that's a funny problem as both are public :) I personally like camel case for (member) variables, but I agree that's debatable. While we are at it, I also suggest renaming |
@trueqbit Great point about using I'll be away from my development system until next week, at which time I'll wrap up these changes. Thanks for the feedback! |
dev/storage_base.h
Outdated
*/ | ||
sqlite_orm::vfs_object vfs_object() const { | ||
return this->connection->options.vfs_option; | ||
} |
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.
Namespacing here seems to be required to prevent errors in GCC. Mirrors existing code:
sqlite_orm::journal_mode journal_mode()
Re-drafting to address merge conflicts. |
Hi @ancientjpeg, I must apologize for the inconvenience. Independently of you, I have developed a way to pass various storage options to Also, I would like to point out to you in advance that an enum to represent a VFS is most likely too restrictive as it is not a fixed set of values. But we can discuss that later. |
da943af
to
0f34242
Compare
add test skeleton add open flags rename file move test file, finish test code, add to cmake fixup clang error add another make_storage overload remove overload fixup rename to v2, fixup tests fixup copy ctor remove int flags option add platform definitions add vfs file rename tests update tests and gen code rename to vfs_t implement vfs enum remove default arg for connection holder clarify test log add vfs getter and default vfs def rename vfs_default, add public getter swap from different method name to overload cleanup macros and fix linux macros more vfs cleanup and test fixup re-run gen remove unnecessary pack indexing check add open_mode.h add to header fixup win macro error use enum value instead of constexpr regenerate to include vfs move test file convert to constexpr, set up open_mode tests fully set up open mode in ctors rename vfs_t to vfs_mode begin renaming open_mode rename open_mode enum scoping fixups add readonly; need to attempt fix fix readonly call remove usage of tmpnam rename mac macro to apple rename file remove pointless line update gen run tests for mem as well reword test variable fixup test on Windows fix gcc err run gen fixup add return path to silence MSVC warn fixup pragma once placements remove inline no nested namespaces cleanup serializers add include change to serialize type remove unneeded namespacing just call it all open_mode implement storage_options remove auto inject options into connection add _t suffix large batch of name fixes separate static tests remove unused comments remove unused include revert _t suffix rename member vars rename to vfs_object fix weird typo more naming fixups fix namespacing attempt to fix MSVC crash real string fix
0f34242
to
2cf9c47
Compare
tests green again
Addresses #1392
Changelog
vfs_mode
enum class to simplify thesqlite_orm
API for using different VFS systems, as compared to the raw string passed insqlite3.h
open_mode
enum class to support the open flags passed bysqlite3_open_v2
. Only two values have been added so far, but this addition makes it very easy to add more in the future.More Info
https://www.sqlite.org/vfs.html - VFS options and description
https://www.sqlite.org/c3ref/open.html - open flag options