You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First change: Database#load_extension supports an extension
specifier, which is anything that responds to `#to_path` like Pathname
or the SQLean gem modules.
When passed an object that responds to `#to_path`, that method's
return value is used as the filesystem path for the extension,
allowing a calling convention like:
db.load_extension(SQLean::VSV)
where prior to this change that would need to be the more verbose:
db.load_extension(SQLean::VSV.to_path)
Second change: Database.new supports `extensions:` option parameter,
which is an array of paths or extension specifiers to be loaded.
This commit updates the Database documentation with lots of examples
and explanation, but to sum up:
Database.new(":memory:", extensions: [SQLean::Crypto, "/path/to/extension"])
My hope is that we can now make a very small change to Rails to allow
injection of database extensions via the config/database.yml file
using this constructor param.
# Create a new Database object that opens the given file.
82
116
#
83
117
# Supported permissions +options+:
84
118
# - the default mode is <tt>READWRITE | CREATE</tt>
85
-
# - +:readonly+: boolean (default false), true to set the mode to +READONLY+
86
-
# - +:readwrite+: boolean (default false), true to set the mode to +READWRITE+
87
-
# - +:flags+: set the mode to a combination of SQLite3::Constants::Open flags.
119
+
# - +readonly:+ boolean (default false), true to set the mode to +READONLY+
120
+
# - +readwrite:+ boolean (default false), true to set the mode to +READWRITE+
121
+
# - +flags:+ set the mode to a combination of SQLite3::Constants::Open flags.
88
122
#
89
123
# Supported encoding +options+:
90
-
# - +:utf16+: boolean (default false), is the filename's encoding UTF-16 (only needed if the filename encoding is not UTF_16LE or BE)
124
+
# - +utf16:+ +boolish+ (default false), is the filename's encoding UTF-16 (only needed if the filename encoding is not UTF_16LE or BE)
91
125
#
92
126
# Other supported +options+:
93
-
# - +:strict+: boolean (default false), disallow the use of double-quoted string literals (see https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted)
94
-
# - +:results_as_hash+: boolean (default false), return rows as hashes instead of arrays
95
-
# - +:default_transaction_mode+: one of +:deferred+ (default), +:immediate+, or +:exclusive+. If a mode is not specified in a call to #transaction, this will be the default transaction mode.
127
+
# - +strict:+ +boolish+ (default false), disallow the use of double-quoted string literals (see https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted)
128
+
# - +results_as_hash:+ +boolish+ (default false), return rows as hashes instead of arrays
129
+
# - +default_transaction_mode:+ one of +:deferred+ (default), +:immediate+, or +:exclusive+. If a mode is not specified in a call to #transaction, this will be the default transaction mode.
130
+
# - +extensions:+ <tt>Array[String | _ExtensionSpecifier]</tt> SQLite extensions to load into the database. See Database@SQLite+Extensions for more information.
0 commit comments