amalgalite 1.5.0-x86-mingw32 → 1.6.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +13 -0
- data/LICENSE +2 -0
- data/README.md +1 -1
- data/Rakefile +5 -5
- data/ext/amalgalite/c/amalgalite.c +26 -0
- data/ext/amalgalite/c/amalgalite_constants.c +887 -39
- data/ext/amalgalite/c/extconf.rb +5 -1
- data/ext/amalgalite/c/gen_constants.rb +290 -153
- data/ext/amalgalite/c/sqlite3.c +39928 -18827
- data/ext/amalgalite/c/sqlite3.h +2739 -455
- data/ext/amalgalite/c/sqlite3ext.h +54 -10
- data/lib/amalgalite/2.0/amalgalite.so +0 -0
- data/lib/amalgalite/2.1/amalgalite.so +0 -0
- data/lib/amalgalite/2.2/amalgalite.so +0 -0
- data/lib/amalgalite/2.3/amalgalite.so +0 -0
- data/lib/amalgalite/2.4/amalgalite.so +0 -0
- data/lib/amalgalite/type_maps/default_map.rb +1 -1
- data/lib/amalgalite/type_maps/storage_map.rb +1 -1
- data/lib/amalgalite/version.rb +1 -1
- data/spec/default_map_spec.rb +1 -1
- data/spec/integeration_spec.rb +2 -2
- data/spec/sqlite3/version_spec.rb +15 -9
- data/spec/storage_map_spec.rb +1 -1
- data/tasks/default.rake +3 -10
- data/tasks/extension.rake +4 -4
- data/tasks/this.rb +3 -1
- metadata +19 -16
- data/lib/amalgalite/1.8/amalgalite.so +0 -0
- data/lib/amalgalite/1.9/amalgalite.so +0 -0
data/ext/amalgalite/c/extconf.rb
CHANGED
@@ -8,14 +8,18 @@ $ruby = ARGV.shift if ARGV[0]
|
|
8
8
|
# make available table and column meta data api
|
9
9
|
$CFLAGS += " -DSQLITE_ENABLE_COLUMN_METADATA=1"
|
10
10
|
$CFLAGS += " -DSQLITE_ENABLE_DBSTAT_VTAB=1"
|
11
|
+
$CFLAGS += " -DSQLITE_ENABLE_DBPAGE_VTAB=1"
|
11
12
|
$CFLAGS += " -DSQLITE_ENABLE_FTS3=1"
|
12
13
|
$CFLAGS += " -DSQLITE_ENABLE_FTS3_PARENTHESIS=1"
|
13
14
|
$CFLAGS += " -DSQLITE_ENABLE_FTS4=1"
|
14
15
|
$CFLAGS += " -DSQLITE_ENABLE_FTS5=1"
|
15
16
|
$CFLAGS += " -DSQLITE_ENABLE_JSON1=1"
|
17
|
+
$CFLAGS += " -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1"
|
18
|
+
$CFLAGS += " -DSQLITE_ENABLE_PREUPDATE_HOOK=1"
|
16
19
|
$CFLAGS += " -DSQLITE_ENABLE_RBU=1"
|
17
20
|
$CFLAGS += " -DSQLITE_ENABLE_RTREE=1"
|
18
|
-
$CFLAGS += " -
|
21
|
+
$CFLAGS += " -DSQLITE_ENABLE_SESSION=1"
|
22
|
+
$CFLAGS += " -DSQLITE_ENABLE_STMTVTAB=1"
|
19
23
|
$CFLAGS += " -DSQLITE_ENABLE_STAT4=1"
|
20
24
|
$CFLAGS += " -DSQLITE_ENABLE_UNLOCK_NOTIFY=1"
|
21
25
|
|
@@ -1,141 +1,288 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
3
|
+
require 'pp'
|
4
|
+
|
5
|
+
# readin in the sqlite3.h file and parse out all the #define lines
|
6
|
+
sqlite3_h_fname = File.expand_path(File.join(File.dirname(__FILE__), "sqlite3.h"))
|
7
|
+
|
8
|
+
# special handling for those that are function result codes
|
9
|
+
result_codes = %w[
|
10
|
+
SQLITE_OK
|
11
|
+
SQLITE_ERROR
|
12
|
+
SQLITE_INTERNAL
|
13
|
+
SQLITE_PERM
|
14
|
+
SQLITE_ABORT
|
15
|
+
SQLITE_BUSY
|
16
|
+
SQLITE_LOCKED
|
17
|
+
SQLITE_NOMEM
|
18
|
+
SQLITE_READONLY
|
19
|
+
SQLITE_INTERRUPT
|
20
|
+
SQLITE_IOERR
|
21
|
+
SQLITE_CORRUPT
|
22
|
+
SQLITE_NOTFOUND
|
23
|
+
SQLITE_FULL
|
24
|
+
SQLITE_CANTOPEN
|
25
|
+
SQLITE_PROTOCOL
|
26
|
+
SQLITE_EMPTY
|
27
|
+
SQLITE_SCHEMA
|
28
|
+
SQLITE_TOOBIG
|
29
|
+
SQLITE_CONSTRAINT
|
30
|
+
SQLITE_MISMATCH
|
31
|
+
SQLITE_MISUSE
|
32
|
+
SQLITE_NOLFS
|
33
|
+
SQLITE_AUTH
|
34
|
+
SQLITE_FORMAT
|
35
|
+
SQLITE_RANGE
|
36
|
+
SQLITE_NOTADB
|
37
|
+
SQLITE_NOTICE
|
38
|
+
SQLITE_WARNING
|
39
|
+
SQLITE_ROW
|
40
|
+
SQLITE_DONE
|
41
|
+
SQLITE_IOERR_READ
|
42
|
+
SQLITE_IOERR_SHORT_READ
|
43
|
+
SQLITE_IOERR_WRITE
|
44
|
+
SQLITE_IOERR_FSYNC
|
45
|
+
SQLITE_IOERR_DIR_FSYNC
|
46
|
+
SQLITE_IOERR_TRUNCATE
|
47
|
+
SQLITE_IOERR_FSTAT
|
48
|
+
SQLITE_IOERR_UNLOCK
|
49
|
+
SQLITE_IOERR_RDLOCK
|
50
|
+
SQLITE_IOERR_DELETE
|
51
|
+
SQLITE_IOERR_BLOCKED
|
52
|
+
SQLITE_IOERR_NOMEM
|
53
|
+
SQLITE_IOERR_ACCESS
|
54
|
+
SQLITE_IOERR_CHECKRESERVEDLOCK
|
55
|
+
SQLITE_IOERR_LOCK
|
56
|
+
SQLITE_IOERR_CLOSE
|
57
|
+
SQLITE_IOERR_DIR_CLOSE
|
58
|
+
SQLITE_IOERR_SHMOPEN
|
59
|
+
SQLITE_IOERR_SHMSIZE
|
60
|
+
SQLITE_IOERR_SHMLOCK
|
61
|
+
SQLITE_IOERR_SHMMAP
|
62
|
+
SQLITE_IOERR_SEEK
|
63
|
+
SQLITE_IOERR_DELETE_NOENT
|
64
|
+
SQLITE_IOERR_MMAP
|
65
|
+
SQLITE_IOERR_GETTEMPPATH
|
66
|
+
SQLITE_IOERR_CONVPATH
|
67
|
+
SQLITE_IOERR_VNODE
|
68
|
+
SQLITE_IOERR_AUTH
|
69
|
+
SQLITE_IOERR_BEGIN_ATOMIC
|
70
|
+
SQLITE_IOERR_COMMIT_ATOMIC
|
71
|
+
SQLITE_IOERR_ROLLBACK_ATOMIC
|
72
|
+
SQLITE_LOCKED_SHAREDCACHE
|
73
|
+
SQLITE_BUSY_RECOVERY
|
74
|
+
SQLITE_BUSY_SNAPSHOT
|
75
|
+
SQLITE_CANTOPEN_NOTEMPDIR
|
76
|
+
SQLITE_CANTOPEN_ISDIR
|
77
|
+
SQLITE_CANTOPEN_FULLPATH
|
78
|
+
SQLITE_CANTOPEN_CONVPATH
|
79
|
+
SQLITE_CORRUPT_VTAB
|
80
|
+
SQLITE_READONLY_RECOVERY
|
81
|
+
SQLITE_READONLY_CANTLOCK
|
82
|
+
SQLITE_READONLY_ROLLBACK
|
83
|
+
SQLITE_READONLY_DBMOVED
|
84
|
+
SQLITE_ABORT_ROLLBACK
|
85
|
+
SQLITE_CONSTRAINT_CHECK
|
86
|
+
SQLITE_CONSTRAINT_COMMITHOOK
|
87
|
+
SQLITE_CONSTRAINT_FOREIGNKEY
|
88
|
+
SQLITE_CONSTRAINT_FUNCTION
|
89
|
+
SQLITE_CONSTRAINT_NOTNULL
|
90
|
+
SQLITE_CONSTRAINT_PRIMARYKEY
|
91
|
+
SQLITE_CONSTRAINT_TRIGGER
|
92
|
+
SQLITE_CONSTRAINT_UNIQUE
|
93
|
+
SQLITE_CONSTRAINT_VTAB
|
94
|
+
SQLITE_CONSTRAINT_ROWID
|
95
|
+
SQLITE_NOTICE_RECOVER_WAL
|
96
|
+
SQLITE_NOTICE_RECOVER_ROLLBACK
|
97
|
+
SQLITE_WARNING_AUTOINDEX
|
98
|
+
SQLITE_AUTH_USER
|
99
|
+
SQLITE_OK_LOAD_PERMANENTLY
|
100
|
+
]
|
101
|
+
|
102
|
+
deprecated_codes = %w[ SQLITE_GET_LOCKPROXYFILE SQLITE_SET_LOCKPROXYFILE SQLITE_LAST_ERRNO ]
|
103
|
+
version_codes = %w[ SQLITE_VERSION SQLITE_VERSION_NUMBER SQLITE_SOURCE_ID ]
|
104
|
+
rtree_codes = %w[ NOT_WITHIN PARTLY_WITHIN FULLY_WITHIN ]
|
105
|
+
|
106
|
+
authorizer_codes = %w[
|
107
|
+
SQLITE_DENY
|
108
|
+
SQLITE_IGNORE
|
109
|
+
SQLITE_CREATE_INDEX
|
110
|
+
SQLITE_CREATE_TABLE
|
111
|
+
SQLITE_CREATE_TEMP_INDEX
|
112
|
+
SQLITE_CREATE_TEMP_TABLE
|
113
|
+
SQLITE_CREATE_TEMP_TRIGGER
|
114
|
+
SQLITE_CREATE_TEMP_VIEW
|
115
|
+
SQLITE_CREATE_TRIGGER
|
116
|
+
SQLITE_CREATE_VIEW
|
117
|
+
SQLITE_DELETE
|
118
|
+
SQLITE_DROP_INDEX
|
119
|
+
SQLITE_DROP_TABLE
|
120
|
+
SQLITE_DROP_TEMP_INDEX
|
121
|
+
SQLITE_DROP_TEMP_TABLE
|
122
|
+
SQLITE_DROP_TEMP_TRIGGER
|
123
|
+
SQLITE_DROP_TEMP_VIEW
|
124
|
+
SQLITE_DROP_TRIGGER
|
125
|
+
SQLITE_DROP_VIEW
|
126
|
+
SQLITE_INSERT
|
127
|
+
SQLITE_PRAGMA
|
128
|
+
SQLITE_READ
|
129
|
+
SQLITE_SELECT
|
130
|
+
SQLITE_TRANSACTION
|
131
|
+
SQLITE_UPDATE
|
132
|
+
SQLITE_ATTACH
|
133
|
+
SQLITE_DETACH
|
134
|
+
SQLITE_ALTER_TABLE
|
135
|
+
SQLITE_REINDEX
|
136
|
+
SQLITE_ANALYZE
|
137
|
+
SQLITE_CREATE_VTABLE
|
138
|
+
SQLITE_DROP_VTABLE
|
139
|
+
SQLITE_FUNCTION
|
140
|
+
SQLITE_SAVEPOINT
|
141
|
+
SQLITE_COPY
|
142
|
+
SQLITE_RECURSIVE
|
143
|
+
]
|
144
|
+
|
145
|
+
text_encoding_codes = %w[
|
146
|
+
SQLITE_UTF8
|
147
|
+
SQLITE_UTF16LE
|
148
|
+
SQLITE_UTF16BE
|
149
|
+
SQLITE_UTF16
|
150
|
+
SQLITE_ANY
|
151
|
+
SQLITE_UTF16_ALIGNED
|
152
|
+
SQLITE_DETERMINISTIC
|
153
|
+
]
|
154
|
+
|
155
|
+
data_type_codes = %w[
|
156
|
+
SQLITE_INTEGER
|
157
|
+
SQLITE_FLOAT
|
158
|
+
SQLITE_BLOB
|
159
|
+
SQLITE_NULL
|
160
|
+
SQLITE3_TEXT
|
161
|
+
]
|
162
|
+
|
163
|
+
fts5_codes = %w[
|
164
|
+
FTS5_TOKENIZE_QUERY
|
165
|
+
FTS5_TOKENIZE_PREFIX
|
166
|
+
FTS5_TOKENIZE_DOCUMENT
|
167
|
+
FTS5_TOKENIZE_AUX
|
168
|
+
FTS5_TOKEN_COLOCATED
|
169
|
+
]
|
170
|
+
|
171
|
+
ignore_codes = [
|
172
|
+
# vtab related
|
173
|
+
"SQLITE_ROLLBACK",
|
174
|
+
"SQLITE_FAIL",
|
175
|
+
"SQLITE_REPLACE",
|
176
|
+
"SQLITE_VTAB_CONSTRAINT_SUPPORT",
|
177
|
+
|
178
|
+
# sqlite destructor callback codes
|
179
|
+
"SQLITE_STATIC",
|
180
|
+
"SQLITE_TRANSIENT",
|
181
|
+
]
|
182
|
+
|
183
|
+
# oddball name
|
184
|
+
module_name_mapping = {
|
135
185
|
|
186
|
+
"DBCONFIG" => "DBConfig",
|
187
|
+
"DBSTATUS" => "DBStatus",
|
188
|
+
"IOCAP" => "IOCap",
|
189
|
+
"SHM" => "SHM",
|
190
|
+
"SCANSTAT" => "ScanStat",
|
191
|
+
"STMTSTATUS" => "StatementStatus",
|
136
192
|
}
|
137
193
|
|
194
|
+
defines = []
|
195
|
+
IO.readlines(sqlite3_h_fname).each do |l|
|
196
|
+
result = {
|
197
|
+
"c_define" => nil,
|
198
|
+
"c_value" => nil,
|
199
|
+
"docstring" => nil,
|
200
|
+
|
201
|
+
"is_error_code" => false,
|
202
|
+
|
203
|
+
"r_module" => nil,
|
204
|
+
"r_constant" => nil,
|
205
|
+
}
|
206
|
+
|
207
|
+
if l =~ /beginning-of-error-codes/ .. l =~ /end-of-error-codes/ then
|
208
|
+
result["is_error_code"] = true
|
209
|
+
end
|
210
|
+
|
211
|
+
l.strip!
|
212
|
+
md = l.match(/\A#define\s+(\w+)\s+([^\/]+)\s*(\/\*(.*)\*\/)?\Z/)
|
213
|
+
next unless md
|
214
|
+
|
215
|
+
# Name munging
|
216
|
+
c_define = md[1]
|
217
|
+
|
218
|
+
c_parts = c_define.gsub(/^SQLITE_/,'').split("_")
|
219
|
+
r_module = c_parts.shift
|
220
|
+
r_constant = c_parts.join("_")
|
221
|
+
|
222
|
+
|
223
|
+
# custom module naming so they are human readable
|
224
|
+
r_module = module_name_mapping.fetch(r_module) { |m| r_module.capitalize }
|
225
|
+
|
226
|
+
case c_define
|
227
|
+
when *version_codes
|
228
|
+
next
|
229
|
+
|
230
|
+
when *deprecated_codes
|
231
|
+
next
|
232
|
+
|
233
|
+
when *rtree_codes
|
234
|
+
r_module = "RTree"
|
235
|
+
r_constant = c_define
|
236
|
+
|
237
|
+
when *result_codes
|
238
|
+
r_module = "ResultCode"
|
239
|
+
r_constant = c_define.gsub(/^SQLITE_/,'')
|
240
|
+
|
241
|
+
when *authorizer_codes
|
242
|
+
r_module = "Authorizer"
|
243
|
+
r_constant = c_define.gsub(/^SQLITE_/,'')
|
244
|
+
|
245
|
+
when *text_encoding_codes
|
246
|
+
r_module = "TextEncoding"
|
247
|
+
r_constant = c_define.gsub(/^SQLITE_/,'')
|
248
|
+
|
249
|
+
when *data_type_codes
|
250
|
+
r_module = "DataType"
|
251
|
+
r_constant = c_define.gsub(/^SQLITE(3)?_/,'')
|
252
|
+
|
253
|
+
when *fts5_codes
|
254
|
+
r_module = "FTS5"
|
255
|
+
r_constant = c_define.gsub(/^FTS5_/,'')
|
256
|
+
|
257
|
+
when *ignore_codes
|
258
|
+
next
|
259
|
+
|
260
|
+
when /TESTCTRL/ # sqlite3 codes used in testing
|
261
|
+
next
|
262
|
+
|
263
|
+
when /^__/ # sqlite3 internal items
|
264
|
+
next
|
265
|
+
end
|
266
|
+
|
267
|
+
result["c_define"] = c_define
|
268
|
+
result["c_value"] = md[2].strip
|
269
|
+
if !md[4].nil? && (md[4].strip.length > 0) then
|
270
|
+
result["docstring"] = md[4].strip
|
271
|
+
end
|
272
|
+
result["r_module"] = r_module
|
273
|
+
result["r_constant"] = r_constant
|
274
|
+
|
275
|
+
defines << result
|
276
|
+
end
|
277
|
+
|
278
|
+
#
|
279
|
+
# rework defines into constants
|
280
|
+
#
|
281
|
+
CONSTANTS = defines.group_by{ |d| d["r_module"] }
|
282
|
+
|
138
283
|
fname = File.expand_path(File.join(File.dirname(__FILE__), "amalgalite_constants.c"))
|
284
|
+
|
285
|
+
|
139
286
|
File.open(fname, "w+") do |f|
|
140
287
|
f.puts "/* Generated by gen_constants.rb -- do not edit */"
|
141
288
|
f.puts
|
@@ -157,35 +304,25 @@ File.open(fname, "w+") do |f|
|
|
157
304
|
f.puts ' VALUE mC = rb_define_module_under( mas, "Constants");'
|
158
305
|
|
159
306
|
|
160
|
-
|
161
|
-
IO.readlines("sqlite3.h").each do |l|
|
162
|
-
if l =~ /beginning-of-error-codes/ .. l =~ /end-of-error-codes/ then
|
163
|
-
next if l =~ /of-error-codes/
|
164
|
-
l.strip!
|
165
|
-
md = l.match(/\A#define\s+(\w+)\s+(\d+)\s+\/\*(.*)\*\/\Z/)
|
166
|
-
error_code_lines[md[1]] = { 'value' => md[2].strip, 'meaning' => md[3].strip }
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
CONSTANTS.keys.sort.each do |klass|
|
171
|
-
const_set = CONSTANTS[klass]
|
307
|
+
CONSTANTS.keys.sort.each do |mod|
|
172
308
|
f.puts " /**"
|
173
|
-
f.puts " * module encapsulating the SQLite3 C extension constants for #{
|
309
|
+
f.puts " * module encapsulating the SQLite3 C extension constants for #{mod}"
|
174
310
|
f.puts " */"
|
175
|
-
f.puts " VALUE mC_#{
|
311
|
+
f.puts " VALUE mC_#{mod} = rb_define_module_under(mC, \"#{mod}\");"
|
176
312
|
f.puts
|
177
313
|
end
|
178
314
|
|
179
|
-
CONSTANTS.keys.sort.each do |
|
180
|
-
const_set = CONSTANTS[
|
181
|
-
const_set.
|
182
|
-
sql_const =
|
315
|
+
CONSTANTS.keys.sort.each do |mod|
|
316
|
+
const_set = CONSTANTS[mod]
|
317
|
+
const_set.sort_by { |c| c["c_define"] }.each do |result|
|
318
|
+
sql_const = result["c_define"]
|
183
319
|
const_doc = " /* no meaningful autogenerated documentation -- constant is self explanatory ?*/"
|
184
|
-
if
|
185
|
-
const_doc = " /* #{
|
320
|
+
if !result["docstring"].nil? then
|
321
|
+
const_doc = " /* #{result['c_value']} -- #{result['docstring']} */"
|
186
322
|
end
|
323
|
+
ruby_constant = result['r_constant']
|
187
324
|
f.puts const_doc
|
188
|
-
f.puts " rb_define_const(mC_#{
|
325
|
+
f.puts " rb_define_const(mC_#{mod}, \"#{ruby_constant}\", INT2FIX(#{sql_const}));"
|
189
326
|
f.puts
|
190
327
|
end
|
191
328
|
end
|