sqlite3 0.1.1 → 1.3.3.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/API_CHANGES.rdoc +50 -0
  2. data/CHANGELOG.rdoc +177 -0
  3. data/ChangeLog.cvs +88 -0
  4. data/LICENSE +24 -17
  5. data/Manifest.txt +50 -0
  6. data/README.rdoc +100 -4
  7. data/Rakefile +10 -0
  8. data/ext/sqlite3/backup.c +164 -0
  9. data/ext/sqlite3/backup.h +15 -0
  10. data/ext/sqlite3/database.c +762 -0
  11. data/ext/sqlite3/database.h +15 -0
  12. data/ext/sqlite3/exception.c +94 -0
  13. data/ext/sqlite3/exception.h +8 -0
  14. data/ext/sqlite3/extconf.rb +47 -0
  15. data/ext/sqlite3/sqlite3.c +36 -0
  16. data/ext/sqlite3/sqlite3_ruby.h +44 -0
  17. data/ext/sqlite3/statement.c +419 -0
  18. data/ext/sqlite3/statement.h +16 -0
  19. data/faq/faq.rb +145 -0
  20. data/faq/faq.yml +426 -0
  21. data/lib/sqlite3.rb +9 -12
  22. data/lib/sqlite3/constants.rb +46 -72
  23. data/lib/sqlite3/database.rb +415 -140
  24. data/lib/sqlite3/errors.rb +1 -56
  25. data/lib/sqlite3/pragmas.rb +246 -63
  26. data/lib/sqlite3/resultset.rb +30 -112
  27. data/lib/sqlite3/statement.rb +42 -108
  28. data/lib/sqlite3/translator.rb +118 -0
  29. data/lib/sqlite3/value.rb +57 -0
  30. data/lib/sqlite3/version.rb +23 -1
  31. data/setup.rb +1333 -0
  32. data/tasks/faq.rake +9 -0
  33. data/tasks/gem.rake +31 -0
  34. data/tasks/native.rake +61 -0
  35. data/tasks/vendor_sqlite3.rake +104 -0
  36. data/test/helper.rb +3 -0
  37. data/test/test_backup.rb +33 -0
  38. data/test/test_collation.rb +82 -0
  39. data/test/test_database.rb +312 -0
  40. data/test/test_database_readonly.rb +29 -0
  41. data/test/test_deprecated.rb +37 -0
  42. data/test/test_encoding.rb +119 -0
  43. data/test/test_integration.rb +544 -0
  44. data/test/test_integration_open_close.rb +30 -0
  45. data/test/test_integration_pending.rb +115 -0
  46. data/test/test_integration_resultset.rb +156 -0
  47. data/test/test_integration_statement.rb +194 -0
  48. data/test/test_sqlite3.rb +9 -0
  49. data/test/test_statement.rb +207 -0
  50. data/test/test_statement_execute.rb +35 -0
  51. metadata +124 -67
  52. data/lib/sqlite3/api.rb +0 -52
  53. data/lib/sqlite3/driver.rb +0 -138
  54. data/lib/sqlite3/encoding.rb +0 -43
  55. data/lib/sqlite3/extensions.rb +0 -27
