sqlite3 1.6.3-arm64-darwin → 1.6.5-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79621caa21e115b9d0561e96d56610b5cbbcc1fef6889a0bb4bd4a892ede7f31
4
- data.tar.gz: c934858d0dba9dd2fd90dbcb2f4c80df1960282b7e3f400c5f88bbc5e3dad482
3
+ metadata.gz: 5a81b5b393dfedf69cf524119a7724f94e88447d5ab2e9aa0676631deab7bf2c
4
+ data.tar.gz: 34308bc4e72d06fa2e0feb8aba55e09e7968dc1e794e89759cf54effb0588fd4
5
5
  SHA512:
6
- metadata.gz: 7454ab6742196efb9b47b529f1d74e234e033d661169acf55ff097d8d821973b4d7e4bd5205cff916781c1df83b39358dbf14aaf1e1ac8b560483130ce9320b0
7
- data.tar.gz: 7515f053cfd11cfb6c1b709cea53d3053d911ced55da5295bd96a6a46c0290bc081977235f7303d6cabe9fb61bab551d95de5ba366eb08113fd49f6fe7dcfd5c
6
+ metadata.gz: 9faa954a3883f8b3fdcb3fbc2e92017856165965f0561702a854fb6062c6dcca259b551fc4c06a901dcceef70e6229b7c4a2e3e5aa85619280e74e87185d8e05
7
+ data.tar.gz: f7e54dc8771bbde2c91988b3df68b0d81aa1665e5b7d7a98a534fccfd9c84ecbd4ddccab3bd38fee0c2138de877e3da6f7a55bd1d4416d44ef86663b71c76e18
data/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # sqlite3-ruby Changelog
2
2
 
