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
The library `sqlite3-ruby` (which lives at https://github.com/sparklemotion/sqlite3-ruby) may include the source code for `sqlite` (which lives at https://www.sqlite.org/)
4
+
5
+
`sqlite` source code is licensed under the public domain:
6
+
7
+
> https://www.sqlite.org/copyright.html
8
+
9
+
The license terms shipped with `sqlite` are included here for your convenience:
10
+
11
+
```
12
+
The author disclaims copyright to this source code. In place of
13
+
a legal notice, here is a blessing:
14
+
15
+
May you do good and not evil.
16
+
May you find forgiveness for yourself and forgive others.
17
+
May you share freely, never taking more than you give.
18
+
```
19
+
20
+
Note that these license terms do not apply to the `sqlite3-ruby` library itself.
This module allows Ruby programs to interface with the SQLite3 database engine (http://www.sqlite.org). You must have the SQLite engine installed in order to build this module.
14
+
This library allows Ruby programs to use the SQLite3 database engine (http://www.sqlite.org).
14
15
15
16
Note that this module is only compatible with SQLite 3.6.16 or newer.
16
17
@@ -43,9 +44,10 @@ end
43
44
db.execute( "select * from numbers" ) do |row|
44
45
p row
45
46
end
47
+
# => ["one", 1]
48
+
# ["two", 2]
46
49
47
50
# Create another table with multiple columns
48
-
49
51
db.execute <<-SQL
50
52
createtablestudents (
51
53
name varchar(50),
@@ -62,34 +64,142 @@ db.execute("INSERT INTO students (name, email, grade, blog)
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.
68
105
69
-
Install SQLite3, enabling the option SQLITE_ENABLE_COLUMN_METADATA (see [www.sqlite.org/compile.html](https://www.sqlite.org/compile.html) for details).
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:
70
107
71
-
Then do the following:
108
+
- If you're not using Bundler, then run `gem install sqlite3 --platform=ruby`
109
+
- If you are using Bundler
110
+
- version 2.1 or later, then you'll need to run `bundle config set force_ruby_platform true`,
111
+
- version 2.0 or earlier, then you'll need to run `bundle config force_ruby_platform true`
112
+
113
+
114
+
### Compiling the Native Extension
115
+
116
+
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.
117
+
118
+
119
+
#### Packaged libsqlite3
120
+
121
+
By default, as of v1.5.0 of this library, libsqlite3 v3.38.5 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.
Building native extensions. This could take a while...
131
+
Successfully installed sqlite3-1.5.0
132
+
1 gem installed
133
+
134
+
real 0m20.620s
135
+
user 0m23.361s
136
+
sys 0m5.839s
137
+
```
72
138
73
-
ruby setup.rb config
74
-
ruby setup.rb setup
75
-
ruby setup.rb install
76
139
77
-
Alternatively, you can download and install the RubyGem package for
78
-
SQLite3/Ruby (you must have RubyGems and SQLite3 installed, first):
140
+
#### System libsqlite3
79
141
80
-
gem install sqlite3
142
+
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.
81
143
82
-
If you have sqlite3 installed in a non-standard location, you can specify the location of the include and lib files by doing:
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.
170
+
171
+
```sh
172
+
gem install sqlite3 -- \
173
+
--enable-system-libraries \
174
+
--with-sqlite3-include=/opt/local/include \
175
+
--with-sqlite3-lib=/opt/local/lib
176
+
```
177
+
178
+
179
+
#### System libsqlcipher
180
+
181
+
If you'd like to link against a system-installed libsqlcipher, you may do so by using the `--with-sqlcipher` flag:
182
+
183
+
```text
184
+
$ time gem install sqlite3 -- --with-sqlcipher
185
+
Building native extensions with: '--with-sqlcipher'
186
+
This could take a while...
187
+
Successfully installed sqlite3-1.5.0
188
+
1 gem installed
189
+
190
+
real 0m4.772s
191
+
user 0m3.906s
192
+
sys 0m0.896s
193
+
```
194
+
195
+
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.
86
196
87
197
88
198
## Support
89
199
90
200
### Something has gone wrong! Where do I get help?
91
201
92
-
The best place to get help is from the
202
+
You can ask for help or support from the
93
203
[sqlite3-ruby mailing list](http://groups.google.com/group/sqlite3-ruby) which
94
204
can be found here:
95
205
@@ -98,7 +208,7 @@ can be found here:
98
208
99
209
### I've found a bug! How do I report it?
100
210
101
-
After contacting the mailing list, you've found that you've actually discovered a bug. You can file the bug at the [github issues page](https://github.com/sparklemotion/sqlite3-ruby/issues) which can be found here:
211
+
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:
@@ -108,8 +218,16 @@ After contacting the mailing list, you've found that you've actually discovered
108
218
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).
109
219
110
220
111
-
## Source Code
221
+
## Contributing
222
+
223
+
See [`CONTRIBUTING.md`](./CONTRIBUTING.md).
224
+
225
+
226
+
## License
227
+
228
+
This library is licensed under `BSD-3-Clause`, see [`LICENSE`](./LICENSE).
The source code of `sqlite` is distributed in the "ruby platform" gem. This code is public domain, see [`LICENSE-DEPENDENCIES`](./LICENSE-DEPENDENCIES) for details.
0 commit comments