Skip to content

Commit f8ebfca

Browse files
committed
doc: document Database.new options
which includes the new :default_transaction_mode
1 parent 109b6b1 commit f8ebfca

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

lib/sqlite3/database.rb

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,23 @@ def quote( string )
7171

7272
# call-seq: SQLite3::Database.new(file, options = {})
7373
#
74-
# Create a new Database object that opens the given file. If utf16
75-
# is +true+, the filename is interpreted as a UTF-16 encoded string.
74+
# Create a new Database object that opens the given file.
75+
#
76+
# Supported permissions +options+:
77+
# - the default mode is <tt>READWRITE | CREATE</tt>
78+
# - +:readonly+: boolean (default false), true to set the mode to +READONLY+
79+
# - +:readwrite+: boolean (default false), true to set the mode to +READWRITE+
80+
# - +:flags+: set the mode to a combination of SQLite3::Constants::Open flags.
81+
#
82+
# Supported encoding +options+:
83+
# - +:utf16+: boolean (default false), is the filename's encoding UTF-16 (only needed if the filename encoding is not UTF_16LE or BE)
84+
#
85+
# Other supported +options+:
86+
# - +: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)
87+
# - +:results_as_hash+: boolean (default false), return rows as hashes instead of arrays
88+
# - +:type_translation+: boolean (default false), enable type translation
89+
# - +: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.
7690
#
77-
# By default, the new database will return result rows as arrays
78-
# (#results_as_hash) and has type translation disabled (#type_translation=).
79-
8091
def initialize file, options = {}, zvfs = nil
8192
mode = Constants::Open::READWRITE | Constants::Open::CREATE
8293

0 commit comments

Comments
 (0)