3
+ ## 1.6.5 / 2023-09-08
4
+
5
+ ### Packaging
6
+
7
+ * Allow setting compiler flags for the sqlite library via a `--with-sqlite-cflags` argument to `extconf.rb`. See [`INSTALLATION.md`](https://github.com/sparklemotion/sqlite3-ruby/blob/master/INSTALLATION.md#controlling-compilation-flags-for-sqlite) for more information. [#401, #402] (@flavorjones)
8
+
9
+
10
+ ## 1.6.4 / 2023-08-26
11
+
12
+ ### Dependencies
13
+
14
+ Vendored sqlite is updated to [v3.43.0](https://sqlite.org/releaselog/3_43_0.html).
15
+
16
+ Upstream release notes:
17
+
18
+ > SQLite Release 3.43.0 On 2023-08-24
19
+ > * Add support for Contentless-Delete FTS5 Indexes. This is a variety of FTS5 full-text search index that omits storing the content that is being indexed while also allowing records to be deleted.
20
+ > * Enhancements to the date and time functions:
21
+ > * Added new time shift modifiers of the form ±YYYY-MM-DD HH:MM:SS.SSS.
22
+ > * Added the timediff() SQL function.
23
+ > * Added the octet_length(X) SQL function.
24
+ > * Added the sqlite3_stmt_explain() API.
25
+ > * Query planner enhancements:
26
+ > * Generalize the LEFT JOIN strength reduction optimization so that it works for RIGHT and FULL JOINs as well. Rename it to OUTER JOIN strength reduction.
27
+ > * Enhance the theorem prover in the OUTER JOIN strength reduction optimization so that it returns fewer false-negatives.
28
+ > * Enhancements to the decimal extension:
29
+ > * New function decimal_pow2(N) returns the N-th power of 2 for integer N between -20000 and +20000.
30
+ > * New function decimal_exp(X) works like decimal(X) except that it returns the result in exponential notation - with a "e+NN" at the end.
31
+ > * If X is a floating-point value, then the decimal(X) function now does a full expansion of that value into its exact decimal equivalent.
32
+ > * Performance enhancements to JSON processing results in a 2x performance improvement for some kinds of processing on large JSON strings.
33
+ > * New makefile target "verify-source" checks to ensure that there are no unintentional changes in the source tree. (Works for canonical source code only - not for precompiled amalgamation tarballs.)
34
+ > * Added the SQLITE_USE_SEH compile-time option that enables Structured Exception Handling on Windows while working with the memory-mapped shm file that is part of WAL mode processing. This option is enabled by default when building on Windows using Makefile.msc.
35
+ > * The VFS for unix now assumes that the nanosleep() system call is available unless compiled with -DHAVE_NANOSLEEP=0.
36
+
37
+
3
38
  ## 1.6.3 / 2023-05-16
4
39
 
5
40
  ### Dependencies
data/INSTALLATION.md ADDED
@@ -0,0 +1,259 @@
1
+
2
+ # Installation and Using SQLite3 extensions
3
+
4
+ This document will help you install the `sqlite3` ruby gem. It also contains instructions on loading database extensions and building against drop-in replacements for sqlite3.
5
+
6
+ ## Installation
7
+
8
+ ### Native Gems (recommended)
9
+
10
+ In v1.5.0 and later, native (precompiled) gems are available for recent Ruby versions on these platforms:
11
+
12
+ - `aarch64-linux` (requires: glibc >= 2.29)
13
+ - `arm-linux` (requires: glibc >= 2.29)
14
+ - `arm64-darwin`
15
+ - `x64-mingw32` / `x64-mingw-ucrt`
16
+ - `x86-linux` (requires: glibc >= 2.17)
17
+ - `x86_64-darwin`
18
+ - `x86_64-linux` (requires: glibc >= 2.17)
19
+
20
+ If you are using one of these Ruby versions on one of these platforms, the native gem is the recommended way to install sqlite3-ruby.
21
+
22
+ For example, on a linux system running Ruby 3.1:
23
+
24
+ ``` text
25
+ $ ruby -v
26
+ ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
27
+
28
+ $ time gem install sqlite3
29
+ Fetching sqlite3-1.5.0-x86_64-linux.gem
30
+ Successfully installed sqlite3-1.5.0-x86_64-linux
31
+ 1 gem installed
32
+
33
+ real 0m4.274s
34
+ user 0m0.734s
35
+ sys 0m0.165s
36
+ ```
37
+
38
+ #### Avoiding the precompiled native gem
39
+
40
+ The maintainers strongly urge you to use a native gem if at all possible. It will be a better experience for you and allow us to focus our efforts on improving functionality rather than diagnosing installation issues.
41
+
42
+ If you're on a platform that supports a native gem but you want to avoid using it in your project, do one of the following:
43
+
44
+ - If you're not using Bundler, then run `gem install sqlite3 --platform=ruby`
45
+ - If you are using Bundler
46
+ - version 2.3.18 or later, you can specify [`gem "sqlite3", force_ruby_platform: true`](https://bundler.io/v2.3/man/gemfile.5.html#FORCE_RUBY_PLATFORM)
47
+ - version 2.1 or later, then you'll need to run `bundle config set force_ruby_platform true`
48
+ - version 2.0 or earlier, then you'll need to run `bundle config force_ruby_platform true`
49
+
50
+
51
+ ### Compiling the source gem
52
+
53
+ If you are on a platform or version of Ruby that is not covered by the Native Gems, then the vanilla "ruby platform" (non-native) gem will be installed by the `gem install` or `bundle` commands.
54
+
55
+
56
+ #### Packaged libsqlite3
57
+
58
+ By default, as of v1.5.0 of this library, the latest available version of libsqlite3 is packaged with the gem and will be compiled and used automatically. This takes a bit longer than the native gem, but will provide a modern, well-supported version of libsqlite3.
59
+
60
+ For example, on a linux system running Ruby 2.5:
61
+
62
+ ``` text
63
+ $ ruby -v
64
+ ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]
65
+
66
+ $ time gem install sqlite3
67
+ Building native extensions. This could take a while...
68
+ Successfully installed sqlite3-1.5.0
69
+ 1 gem installed
70
+
71
+ real 0m20.620s
72
+ user 0m23.361s
73
+ sys 0m5.839s
74
+ ```
75
+
76
+ ##### Controlling compilation flags for sqlite
77
+
78
+ Upstream sqlite allows for the setting of some parameters at compile time. If you're an expert and would like to set these, you may do so at gem install time in two different ways ...
79
+
80
+ **If you're installing the gem using `gem install`** then you can pass in these compile-time flags like this:
81
+
82
+ ``` sh
83
+ gem install sqlite3 --platform=ruby -- \
84
+ --with-sqlite-cflags="-DSQLITE_DEFAULT_CACHE_SIZE=9999 -DSQLITE_DEFAULT_PAGE_SIZE=4444"
85
+ ```
86
+
87
+ or the equivalent:
88
+
89
+ ``` sh
90
+ CFLAGS="-DSQLITE_DEFAULT_CACHE_SIZE=9999 -DSQLITE_DEFAULT_PAGE_SIZE=4444" \
91
+ gem install sqlite3 --platform=ruby
92
+ ```
93
+
94
+ **If you're installing the gem using `bundler`** then you should first pin the gem to the "ruby" platform gem, so that you are compiling from source:
95
+
96
+ ``` ruby
97
+ # Gemfile
98
+ gem "sqlite3", force_ruby_platform: true # requires bundler >= 2.3.18
99
+ ```
100
+
101
+ and then set up a bundler config parameter for `build.sqlite3`:
102
+
103
+ ``` sh
104
+ bundle config set build.sqlite3 \
105
+ "--with-sqlite-cflags='-DSQLITE_DEFAULT_CACHE_SIZE=9999 -DSQLITE_DEFAULT_PAGE_SIZE=4444'"
106
+ ```
107
+
108
+ NOTE the use of single quotes within the double-quoted string to ensure the space between compiler flags is interpreted correctly. The contents of your `.bundle/config` file should look like:
109
+
110
+ ``` yaml
111
+ ---
112
+ BUNDLE_BUILD__SQLITE3: "--with-sqlite-cflags='-DSQLITE_DEFAULT_CACHE_SIZE=9999 -DSQLITE_DEFAULT_PAGE_SIZE=4444'"
113
+ ```
114
+
115
+
116
+ #### System libsqlite3
117
+
118
+ If you would prefer to build the sqlite3-ruby gem against your system libsqlite3, which requires that you install libsqlite3 and its development files yourself, you may do so by using the `--enable-system-libraries` flag at gem install time.
119
+
120
+ PLEASE NOTE:
121
+
122
+ - you must avoid installing a precompiled native gem (see [previous section](#avoiding-the-precompiled-native-gem))
123
+ - only versions of libsqlite3 `>= 3.5.0` are supported,
124
+ - and some library features may depend on how your libsqlite3 was compiled.
125
+
126
+ For example, on a linux system running Ruby 2.5:
127
+
128
+ ``` text
129
+ $ time gem install sqlite3 -- --enable-system-libraries
130
+ Building native extensions with: '--enable-system-libraries'
131
+ This could take a while...
132
+ Successfully installed sqlite3-1.5.0
133
+ 1 gem installed
134
+
135
+ real 0m4.234s
136
+ user 0m3.809s
137
+ sys 0m0.912s
138
+ ```
139
+
140
+ If you're using bundler, you can opt into system libraries like this:
141
+
142
+ ``` sh
143
+ bundle config build.sqlite3 --enable-system-libraries
144
+ ```
145
+
146
+ If you have sqlite3 installed in a non-standard location, you may need to specify the location of the include and lib files by using `--with-sqlite-include` and `--with-sqlite-lib` options (or a `--with-sqlite-dir` option, see [MakeMakefile#dir_config](https://ruby-doc.org/stdlib-3.1.1/libdoc/mkmf/rdoc/MakeMakefile.html#method-i-dir_config)). If you have pkg-config installed and configured properly, this may not be necessary.
147
+
148
+ ``` sh
149
+ gem install sqlite3 -- \
150
+ --enable-system-libraries \
151
+ --with-sqlite3-include=/opt/local/include \
152
+ --with-sqlite3-lib=/opt/local/lib
153
+ ```
154
+
155
+
156
+ #### System libsqlcipher
157
+
158
+ If you'd like to link against a system-installed libsqlcipher, you may do so by using the `--with-sqlcipher` flag:
159
+
160
+ ``` text
161
+ $ time gem install sqlite3 -- --with-sqlcipher
162
+ Building native extensions with: '--with-sqlcipher'
163
+ This could take a while...
164
+ Successfully installed sqlite3-1.5.0
165
+ 1 gem installed
166
+
167
+ real 0m4.772s
168
+ user 0m3.906s
169
+ sys 0m0.896s
170
+ ```
171
+
172
+ If you have sqlcipher installed in a non-standard location, you may need to specify the location of the include and lib files by using `--with-sqlite-include` and `--with-sqlite-lib` options (or a `--with-sqlite-dir` option, see [MakeMakefile#dir_config](https://ruby-doc.org/stdlib-3.1.1/libdoc/mkmf/rdoc/MakeMakefile.html#method-i-dir_config)). If you have pkg-config installed and configured properly, this may not be necessary.
173
+
174
+
175
+ ## Using SQLite3 extensions
176
+
177
+ ### How do I load a sqlite extension?
178
+
179
+ Some add-ons are available to sqlite as "extensions". The instructions that upstream sqlite provides at https://www.sqlite.org/loadext.html are the canonical source of advice, but here's a brief example showing how you can do this with the `sqlite3` ruby gem.
180
+
181
+ In this example, I'll be loading the ["spellfix" extension](https://www.sqlite.org/spellfix1.html):
182
+
183
+ ``` text
184
+ # download spellfix.c from somewherehttp://www.sqlite.org/src/finfo?name=ext/misc/spellfix.c
185
+ $ wget https://raw.githubusercontent.com/sqlite/sqlite/master/ext/misc/spellfix.c
186
+ spellfix.c 100%[=================================================>] 100.89K --.-KB/s in 0.09s
187
+
188
+ # follow instructions at https://www.sqlite.org/loadext.html
189
+ # (you will need sqlite3 development packages for this)
190
+ $ gcc -g -fPIC -shared spellfix.c -o spellfix.o
191
+
192
+ $ ls -lt
193
+ total 192
194
+ -rwxrwxr-x 1 flavorjones flavorjones 87984 2023-05-24 10:44 spellfix.o
195
+ -rw-rw-r-- 1 flavorjones flavorjones 103310 2023-05-24 10:43 spellfix.c
196
+ ```
197
+
198
+ Then, in your application, use that `spellfix.o` file like this:
199
+
200
+ ``` ruby
201
+ require "sqlite3"
202
+
203
+ db = SQLite3::Database.new(':memory:')
204
+ db.enable_load_extension(true)
205
+ db.load_extension("/path/to/sqlite/spellfix.o")
206
+ db.execute("CREATE VIRTUAL TABLE demo USING spellfix1;")
207
+ ```
208
+
209
+ ### How do I use my own sqlite3 shared library?
210
+
211
+ Some folks have strong opinions about what features they want compiled into sqlite3; or may be using a package like SQLite Encryption Extension ("SEE"). This section will explain how to get your Ruby application to load that specific shared library.
212
+
213
+ If you've installed your alternative as an autotools-style installation, the directory structure will look like this:
214
+
215
+ ```
216
+ /opt/sqlite3
217
+ ├── bin
218
+ │   └── sqlite3
219
+ ├── include
220
+ │   ├── sqlite3.h
221
+ │   └── sqlite3ext.h
222
+ ├── lib
223
+ │   ├── libsqlite3.a
224
+ │   ├── libsqlite3.la
225
+ │   ├── libsqlite3.so -> libsqlite3.so.0.8.6
226
+ │   ├── libsqlite3.so.0 -> libsqlite3.so.0.8.6
227
+ │   ├── libsqlite3.so.0.8.6
228
+ │   └── pkgconfig
229
+ │   └── sqlite3.pc
230
+ └── share
231
+ └── man
232
+ └── man1
233
+ └── sqlite3.1
234
+ ```
235
+
236
+ You can build this gem against that library like this:
237
+
238
+ ```
239
+ gem install sqlite3 --platform=ruby -- \
240
+ --enable-system-libraries \
241
+ --with-opt-dir=/opt/sqlite
242
+ ```
243
+
244
+ Explanation:
245
+
246
+ - use `--platform=ruby` to avoid the precompiled native gems (see the README)
247
+ - the `--` separates arguments passed to "gem install" from arguments passed to the C extension builder
248
+ - use `--enable-system-libraries` to avoid the vendored sqlite3 source
249
+ - use `--with-opt-dir=/path/to/installation` to point the build process at the desired header files and shared object files
250
+
251
+ Alternatively, if you've simply downloaded an "amalgamation" and so your compiled library and header files are in arbitrary locations, try this more detailed command:
252
+
253
+ ```
254
+ gem install sqlite3 --platform=ruby -- \
255
+ --enable-system-libraries \
256
+ --with-opt-include=/path/to/include \
257
+ --with-opt-lib=/path/to/lib
258
+ ```
259
+
data/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Ruby Interface for SQLite3
2
2
 
3
+ ## Overview
4
+
5
+ This library allows Ruby programs to use the SQLite3 database engine (http://www.sqlite.org).
6
+
7
+ Note that this module is only compatible with SQLite 3.6.16 or newer.
8
+
3
9
  * Source code: https://github.com/sparklemotion/sqlite3-ruby
4
10
  * Mailing list: http://groups.google.com/group/sqlite3-ruby
5
11
  * Download: http://rubygems.org/gems/sqlite3
@@ -9,14 +15,18 @@
9
15
  [![Native packages](https://github.com/sparklemotion/sqlite3-ruby/actions/workflows/gem-install.yml/badge.svg)](https://github.com/sparklemotion/sqlite3-ruby/actions/workflows/gem-install.yml)
10
16
 
11
17
 
12
- ## Description
18
+ ## Quick start
13
19
 
14
- This library allows Ruby programs to use the SQLite3 database engine (http://www.sqlite.org).
20
+ For help understanding the SQLite3 Ruby API, please read the [FAQ](./FAQ.md) and the [full API documentation](https://rubydoc.info/gems/sqlite3).
15
21
 
16
- Note that this module is only compatible with SQLite 3.6.16 or newer.
22
+ A few key classes whose APIs are often-used are:
23
+
24
+ - SQLite3::Database ([rdoc](https://rubydoc.info/gems/sqlite3/SQLite3/Database))
25
+ - SQLite3::Statement ([rdoc](https://rubydoc.info/gems/sqlite3/SQLite3/Statement))
26
+ - SQLite3::ResultSet ([rdoc](https://rubydoc.info/gems/sqlite3/SQLite3/ResultSet))
17
27
 
28
+ If you have any questions that you feel should be addressed in the FAQ, please send them to [the mailing list](http://groups.google.com/group/sqlite3-ruby) or open a [discussion thread](https://github.com/sparklemotion/sqlite3-ruby/discussions/categories/q-a).
18
29
 
19
- ## Synopsis
20
30
 
21
31
  ``` ruby
22
32
  require "sqlite3"
@@ -67,157 +77,22 @@ end
67
77
  # => ["Jane", "me@janedoe.com", "A", "http://blog.janedoe.com"]
68
78
  ```
69
79
 
70
- ## Installation
71
-
72
- ### Native Gems (recommended)
73
-
74
- In v1.5.0 and later, native (precompiled) gems are available for recent Ruby versions on these platforms:
75
-
76
- - `aarch64-linux` (requires: glibc >= 2.29)
77
- - `arm-linux` (requires: glibc >= 2.29)
78
- - `arm64-darwin`
79
- - `x64-mingw32` / `x64-mingw-ucrt`
80
- - `x86-linux` (requires: glibc >= 2.17)
81
- - `x86_64-darwin`
82
- - `x86_64-linux` (requires: glibc >= 2.17)
83
-
84
- If you are using one of these Ruby versions on one of these platforms, the native gem is the recommended way to install sqlite3-ruby.
85
-
86
- For example, on a linux system running Ruby 3.1:
87
-
88
- ``` text
89
- $ ruby -v
90
- ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
91
-
92
- $ time gem install sqlite3
93
- Fetching sqlite3-1.5.0-x86_64-linux.gem
94
- Successfully installed sqlite3-1.5.0-x86_64-linux
95
- 1 gem installed
96
-
97
- real 0m4.274s
98
- user 0m0.734s
99
- sys 0m0.165s
100
- ```
101
-
102
- #### Avoiding the precompiled native gem
103
-
104
- The maintainers strongly urge you to use a native gem if at all possible. It will be a better experience for you and allow us to focus our efforts on improving functionality rather than diagnosing installation issues.
105
-
106
- If you're on a platform that supports a native gem but you want to avoid using it in your project, do one of the following:
107
-
108
- - If you're not using Bundler, then run `gem install sqlite3 --platform=ruby`
109
- - If you are using Bundler
110
- - version 2.3.18 or later, you can specify [`gem "sqlite3", force_ruby_platform: true`](https://bundler.io/v2.3/man/gemfile.5.html#FORCE_RUBY_PLATFORM)
111
- - version 2.1 or later, then you'll need to run `bundle config set force_ruby_platform true`
112
- - version 2.0 or earlier, then you'll need to run `bundle config force_ruby_platform true`
113
-
114
-
115
- ### Compiling the source gem
116
-
117
- If you are on a platform or version of Ruby that is not covered by the Native Gems, then the vanilla "ruby platform" (non-native) gem will be installed by the `gem install` or `bundle` commands.
118
-
119
-
120
- #### Packaged libsqlite3
121
-
122
- By default, as of v1.5.0 of this library, the latest available version of libsqlite3 is packaged with the gem and will be compiled and used automatically. This takes a bit longer than the native gem, but will provide a modern, well-supported version of libsqlite3.
123
-
124
- For example, on a linux system running Ruby 2.5:
125
-
126
- ``` text
127
- $ ruby -v
128
- ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]
129
-
130
- $ time gem install sqlite3
131
- Building native extensions. This could take a while...
132
- Successfully installed sqlite3-1.5.0
133
- 1 gem installed
134
-
135
- real 0m20.620s
136
- user 0m23.361s
137
- sys 0m5.839s
138
- ```
139
-
140
-
141
- #### System libsqlite3
142
-
143
- If you would prefer to build the sqlite3-ruby gem against your system libsqlite3, which requires that you install libsqlite3 and its development files yourself, you may do so by using the `--enable-system-libraries` flag at gem install time.
144
-
145
- PLEASE NOTE:
146
-
147
- - you must avoid installing a precompiled native gem (see [previous section](#avoiding-the-precompiled-native-gem))
148
- - only versions of libsqlite3 `>= 3.5.0` are supported,
149
- - and some library features may depend on how your libsqlite3 was compiled.
150
-
151
- For example, on a linux system running Ruby 2.5:
152
-
153
- ``` text
154
- $ time gem install sqlite3 -- --enable-system-libraries
155
- Building native extensions with: '--enable-system-libraries'
156
- This could take a while...
157
- Successfully installed sqlite3-1.5.0
158
- 1 gem installed
159
-
160
- real 0m4.234s
161
- user 0m3.809s
162
- sys 0m0.912s
163
- ```
164
-
165
- If you're using bundler, you can opt into system libraries like this:
166
-
167
- ``` sh
168
- bundle config build.sqlite3 --enable-system-libraries
169
- ```
170
-
171
- If you have sqlite3 installed in a non-standard location, you may need to specify the location of the include and lib files by using `--with-sqlite-include` and `--with-sqlite-lib` options (or a `--with-sqlite-dir` option, see [MakeMakefile#dir_config](https://ruby-doc.org/stdlib-3.1.1/libdoc/mkmf/rdoc/MakeMakefile.html#method-i-dir_config)). If you have pkg-config installed and configured properly, this may not be necessary.
172
-
173
- ``` sh
174
- gem install sqlite3 -- \
175
- --enable-system-libraries \
176
- --with-sqlite3-include=/opt/local/include \
177
- --with-sqlite3-lib=/opt/local/lib
178
- ```
179
-
180
-
181
- #### System libsqlcipher
182
-
183
- If you'd like to link against a system-installed libsqlcipher, you may do so by using the `--with-sqlcipher` flag:
184
-
185
- ``` text
186
- $ time gem install sqlite3 -- --with-sqlcipher
187
- Building native extensions with: '--with-sqlcipher'
188
- This could take a while...
189
- Successfully installed sqlite3-1.5.0
190
- 1 gem installed
191
-
192
- real 0m4.772s
193
- user 0m3.906s
194
- sys 0m0.896s
195
- ```
196
-
197
- If you have sqlcipher installed in a non-standard location, you may need to specify the location of the include and lib files by using `--with-sqlite-include` and `--with-sqlite-lib` options (or a `--with-sqlite-dir` option, see [MakeMakefile#dir_config](https://ruby-doc.org/stdlib-3.1.1/libdoc/mkmf/rdoc/MakeMakefile.html#method-i-dir_config)). If you have pkg-config installed and configured properly, this may not be necessary.
198
-
199
-
200
80
  ## Support
201
81
 
202
- ### Something has gone wrong! Where do I get help?
203
-
204
- You can ask for help or support from the
205
- [sqlite3-ruby mailing list](http://groups.google.com/group/sqlite3-ruby) which
206
- can be found here:
207
-
208
- > http://groups.google.com/group/sqlite3-ruby
209
-
82
+ ### Installation or database extensions
210
83
 
211
- ### I've found a bug! How do I report it?
84
+ If you're having trouble with installation, please first read [`INSTALLATION.md`](./INSTALLATION.md).
212
85
 
213
- After contacting the mailing list, you've found that you've uncovered a bug. You can file the bug at the [github issues page](https://github.com/sparklemotion/sqlite3-ruby/issues) which can be found here:
86
+ ### General help requests
214
87
 
215
- > https://github.com/sparklemotion/sqlite3-ruby/issues
88
+ You can ask for help or support:
216
89
 
90
+ * by emailing the [sqlite3-ruby mailing list](http://groups.google.com/group/sqlite3-ruby)
91
+ * by opening a [discussion thread](https://github.com/sparklemotion/sqlite3-ruby/discussions/categories/q-a) on Github
217
92
 
218
- ## Usage
93
+ ### Bug reports
219
94
 
220
- For help figuring out the SQLite3/Ruby interface, check out the SYNOPSIS as well as the RDoc. It includes examples of usage. If you have any questions that you feel should be addressed in the FAQ, please send them to [the mailing list](http://groups.google.com/group/sqlite3-ruby).
95
+ You can file the bug at the [github issues page](https://github.com/sparklemotion/sqlite3-ruby/issues).
221
96
 
222
97
 
223
98
  ## Contributing
data/dependencies.yml CHANGED
@@ -2,13 +2,13 @@
2
2
  :sqlite3:
3
3
  # checksum verified by first checking the published sha3(256) checksum against https://sqlite.org/download.html:
4
4
  #
5
- # $ sha3sum -a 256 ports/archives/sqlite-autoconf-3420000.tar.gz
6
- # 643898e9fcc8f6069bcd47b0e6057221c1ed17bbee57da20d2752c79d91274e8 ports/archives/sqlite-autoconf-3420000.tar.gz
5
+ # $ sha3sum -a 256 ports/archives/sqlite-autoconf-3430000.tar.gz
6
+ # cc321c7b0a70f87aaefe5d0aa89cdd97b432c3d2d448fa623f20988007c49f34 ports/archives/sqlite-autoconf-3430000.tar.gz
7
7
  #
8
- # $ sha256sum ports/archives/sqlite-autoconf-3420000.tar.gz
9
- # 7abcfd161c6e2742ca5c6c0895d1f853c940f203304a0b49da4e1eca5d088ca6 ports/archives/sqlite-autoconf-3420000.tar.gz
8
+ # $ sha256sum ports/archives/sqlite-autoconf-3430000.tar.gz
9
+ # 49008dbf3afc04d4edc8ecfc34e4ead196973034293c997adad2f63f01762ae1 ports/archives/sqlite-autoconf-3430000.tar.gz
10
10
  #
11
- :version: "3.42.0"
11
+ :version: "3.43.0"
12
12
  :files:
13
- - :url: "https://sqlite.org/2023/sqlite-autoconf-3420000.tar.gz"
14
- :sha256: "7abcfd161c6e2742ca5c6c0895d1f853c940f203304a0b49da4e1eca5d088ca6"
13
+ - :url: "https://sqlite.org/2023/sqlite-autoconf-3430000.tar.gz"
14
+ :sha256: "49008dbf3afc04d4edc8ecfc34e4ead196973034293c997adad2f63f01762ae1"
@@ -51,12 +51,13 @@ module Sqlite3
51
51
  minimal_recipe.tap do |recipe|
52
52
  recipe.configure_options += ["--enable-shared=no", "--enable-static=yes"]
53
53
  ENV.to_h.tap do |env|
54
- additional_cflags = [
54
+ user_cflags = with_config("sqlite-cflags")
55
+ more_cflags = [
55
56
  "-fPIC", # needed for linking the static library into a shared library
56
57
  "-O2", # see https://github.com/sparklemotion/sqlite3-ruby/issues/335 for some benchmarks
57
58
  "-fvisibility=hidden", # see https://github.com/rake-compiler/rake-compiler-dock/issues/87
58
59
  ]
59
- env["CFLAGS"] = [env["CFLAGS"], additional_cflags].flatten.join(" ")
60
+ env["CFLAGS"] = [user_cflags, env["CFLAGS"], more_cflags].flatten.join(" ")
60
61
  recipe.configure_options += env.select { |k,v| ENV_ALLOWLIST.include?(k) }
61
62
  .map { |key, value| "#{key}=#{value.strip}" }
62
63
  end
@@ -234,17 +235,23 @@ module Sqlite3
234
235
 
235
236
  Flags only used when building and using the packaged libraries:
236
237
 
238
+ --with-sqlite-cflags=CFLAGS
239
+ Explicitly pass compiler flags to the sqlite library build. These flags will
240
+ appear on the commandline before any flags set in the CFLAGS environment
241
+ variable. This is useful for setting compilation options in your project's
242
+ bundler config. See INSTALLATION.md for more information.
243
+
237
244
  --enable-cross-build
238
245
  Enable cross-build mode. (You probably do not want to set this manually.)
239
246
 
240
247
 
241
- Environment variables used for compiling the C extension:
248
+ Environment variables used for compiling the gem's C extension:
242
249
 
243
250
  CC
244
251
  Use this path to invoke the compiler instead of `RbConfig::CONFIG['CC']`
245
252
 
246
253
 
247
- Environment variables passed through to the compilation of packaged libraries:
254
+ Environment variables passed through to the compilation of sqlite:
248
255
 
249
256
  CC
250
257
  CPPFLAGS
Binary file
Binary file
Binary file
Binary file
@@ -1,11 +1,11 @@
1
1
  module SQLite3
2
2
 
3
- VERSION = "1.6.3"
3
+ VERSION = "1.6.5"
4
4
 
5
5
  module VersionProxy
6
6
  MAJOR = 1
7
7
  MINOR = 6
8
- TINY = 3
8
+ TINY = 5
9
9
  BUILD = nil
10
10
 
11
11
  STRING = [ MAJOR, MINOR, TINY, BUILD ].compact.join( "." )
@@ -77,10 +77,10 @@ class TC_Statement < SQLite3::TestCase
77
77
  def test_bind_param_with_various_types
78
78
  @db.transaction do
79
79
  @db.execute "create table all_types ( a integer primary key, b float, c string, d integer )"
80
- @db.execute "insert into all_types ( b, c, d ) values ( 1.4, 'hello', 68719476735 )"
80
+ @db.execute "insert into all_types ( b, c, d ) values ( 1.5, 'hello', 68719476735 )"
81
81
  end
82
82
 
83
- assert_equal 1, @db.execute( "select * from all_types where b = ?", 1.4 ).length
83
+ assert_equal 1, @db.execute( "select * from all_types where b = ?", 1.5 ).length
84
84
  assert_equal 1, @db.execute( "select * from all_types where c = ?", 'hello').length
85
85
  assert_equal 1, @db.execute( "select * from all_types where d = ?", 68719476735).length
86
86
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlite3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3
4
+ version: 1.6.5
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Jamis Buck
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-05-16 00:00:00.000000000 Z
13
+ date: 2023-09-09 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: |-
16
16
  This module allows Ruby programs to interface with the SQLite3
@@ -37,7 +37,9 @@ files:
37
37
  - CHANGELOG.md
38
38
  - CONTRIBUTING.md
39
39
  - ChangeLog.cvs
40
+ - FAQ.md
40
41
  - Gemfile
42
+ - INSTALLATION.md
41
43
  - LICENSE
42
44
  - LICENSE-DEPENDENCIES
43
45
  - README.md
@@ -55,9 +57,6 @@ files:
55
57
  - ext/sqlite3/sqlite3_ruby.h
56
58
  - ext/sqlite3/statement.c
57
59
  - ext/sqlite3/statement.h
58
- - faq/faq.md
59
- - faq/faq.rb
60
- - faq/faq.yml
61
60
  - lib/sqlite3.rb
62
61
  - lib/sqlite3/2.7/sqlite3_native.bundle
63
62
  - lib/sqlite3/3.0/sqlite3_native.bundle
data/faq/faq.rb DELETED
@@ -1,145 +0,0 @@
1
- require 'yaml'
2
- require 'redcloth'
3
-
4
- def process_faq_list( faqs )
5
- puts "<ul>"
6
- faqs.each do |faq|
7
- process_faq_list_item faq
8
- end
9
- puts "</ul>"
10
- end
11
-
12
- def process_faq_list_item( faq )
13
- question = faq.keys.first
14
- answer = faq.values.first
15
-
16
- print "<li>"
17
-
18
- question_text = RedCloth.new(question).to_html.gsub( %r{</?p>},"" )
19
- if answer.is_a?( Array )
20
- puts question_text
21
- process_faq_list answer
22
- else
23
- print "<a href='##{question.object_id}'>#{question_text}</a>"
24
- end
25
-
26
- puts "</li>"
27
- end
28
-
29
- def process_faq_descriptions( faqs, path=nil )
30
- faqs.each do |faq|
31
- process_faq_description faq, path
32
- end
33
- end
34
-
35
- def process_faq_description( faq, path )
36
- question = faq.keys.first
37
- path = ( path ? path + " " : "" ) + question
38
- answer = faq.values.first
39
-
40
- if answer.is_a?( Array )
41
- process_faq_descriptions( answer, path )
42
- else
43
- title = RedCloth.new( path ).to_html.gsub( %r{</?p>}, "" )
44
- answer = RedCloth.new( answer || "" )
45
-
46
- puts "<a name='#{question.object_id}'></a>"
47
- puts "<div class='faq-title'>#{title}</div>"
48
- puts "<div class='faq-answer'>#{add_api_links(answer.to_html)}</div>"
49
- end
50
- end
51
-
52
- API_OBJECTS = [ "Database", "Statement", "ResultSet",
53
- "ParsedStatement", "Pragmas", "Translator" ].inject( "(" ) { |acc,name|
54
- acc << "|" if acc.length > 1
55
- acc << name
56
- acc
57
- } + ")"
58
-
59
- def add_api_links( text )
60
- text.gsub( /#{API_OBJECTS}(#(\w+))?/ ) do
61
- disp_obj = obj = $1
62
-
63
- case obj
64
- when "Pragmas"; disp_obj = "Database"
65
- end
66
-
67
- method = $3
68
- s = "<a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/#{obj}.html'>#{disp_obj}"
69
- s << "##{method}" if method
70
- s << "</a>"
71
- s
72
- end
73
- end
74
-
75
- faqs = YAML.load( File.read( "faq.yml" ) )
76
-
77
- puts <<-EOF
78
- <html>
79
- <head>
80
- <title>SQLite3/Ruby FAQ</title>
81
- <style type="text/css">
82
- a, a:visited, a:active {
83
- color: #00F;
84
- text-decoration: none;
85
- }
86
-
87
- a:hover {
88
- text-decoration: underline;
89
- }
90
-
91
- .faq-list {
92
- color: #000;
93
- font-family: vera-sans, verdana, arial, sans-serif;
94
- }
95
-
96
- .faq-title {
97
- background: #007;
98
- color: #FFF;
99
- font-family: vera-sans, verdana, arial, sans-serif;
100
- padding-left: 1em;
101
- padding-top: 0.5em;
102
- padding-bottom: 0.5em;
103
- font-weight: bold;
104
- font-size: large;
105
- border: 1px solid #000;
106
- }
107
-
108
- .faq-answer {
109
- margin-left: 1em;
110
- color: #000;
111
- font-family: vera-sans, verdana, arial, sans-serif;
112
- }
113
-
114
- .faq-answer pre {
115
- margin-left: 1em;
116
- color: #000;
117
- background: #FFE;
118
- font-size: normal;
119
- border: 1px dotted #CCC;
120
- padding: 1em;
121
- }
122
-
123
- h1 {
124
- background: #005;
125
- color: #FFF;
126
- font-family: vera-sans, verdana, arial, sans-serif;
127
- padding-left: 1em;
128
- padding-top: 1em;
129
- padding-bottom: 1em;
130
- font-weight: bold;
131
- font-size: x-large;
132
- border: 1px solid #00F;
133
- }
134
- </style>
135
- </head>
136
- <body>
137
- <h1>SQLite/Ruby FAQ</h1>
138
- <div class="faq-list">
139
- EOF
140
-
141
- process_faq_list( faqs )
142
- puts "</div>"
143
- process_faq_descriptions( faqs )
144
-
145
- puts "</body></html>"
data/faq/faq.yml DELETED
@@ -1,426 +0,0 @@
1
- ---
2
- - "How do I do a database query?":
3
- - "I just want an array of the rows...": >-
4
-
5
- Use the Database#execute method. If you don't give it a block, it will
6
- return an array of all the rows:
7
-
8
-
9
- <pre>
10
- require 'sqlite3'
11
-
12
- db = SQLite3::Database.new( "test.db" )
13
- rows = db.execute( "select * from test" )
14
- </pre>
15
-
16
- - "I'd like to use a block to iterate through the rows...": >-
17
-
18
- Use the Database#execute method. If you give it a block, each row of the
19
- result will be yielded to the block:
20
-
21
-
22
- <pre>
23
- require 'sqlite3'
24
-
25
- db = SQLite3::Database.new( "test.db" )
26
- db.execute( "select * from test" ) do |row|
27
- ...
28
- end
29
- </pre>
30
-
31
- - "I need to get the column names as well as the rows...": >-
32
-
33
- Use the Database#execute2 method. This works just like Database#execute;
34
- if you don't give it a block, it returns an array of rows; otherwise, it
35
- will yield each row to the block. _However_, the first row returned is
36
- always an array of the column names from the query:
37
-
38
-
39
- <pre>
40
- require 'sqlite3'
41
-
42
- db = SQLite3::Database.new( "test.db" )
43
- columns, *rows = db.execute2( "select * from test" )
44
-
45
- # or use a block:
46
-
47
- columns = nil
48
- db.execute2( "select * from test" ) do |row|
49
- if columns.nil?
50
- columns = row
51
- else
52
- # process row
53
- end
54
- end
55
- </pre>
56
-
57
- - "I just want the first row of the result set...": >-
58
-
59
- Easy. Just call Database#get_first_row:
60
-
61
-
62
- <pre>
63
- row = db.get_first_row( "select * from table" )
64
- </pre>
65
-
66
-
67
- This also supports bind variables, just like Database#execute
68
- and friends.
69
-
70
- - "I just want the first value of the first row of the result set...": >-
71
-
72
- Also easy. Just call Database#get_first_value:
73
-
74
-
75
- <pre>
76
- count = db.get_first_value( "select count(*) from table" )
77
- </pre>
78
-
79
-
80
- This also supports bind variables, just like Database#execute
81
- and friends.
82
-
83
- - "How do I prepare a statement for repeated execution?": >-
84
- If the same statement is going to be executed repeatedly, you can speed
85
- things up a bit by _preparing_ the statement. You do this via the
86
- Database#prepare method. It returns a Statement object, and you can
87
- then invoke #execute on that to get the ResultSet:
88
-
89
-
90
- <pre>
91
- stmt = db.prepare( "select * from person" )
92
-
93
- 1000.times do
94
- stmt.execute do |result|
95
- ...
96
- end
97
- end
98
-
99
- stmt.close
100
-
101
- # or, use a block
102
-
103
- db.prepare( "select * from person" ) do |stmt|
104
- 1000.times do
105
- stmt.execute do |result|
106
- ...
107
- end
108
- end
109
- end
110
- </pre>
111
-
112
-
113
- This is made more useful by the ability to bind variables to placeholders
114
- via the Statement#bind_param and Statement#bind_params methods. (See the
115
- next FAQ for details.)
116
-
117
- - "How do I use placeholders in an SQL statement?": >-
118
- Placeholders in an SQL statement take any of the following formats:
119
-
120
-
121
- * @?@
122
-
123
- * @?_nnn_@
124
-
125
- * @:_word_@
126
-
127
-
128
- Where _n_ is an integer, and _word_ is an alpha-numeric identifier (or
129
- number). When the placeholder is associated with a number, that number
130
- identifies the index of the bind variable to replace it with. When it
131
- is an identifier, it identifies the name of the corresponding bind
132
- variable. (In the instance of the first format--a single question
133
- mark--the placeholder is assigned a number one greater than the last
134
- index used, or 1 if it is the first.)
135
-
136
-
137
- For example, here is a query using these placeholder formats:
138
-
139
-
140
- <pre>
141
- select *
142
- from table
143
- where ( c = ?2 or c = ? )
144
- and d = :name
145
- and e = :1
146
- </pre>
147
-
148
-
149
- This defines 5 different placeholders: 1, 2, 3, and "name".
150
-
151
-
152
- You replace these placeholders by _binding_ them to values. This can be
153
- accomplished in a variety of ways.
154
-
155
-
156
- The Database#execute, and Database#execute2 methods all accept additional
157
- arguments following the SQL statement. These arguments are assumed to be
158
- bind parameters, and they are bound (positionally) to their corresponding
159
- placeholders:
160
-
161
-
162
- <pre>
163
- db.execute( "select * from table where a = ? and b = ?",
164
- "hello",
165
- "world" )
166
- </pre>
167
-
168
-
169
- The above would replace the first question mark with 'hello' and the
170
- second with 'world'. If the placeholders have an explicit index given, they
171
- will be replaced with the bind parameter at that index (1-based).
172
-
173
-
174
- If a Hash is given as a bind parameter, then its key/value pairs are bound
175
- to the placeholders. This is how you bind by name:
176
-
177
-
178
- <pre>
179
- db.execute( "select * from table where a = :name and b = :value",
180
- "name" => "bob",
181
- "value" => "priceless" )
182
- </pre>
183
-
184
-
185
- You can also bind explicitly using the Statement object itself. Just pass
186
- additional parameters to the Statement#execute statement:
187
-
188
-
189
- <pre>
190
- db.prepare( "select * from table where a = :name and b = ?" ) do |stmt|
191
- stmt.execute "value", "name" => "bob"
192
- end
193
- </pre>
194
-
195
-
196
- Or do a Database#prepare to get the Statement, and then use either
197
- Statement#bind_param or Statement#bind_params:
198
-
199
-
200
- <pre>
201
- stmt = db.prepare( "select * from table where a = :name and b = ?" )
202
-
203
- stmt.bind_param( "name", "bob" )
204
- stmt.bind_param( 1, "value" )
205
-
206
- # or
207
-
208
- stmt.bind_params( "value", "name" => "bob" )
209
- </pre>
210
-
211
- - "How do I discover metadata about a query?": >-
212
-
213
- If you ever want to know the names or types of the columns in a result
214
- set, you can do it in several ways.
215
-
216
-
217
- The first way is to ask the row object itself. Each row will have a
218
- property "fields" that returns an array of the column names. The row
219
- will also have a property "types" that returns an array of the column
220
- types:
221
-
222
-
223
- <pre>
224
- rows = db.execute( "select * from table" )
225
- p rows[0].fields
226
- p rows[0].types
227
- </pre>
228
-
229
-
230
- Obviously, this approach requires you to execute a statement that actually
231
- returns data. If you don't know if the statement will return any rows, but
232
- you still need the metadata, you can use Database#query and ask the
233
- ResultSet object itself:
234
-
235
-
236
- <pre>
237
- db.query( "select * from table" ) do |result|
238
- p result.columns
239
- p result.types
240
- ...
241
- end
242
- </pre>
243
-
244
-
245
- Lastly, you can use Database#prepare and ask the Statement object what
246
- the metadata are:
247
-
248
-
249
- <pre>
250
- stmt = db.prepare( "select * from table" )
251
- p stmt.columns
252
- p stmt.types
253
- </pre>
254
-
255
- - "I'd like the rows to be indexible by column name.": >-
256
- By default, each row from a query is returned as an Array of values. This
257
- means that you can only obtain values by their index. Sometimes, however,
258
- you would like to obtain values by their column name.
259
-
260
-
261
- The first way to do this is to set the Database property "results_as_hash"
262
- to true. If you do this, then all rows will be returned as Hash objects,
263
- with the column names as the keys. (In this case, the "fields" property
264
- is unavailable on the row, although the "types" property remains.)
265
-
266
-
267
- <pre>
268
- db.results_as_hash = true
269
- db.execute( "select * from table" ) do |row|
270
- p row['column1']
271
- p row['column2']
272
- end
273
- </pre>
274
-
275
-
276
- The other way is to use Ara Howard's
277
- "ArrayFields":http://rubyforge.org/projects/arrayfields
278
- module. Just require "arrayfields", and all of your rows will be indexable
279
- by column name, even though they are still arrays!
280
-
281
-
282
- <pre>
283
- require 'arrayfields'
284
-
285
- ...
286
- db.execute( "select * from table" ) do |row|
287
- p row[0] == row['column1']
288
- p row[1] == row['column2']
289
- end
290
- </pre>
291
-
292
- - "I'd like the values from a query to be the correct types, instead of String.": >-
293
- You can turn on "type translation" by setting Database#type_translation to
294
- true:
295
-
296
-
297
- <pre>
298
- db.type_translation = true
299
- db.execute( "select * from table" ) do |row|
300
- p row
301
- end
302
- </pre>
303
-
304
-
305
- By doing this, each return value for each row will be translated to its
306
- correct type, based on its declared column type.
307
-
308
-
309
- You can even declare your own translation routines, if (for example) you are
310
- using an SQL type that is not handled by default:
311
-
312
-
313
- <pre>
314
- # assume "objects" table has the following schema:
315
- # create table objects (
316
- # name varchar2(20),
317
- # thing object
318
- # )
319
-
320
- db.type_translation = true
321
- db.translator.add_translator( "object" ) do |type, value|
322
- db.decode( value )
323
- end
324
-
325
- h = { :one=>:two, "three"=>"four", 5=>6 }
326
- dump = db.encode( h )
327
-
328
- db.execute( "insert into objects values ( ?, ? )", "bob", dump )
329
-
330
- obj = db.get_first_value( "select thing from objects where name='bob'" )
331
- p obj == h
332
- </pre>
333
-
334
- - "How do I insert binary data into the database?": >-
335
- Use blobs. Blobs are new features of SQLite3. You have to use bind
336
- variables to make it work:
337
-
338
-
339
- <pre>
340
- db.execute( "insert into foo ( ?, ? )",
341
- SQLite3::Blob.new( "\0\1\2\3\4\5" ),
342
- SQLite3::Blob.new( "a\0b\0c\0d ) )
343
- </pre>
344
-
345
-
346
- The blob values must be indicated explicitly by binding each parameter to
347
- a value of type SQLite3::Blob.
348
-
349
- - "How do I do a DDL (insert, update, delete) statement?": >-
350
- You can actually do inserts, updates, and deletes in exactly the same way
351
- as selects, but in general the Database#execute method will be most
352
- convenient:
353
-
354
-
355
- <pre>
356
- db.execute( "insert into table values ( ?, ? )", *bind_vars )
357
- </pre>
358
-
359
- - "How do I execute multiple statements in a single string?": >-
360
- The standard query methods (Database#execute, Database#execute2,
361
- Database#query, and Statement#execute) will only execute the first
362
- statement in the string that is given to them. Thus, if you have a
363
- string with multiple SQL statements, each separated by a string,
364
- you can't use those methods to execute them all at once.
365
-
366
-
367
- Instead, use Database#execute_batch:
368
-
369
-
370
- <pre>
371
- sql = <<SQL
372
- create table the_table (
373
- a varchar2(30),
374
- b varchar2(30)
375
- );
376
-
377
- insert into the_table values ( 'one', 'two' );
378
- insert into the_table values ( 'three', 'four' );
379
- insert into the_table values ( 'five', 'six' );
380
- SQL
381
-
382
- db.execute_batch( sql )
383
- </pre>
384
-
385
-
386
- Unlike the other query methods, Database#execute_batch accepts no
387
- block. It will also only ever return +nil+. Thus, it is really only
388
- suitable for batch processing of DDL statements.
389
-
390
- - "How do I begin/end a transaction?":
391
- Use Database#transaction to start a transaction. If you give it a block,
392
- the block will be automatically committed at the end of the block,
393
- unless an exception was raised, in which case the transaction will be
394
- rolled back. (Never explicitly call Database#commit or Database#rollback
395
- inside of a transaction block--you'll get errors when the block
396
- terminates!)
397
-
398
-
399
- <pre>
400
- database.transaction do |db|
401
- db.execute( "insert into table values ( 'a', 'b', 'c' )" )
402
- ...
403
- end
404
- </pre>
405
-
406
-
407
- Alternatively, if you don't give a block to Database#transaction, the
408
- transaction remains open until you explicitly call Database#commit or
409
- Database#rollback.
410
-
411
-
412
- <pre>
413
- db.transaction
414
- db.execute( "insert into table values ( 'a', 'b', 'c' )" )
415
- db.commit
416
- </pre>
417
-
418
-
419
- Note that SQLite does not allow nested transactions, so you'll get errors
420
- if you try to open a new transaction while one is already active. Use
421
- Database#transaction_active? to determine whether a transaction is
422
- active or not.
423
-
424
- #- "How do I discover metadata about a table/index?":
425
- #
426
- #- "How do I do tweak database settings?":
File without changes