@@ -0,0 +1,50 @@
1
+ = API Changes
2
+
3
+ * SQLite3::Database#execute only accepts an array for bind parameters.
4
+
5
+ * SQLite3::ResultSet used to query the database for the first row, regardless
6
+ of whether the user asked for it or not. I have removed that so that rows
7
+ will not be returned until the user asks for them. This is a subtle but
8
+ sometimes important change in behavior.
9
+
10
+ 83882d2208ed189361617d5ab8532a325aaf729d
11
+
12
+ * SQLite3::Database#trace now takes either a block or an object that responds
13
+ to "call". The previous implementation passed around a VALUE that was cast
14
+ to a void *. This is dangerous because the value could get garbage collected
15
+ before the proc was called. If the user wants data passed around with the
16
+ block, they should use variables available to the closure or create an
17
+ object.
18
+
19
+ * SQLite3::Statement#step automatically converts to ruby types, where before
20
+ all values were automatically yielded as strings. This will only be a
21
+ problem for people who were accessing information about the database that
22
+ wasn't previously passed through the pure ruby conversion code.
23
+
24
+ * SQLite3::Database#errmsg no longer takes a parameter to return error
25
+ messages as UTF-16. Do people even use that? I opt for staying UTF-8 when
26
+ possible. See test_integration.rb test_errmsg_utf16
27
+
28
+ * SQLite3::Database#authorize same changes as trace
29
+
30
+ * test/test_tc_database.rb was removed because we no longer use the Driver
31
+ design pattern.
32
+
33
+ = Garbage Collection Strategy
34
+
35
+ All statements keep pointers back to their respective database connections.
36
+ The @connection instance variable on the Statement handle keeps the database
37
+ connection alive. Memory allocated for a statement handler will be freed in
38
+ two cases:
39
+
40
+ * close is called on the statement
41
+ * The SQLite3::Database object gets garbage collected
42
+
43
+ We can't free the memory for the statement in the garbage collection function
44
+ for the statement handler. The reason is because there exists a race
45
+ condition. We cannot guarantee the order in which objects will be garbage
46
+ collected. So, it is possible that a connection and a statement are up for
47
+ garbage collection. If the database connection were to be free'd before the
48
+ statement, then boom. Instead we'll be conservative and free unclosed
49
+ statements when the connection is terminated.
50
+
@@ -0,0 +1,177 @@
1
+ === 1.3.3 / unreleased
2
+
3
+ * Bugfixes
4
+ * Abort on installation if sqlite3_backup_init is missing. Fixes #19
5
+ * Gem has been renamed to 'sqlite3'. Please use `gem install sqlite3`
6
+
7
+ === 1.3.2 / 2010-10-30 / RubyConf Uruguay Edition!
8
+
9
+ * Enhancements:
10
+ * Windows: build against 3.7.3 version of SQLite3
11
+ * SQLite3::Database can now be open as readonly
12
+
13
+ db = SQLite3::Database.new('my.db', :readonly => true)
14
+
15
+ * Added SQLite3::SQLITE_VERSION and SQLite3::SQLITE_VERSION_NUMBER [nurse]
16
+
17
+ * Bugfixes
18
+ * type_translation= works along with Database#execute and a block
19
+ * defined functions are kept in a hash to prevent GC. #7
20
+ * Removed GCC specific flags from extconf.
21
+
22
+ * DEPRECATIONS
23
+ * SQLite3::Database#type_translation= will be deprecated in the future with
24
+ no replacement.
25
+ * SQlite3::Version will be deprecated in 2.0.0 with SQLite3::VERSION as the
26
+ replacement.
27
+
28
+ === 1.3.1 / 2010-07-09
29
+
30
+ * Enhancements
31
+ * Custom collations may be defined using SQLite3::Database#collation
32
+
33
+ * Bugfixes
34
+ * Statements returning 0 columns are automatically stepped. [RF #28308]
35
+ * SQLite3::Database#encoding works on 1.8 and 1.9
36
+
37
+ === 1.3.0 / 2010-06-06
38
+
39
+ * Enhancements
40
+ * Complete rewrite of C-based adapter from SWIG to hand-crafted one [tenderlove]
41
+ See API_CHANGES document for details.
42
+ This closes: Bug #27300, Bug #27241, Patch #16020
43
+ * Improved UTF, Unicode, M17N, all that handling and proper BLOB handling [tenderlove, nurse]
44
+ * Added support for type translations [tenderlove]
45
+
46
+ @db.translator.add_translator('sometime') do |type, thing|
47
+ 'output' # this will be returned as value for that column
48
+ end
49
+
50
+ * Experimental
51
+ * Added API to access and load extensions. [kashif]
52
+ These functions maps directly into SQLite3 own enable_load_extension()
53
+ and load_extension() C-API functions. See SQLite3::Database API documentation for details.
54
+ This closes: Patches #9178
55
+
56
+ * Bugfixes
57
+ * Corrected gem dependencies (runtime and development)
58
+ * Fixed threaded tests [Alexey Borzenkov]
59
+ * Removed GitHub gemspec
60
+ * Fixed "No definition for" warnings from RDoc
61
+ * Generate zip and tgz files for releases
62
+ * Added Luis Lavena as gem Author (maintainer)
63
+ * Prevent mkmf interfere with Mighty Snow Leopard
64
+ * Allow extension compilation search for common lib paths [kashif]
65
+ (lookup /usr/local, /opt/local and /usr)
66
+ * Corrected extension compilation under MSVC [romuloceccon]
67
+ * Define load_extension functionality based on availability [tenderlove]
68
+ * Deprecation notices for Database#query. Fixes RF #28192
69
+
70
+ === 1.3.0.beta.2 / 2010-05-15
71
+
72
+ * Enhancements
73
+ * Added support for type translations [tenderlove]
74
+
75
+ @db.translator.add_translator('sometime') do |type, thing|
76
+ 'output' # this will be returned as value for that column
77
+ end
78
+
79
+ * Bugfixes
80
+ * Allow extension compilation search for common lib paths [kashif]
81
+ (lookup /usr/local, /opt/local and /usr)
82
+ * Corrected extension compilation under MSVC [romuloceccon]
83
+ * Define load_extension functionality based on availability [tenderlove]
84
+ * Deprecation notices for Database#query. Fixes RF #28192
85
+
86
+ === 1.3.0.beta.1 / 2010-05-10
87
+
88
+ * Enhancements
89
+ * Complete rewrite of C-based adapter from SWIG to hand-crafted one [tenderlove]
90
+ See API_CHANGES document for details.
91
+ This closes: Bug #27300, Bug #27241, Patch #16020
92
+ * Improved UTF, Unicode, M17N, all that handling and proper BLOB handling [tenderlove, nurse]
93
+
94
+ * Experimental
95
+ * Added API to access and load extensions. [kashif]
96
+ These functions maps directly into SQLite3 own enable_load_extension()
97
+ and load_extension() C-API functions. See SQLite3::Database API documentation for details.
98
+ This closes: Patches #9178
99
+
100
+ * Bugfixes
101
+ * Corrected gem dependencies (runtime and development)
102
+ * Fixed threaded tests [Alexey Borzenkov]
103
+ * Removed GitHub gemspec
104
+ * Fixed "No definition for" warnings from RDoc
105
+ * Generate zip and tgz files for releases
106
+ * Added Luis Lavena as gem Author (maintainer)
107
+ * Prevent mkmf interfere with Mighty Snow Leopard
108
+
109
+ === 1.2.5 / 25 Jul 2009
110
+
111
+ * Check for illegal nil before executing SQL [Erik Veenstra]
112
+ * Switch to Hoe for gem task management and packaging.
113
+ * Advertise rake-compiler as development dependency.
114
+ * Build gem binaries for Windows.
115
+ * Improved Ruby 1.9 support compatibility.
116
+ * Taint returned values. Patch #20325.
117
+ * Database.open and Database.new now take an optional block [Gerrit Kaiser]
118
+
119
+
120
+ === 1.2.4.1 (internal) / 5 Jul 2009
121
+
122
+ * Check for illegal nil before executing SQL [Erik Veenstra]
123
+ * Switch to Hoe for gem task management and packaging.
124
+ * Advertise rake-compiler as development dependency.
125
+ * Build gem binaries for Windows.
126
+ * Improved Ruby 1.9 support compatibility.
127
+
128
+
129
+ === 1.2.4 / 27 Aug 2008
130
+
131
+ * Package the updated C file for source builds. [Jamis Buck]
132
+
133
+
134
+ === 1.2.3 / 26 Aug 2008
135
+
136
+ * Fix incorrect permissions on database.rb and translator.rb [Various]
137
+
138
+ * Avoid using Object#extend for greater speedups [Erik Veenstra]
139
+
140
+ * Ruby 1.9 compatibility tweaks for Array#zip [jimmy88@gmail.com]
141
+
142
+ * Fix linking against Ruby 1.8.5 [Rob Holland <rob@inversepath.com>]
143
+
144
+
145
+ === 1.2.2 / 31 May 2008
146
+
147
+ * Make the table_info method adjust the returned default value for the rows
148
+ so that the sqlite3 change in 3.3.8 and greater can be handled
149
+ transparently [Jamis Buck <jamis@37signals.com>]
150
+
151
+ * Ruby 1.9 compatibility tweaks [Roman Le Negrate <roman2k@free.fr>]
152
+
153
+ * Various performance enhancements [thanks Erik Veenstra]
154
+
155
+ * Correct busy_handler documentation [Rob Holland <rob@inversepath.com>]
156
+
157
+ * Use int_bind64 on Fixnum values larger than a 32bit C int can take. [Rob Holland <rob@inversepath.com>]
158
+
159
+ * Work around a quirk in SQLite's error reporting by calling sqlite3_reset
160
+ to produce a more informative error code upon a failure from
161
+ sqlite3_step. [Rob Holland <rob@inversepath.com>]
162
+
163
+ * Various documentation, test, and style tweaks [Rob Holland <rob@inversepath.com>]
164
+
165
+ * Be more granular with time/data translation [Rob Holland <rob@inversepath.com>]
166
+
167
+ * Use Date directly for parsing rather than going via Time [Rob Holland <rob@inversepath.com>]
168
+
169
+ * Check for the rt library and fdatasync so we link against that when
170
+ needed [Rob Holland <rob@inversepath.com>]
171
+
172
+ * Rename data structures to avoid collision on win32. based on patch
173
+ by: Luis Lavena [Rob Holland <rob@inversepath.com>]
174
+
175
+ * Add test for defaults [Daniel Rodríguez Troitiño]
176
+
177
+ * Correctly unquote double-quoted pragma defaults [Łukasz Dargiewicz <lukasz.dargiewicz@gmail.com>]
@@ -0,0 +1,88 @@
1
+ 2005-01-05 09:40 minam
2
+
3
+ * Rakefile, sqlite3-ruby-win32.gemspec, sqlite3-ruby.gemspec: Added
4
+ win32 gem.
5
+
6
+ 2005-01-05 07:31 minam
7
+
8
+ * Rakefile, test/tc_integration.rb, test/tests.rb: Added
9
+ native-vs-dl benchmark to Rakefile. Added SQLITE3_DRIVERS
10
+ environment variable to integration test to specify which
11
+ driver(s) should be tested (defaults to "Native").
12
+
13
+ 2005-01-04 14:26 minam
14
+
15
+ * ext/sqlite3_api/sqlite3_api.i, lib/sqlite3/database.rb,
16
+ lib/sqlite3/driver/native/driver.rb, test/tc_database.rb,
17
+ test/tc_integration.rb, test/tests.rb: Unit tests: done. Bugs:
18
+ fixed.
19
+
20
+ 2005-01-03 23:13 minam
21
+
22
+ * ext/sqlite3_api/sqlite3_api.i, lib/sqlite3/database.rb,
23
+ lib/sqlite3/driver/dl/driver.rb,
24
+ lib/sqlite3/driver/native/driver.rb, test/tc_integration.rb:
25
+ Custom functions (aggregate and otherwise) are supported by the
26
+ native driver now. Test cases for the same.
27
+
28
+ 2005-01-03 13:51 minam
29
+
30
+ * ext/sqlite3_api/MANIFEST, ext/sqlite3_api/extconf.rb,
31
+ ext/sqlite3_api/post-clean.rb, ext/sqlite3_api/post-distclean.rb,
32
+ ext/sqlite3_api/sqlite3_api.i, lib/sqlite3/database.rb,
33
+ lib/sqlite3/resultset.rb, lib/sqlite3/version.rb,
34
+ lib/sqlite3/driver/dl/driver.rb,
35
+ lib/sqlite3/driver/native/driver.rb, test/native-vs-dl.rb,
36
+ test/tc_integration.rb: Added preliminary implementation of
37
+ native driver (swig-based), and integration tests.
38
+
39
+ 2004-12-29 19:37 minam
40
+
41
+ * lib/sqlite3/driver/dl/driver.rb: Some fixes to allow the DL
42
+ driver to work with Ruby 1.8.1.
43
+
44
+ 2004-12-29 14:52 minam
45
+
46
+ * lib/sqlite3/: database.rb, version.rb: Made #quote a class method
47
+ (again). Bumped version to 0.6.
48
+
49
+ 2004-12-25 22:59 minam
50
+
51
+ * lib/sqlite3/driver/dl/api.rb: Added check for darwin in supported
52
+ platforms (thanks to bitsweat).
53
+
54
+ 2004-12-22 12:38 minam
55
+
56
+ * Rakefile: Rakefile wasn't packaging the README file.
57
+
58
+ 2004-12-21 22:28 minam
59
+
60
+ * Rakefile, sqlite3-ruby.gemspec, test/bm.rb: Packaging now works.
61
+ Added benchmarks.
62
+
63
+ 2004-12-21 21:45 minam
64
+
65
+ * LICENSE, README, Rakefile, setup.rb, sqlite3-ruby.gemspec,
66
+ doc/faq/faq.rb, doc/faq/faq.yml, lib/sqlite3.rb,
67
+ lib/sqlite3/statement.rb, lib/sqlite3/constants.rb,
68
+ lib/sqlite3/database.rb, lib/sqlite3/resultset.rb,
69
+ lib/sqlite3/translator.rb, lib/sqlite3/value.rb,
70
+ lib/sqlite3/version.rb, lib/sqlite3/errors.rb,
71
+ lib/sqlite3/pragmas.rb, lib/sqlite3/driver/dl/api.rb,
72
+ lib/sqlite3/driver/dl/driver.rb, test/mocks.rb,
73
+ test/tc_database.rb, test/tests.rb, test/driver/dl/tc_driver.rb:
74
+ Initial import
75
+
76
+ 2004-12-21 21:45 minam
77
+
78
+ * LICENSE, README, Rakefile, setup.rb, sqlite3-ruby.gemspec,
79
+ doc/faq/faq.rb, doc/faq/faq.yml, lib/sqlite3.rb,
80
+ lib/sqlite3/statement.rb, lib/sqlite3/constants.rb,
81
+ lib/sqlite3/database.rb, lib/sqlite3/resultset.rb,
82
+ lib/sqlite3/translator.rb, lib/sqlite3/value.rb,
83
+ lib/sqlite3/version.rb, lib/sqlite3/errors.rb,
84
+ lib/sqlite3/pragmas.rb, lib/sqlite3/driver/dl/api.rb,
85
+ lib/sqlite3/driver/dl/driver.rb, test/mocks.rb,
86
+ test/tc_database.rb, test/tests.rb, test/driver/dl/tc_driver.rb:
87
+ Initial revision
88
+
data/LICENSE CHANGED
@@ -1,20 +1,27 @@
1
- Copyright (c) 2009 Jakub Kuźma
1
+ Copyright (c) 2004, Jamis Buck (jamis@jamisbuck.org)
2
+ All rights reserved.
2
3
 
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
10
6
 
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
13
9
 
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10
+ * Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+
14
+ * The names of its contributors may not be used to endorse or promote
15
+ products derived from this software without specific prior written
16
+ permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,50 @@
1
+ API_CHANGES.rdoc
2
+ CHANGELOG.rdoc
3
+ ChangeLog.cvs
4
+ LICENSE
5
+ Manifest.txt
6
+ README.rdoc
7
+ Rakefile
8
+ ext/sqlite3/backup.c
9
+ ext/sqlite3/backup.h
10
+ ext/sqlite3/database.c
11
+ ext/sqlite3/database.h
12
+ ext/sqlite3/exception.c
13
+ ext/sqlite3/exception.h
14
+ ext/sqlite3/extconf.rb
15
+ ext/sqlite3/sqlite3.c
16
+ ext/sqlite3/sqlite3_ruby.h
17
+ ext/sqlite3/statement.c
18
+ ext/sqlite3/statement.h
19
+ faq/faq.rb
20
+ faq/faq.yml
21
+ lib/sqlite3.rb
22
+ lib/sqlite3/constants.rb
23
+ lib/sqlite3/database.rb
24
+ lib/sqlite3/errors.rb
25
+ lib/sqlite3/pragmas.rb
26
+ lib/sqlite3/resultset.rb
27
+ lib/sqlite3/statement.rb
28
+ lib/sqlite3/translator.rb
29
+ lib/sqlite3/value.rb
30
+ lib/sqlite3/version.rb
31
+ setup.rb
32
+ tasks/faq.rake
33
+ tasks/gem.rake
34
+ tasks/native.rake
35
+ tasks/vendor_sqlite3.rake
36
+ test/helper.rb
37
+ test/test_backup.rb
38
+ test/test_collation.rb
39
+ test/test_database.rb
40
+ test/test_database_readonly.rb
41
+ test/test_deprecated.rb
42
+ test/test_encoding.rb
43
+ test/test_integration.rb
44
+ test/test_integration_open_close.rb
45
+ test/test_integration_pending.rb
46
+ test/test_integration_resultset.rb
47
+ test/test_integration_statement.rb
48
+ test/test_sqlite3.rb
49
+ test/test_statement.rb
50
+ test/test_statement_execute.rb
@@ -1,7 +1,103 @@
1
- = sqlite3
1
+ = SQLite3/Ruby Interface
2
2
 
3
- SQLite3 FFI bindings for Ruby 1.9.
3
+ * http://github.com/luislavena/sqlite3-ruby
4
+ * http://rubyforge.org/projects/sqlite-ruby
5
+ * http://sqlite-ruby.rubyforge.org
6
+ * http://groups.google.com/group/sqlite3-ruby
4
7
 
5
- == Copyright
8
+ == DESCRIPTION
6
9
 
7
- Copyright (c) 2010 Jakub Kuźma. See LICENSE for details.
10
+ This module allows Ruby programs to interface with the SQLite3
11
+ database engine (http://www.sqlite.org). You must have the
12
+ SQLite engine installed in order to build this module.
13
+
14
+ Note that this module is NOT compatible with SQLite 2.x.
15
+
16
+ == SYNOPSIS
17
+
18
+ require "sqlite3"
19
+
20
+ # Open a database
21
+ db = SQLite3::Database.new "test.db"
22
+
23
+ # Create a database
24
+ rows = db.execute <<-SQL
25
+ create table numbers (
26
+ name varchar(30),
27
+ val int
28
+ );
29
+ SQL
30
+
31
+ # Execute a few inserts
32
+ {
33
+ "one" => 1,
34
+ "two" => 2,
35
+ }.each do |pair|
36
+ db.execute "insert into numbers values ( ?, ? )", pair
37
+ end
38
+
39
+ # Find a few rows
40
+ db.execute( "select * from numbers" ) do |row|
41
+ p row
42
+ end
43
+
44
+
45
+ == Compilation and Installation
46
+
47
+ Install SQLite3, enabling option SQLITE_ENABLE_COLUMN_METADATA (see
48
+ www.sqlite.org/compile.html for details).
49
+
50
+ Then do the following:
51
+
52
+ ruby setup.rb config
53
+ ruby setup.rb setup
54
+ ruby setup.rb install
55
+
56
+ Alternatively, you can download and install the RubyGem package for
57
+ SQLite3/Ruby (you must have RubyGems and SQLite3 installed, first):
58
+
59
+ gem install sqlite3-ruby
60
+
61
+ If you have sqlite3 installed in a non-standard location, you can specify the location of the include and lib files by doing:
62
+
63
+ gem install sqlite3-ruby -- --with-sqlite3-include=/opt/local/include \
64
+ --with-sqlite3-lib=/opt/local/lib
65
+
66
+ = SUPPORT!!!
67
+
68
+ == OMG! Something has gone wrong! Where do I get help?
69
+
70
+ The best place to get help is from the
71
+ {sqlite3-ruby mailing list}[http://groups.google.com/group/sqlite3-ruby] which
72
+ can be found here:
73
+
74
+ * http://groups.google.com/group/sqlite3-ruby
75
+
76
+ == I've found a bug! Where do I file it?
77
+
78
+ Uh oh. After contacting the mailing list, you've found that you've actually
79
+ discovered a bug. You can file the bug at the
80
+ {github issues page}[http://github.com/luislavena/sqlite3-ruby/issues]
81
+ which can be found here:
82
+
83
+ * http://github.com/luislavena/sqlite3-ruby/issues
84
+
85
+ == Usage
86
+
87
+ For help figuring out the SQLite3/Ruby interface, check out the
88
+ FAQ[http://sqlite-ruby.rubyforge.org/sqlite3/faq.html]. It includes examples of
89
+ usage. If you have any questions that you feel should be address in the
90
+ FAQ, please send them to jamis@37signals.com
91
+
92
+ == Source Code
93
+
94
+ The source repository is accessible via git:
95
+
96
+ git clone git://github.com/luislavena/sqlite3-ruby.git
97
+
98
+ == Contact Information
99
+
100
+ The project page is http://rubyforge.org/projects/sqlite-ruby. There, you can
101
+ find links to mailing lists and forums that you can use to discuss this
102
+ library. Additionally, there are trackers for submitting bugs and feature
103
+ requests. Feel free to use them!