amalgalite 1.8.0-x64-mingw-ucrt
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CONTRIBUTING.md +60 -0
- data/HISTORY.md +386 -0
- data/LICENSE +31 -0
- data/Manifest.txt +105 -0
- data/README.md +62 -0
- data/Rakefile +27 -0
- data/TODO.md +57 -0
- data/bin/amalgalite-pack +147 -0
- data/examples/a.rb +9 -0
- data/examples/blob.rb +88 -0
- data/examples/bootstrap.rb +36 -0
- data/examples/define_aggregate.rb +75 -0
- data/examples/define_function.rb +104 -0
- data/examples/fts5.rb +152 -0
- data/examples/gem-db.rb +94 -0
- data/examples/require_me.rb +11 -0
- data/examples/requires.rb +42 -0
- data/examples/schema-info.rb +34 -0
- data/ext/amalgalite/c/amalgalite.c +355 -0
- data/ext/amalgalite/c/amalgalite.h +151 -0
- data/ext/amalgalite/c/amalgalite_blob.c +240 -0
- data/ext/amalgalite/c/amalgalite_constants.c +1432 -0
- data/ext/amalgalite/c/amalgalite_database.c +1188 -0
- data/ext/amalgalite/c/amalgalite_requires_bootstrap.c +282 -0
- data/ext/amalgalite/c/amalgalite_statement.c +649 -0
- data/ext/amalgalite/c/extconf.rb +71 -0
- data/ext/amalgalite/c/gen_constants.rb +353 -0
- data/ext/amalgalite/c/notes.txt +134 -0
- data/ext/amalgalite/c/sqlite3.c +243616 -0
- data/ext/amalgalite/c/sqlite3.h +12894 -0
- data/ext/amalgalite/c/sqlite3_options.h +4 -0
- data/ext/amalgalite/c/sqlite3ext.h +705 -0
- data/lib/amalgalite/3.1/amalgalite.so +0 -0
- data/lib/amalgalite/aggregate.rb +73 -0
- data/lib/amalgalite/blob.rb +186 -0
- data/lib/amalgalite/boolean.rb +42 -0
- data/lib/amalgalite/busy_timeout.rb +47 -0
- data/lib/amalgalite/column.rb +99 -0
- data/lib/amalgalite/core_ext/kernel/require.rb +21 -0
- data/lib/amalgalite/csv_table_importer.rb +75 -0
- data/lib/amalgalite/database.rb +933 -0
- data/lib/amalgalite/function.rb +61 -0
- data/lib/amalgalite/index.rb +43 -0
- data/lib/amalgalite/memory_database.rb +15 -0
- data/lib/amalgalite/packer.rb +231 -0
- data/lib/amalgalite/paths.rb +80 -0
- data/lib/amalgalite/profile_tap.rb +131 -0
- data/lib/amalgalite/progress_handler.rb +21 -0
- data/lib/amalgalite/requires.rb +151 -0
- data/lib/amalgalite/schema.rb +225 -0
- data/lib/amalgalite/sqlite3/constants.rb +95 -0
- data/lib/amalgalite/sqlite3/database/function.rb +48 -0
- data/lib/amalgalite/sqlite3/database/status.rb +68 -0
- data/lib/amalgalite/sqlite3/status.rb +60 -0
- data/lib/amalgalite/sqlite3/version.rb +55 -0
- data/lib/amalgalite/sqlite3.rb +6 -0
- data/lib/amalgalite/statement.rb +421 -0
- data/lib/amalgalite/table.rb +91 -0
- data/lib/amalgalite/taps/console.rb +27 -0
- data/lib/amalgalite/taps/io.rb +74 -0
- data/lib/amalgalite/taps.rb +2 -0
- data/lib/amalgalite/trace_tap.rb +35 -0
- data/lib/amalgalite/type_map.rb +63 -0
- data/lib/amalgalite/type_maps/default_map.rb +166 -0
- data/lib/amalgalite/type_maps/storage_map.rb +38 -0
- data/lib/amalgalite/type_maps/text_map.rb +21 -0
- data/lib/amalgalite/version.rb +8 -0
- data/lib/amalgalite/view.rb +26 -0
- data/lib/amalgalite.rb +51 -0
- data/spec/aggregate_spec.rb +158 -0
- data/spec/amalgalite_spec.rb +4 -0
- data/spec/blob_spec.rb +78 -0
- data/spec/boolean_spec.rb +24 -0
- data/spec/busy_handler.rb +157 -0
- data/spec/data/iso-3166-country.txt +242 -0
- data/spec/data/iso-3166-schema.sql +22 -0
- data/spec/data/iso-3166-subcountry.txt +3995 -0
- data/spec/data/make-iso-db.sh +12 -0
- data/spec/database_spec.rb +505 -0
- data/spec/default_map_spec.rb +92 -0
- data/spec/function_spec.rb +78 -0
- data/spec/integeration_spec.rb +97 -0
- data/spec/iso_3166_database.rb +58 -0
- data/spec/json_spec.rb +24 -0
- data/spec/packer_spec.rb +60 -0
- data/spec/paths_spec.rb +28 -0
- data/spec/progress_handler_spec.rb +91 -0
- data/spec/requires_spec.rb +54 -0
- data/spec/rtree_spec.rb +66 -0
- data/spec/schema_spec.rb +131 -0
- data/spec/spec_helper.rb +48 -0
- data/spec/sqlite3/constants_spec.rb +108 -0
- data/spec/sqlite3/database_status_spec.rb +36 -0
- data/spec/sqlite3/status_spec.rb +22 -0
- data/spec/sqlite3/version_spec.rb +28 -0
- data/spec/sqlite3_spec.rb +53 -0
- data/spec/statement_spec.rb +168 -0
- data/spec/storage_map_spec.rb +38 -0
- data/spec/tap_spec.rb +57 -0
- data/spec/text_map_spec.rb +20 -0
- data/spec/type_map_spec.rb +14 -0
- data/spec/version_spec.rb +8 -0
- data/tasks/custom.rake +101 -0
- data/tasks/default.rake +244 -0
- data/tasks/extension.rake +28 -0
- data/tasks/this.rb +208 -0
- metadata +325 -0
@@ -0,0 +1,353 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
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_ERROR_MISSING_COLLSEQ
|
42
|
+
SQLITE_ERROR_RETRY
|
43
|
+
SQLITE_ERROR_SNAPSHOT
|
44
|
+
SQLITE_IOERR_READ
|
45
|
+
SQLITE_IOERR_SHORT_READ
|
46
|
+
SQLITE_IOERR_WRITE
|
47
|
+
SQLITE_IOERR_FSYNC
|
48
|
+
SQLITE_IOERR_DIR_FSYNC
|
49
|
+
SQLITE_IOERR_TRUNCATE
|
50
|
+
SQLITE_IOERR_FSTAT
|
51
|
+
SQLITE_IOERR_UNLOCK
|
52
|
+
SQLITE_IOERR_RDLOCK
|
53
|
+
SQLITE_IOERR_DELETE
|
54
|
+
SQLITE_IOERR_BLOCKED
|
55
|
+
SQLITE_IOERR_NOMEM
|
56
|
+
SQLITE_IOERR_ACCESS
|
57
|
+
SQLITE_IOERR_CHECKRESERVEDLOCK
|
58
|
+
SQLITE_IOERR_LOCK
|
59
|
+
SQLITE_IOERR_CLOSE
|
60
|
+
SQLITE_IOERR_DIR_CLOSE
|
61
|
+
SQLITE_IOERR_SHMOPEN
|
62
|
+
SQLITE_IOERR_SHMSIZE
|
63
|
+
SQLITE_IOERR_SHMLOCK
|
64
|
+
SQLITE_IOERR_SHMMAP
|
65
|
+
SQLITE_IOERR_SEEK
|
66
|
+
SQLITE_IOERR_DELETE_NOENT
|
67
|
+
SQLITE_IOERR_MMAP
|
68
|
+
SQLITE_IOERR_GETTEMPPATH
|
69
|
+
SQLITE_IOERR_CONVPATH
|
70
|
+
SQLITE_IOERR_VNODE
|
71
|
+
SQLITE_IOERR_AUTH
|
72
|
+
SQLITE_IOERR_BEGIN_ATOMIC
|
73
|
+
SQLITE_IOERR_COMMIT_ATOMIC
|
74
|
+
SQLITE_IOERR_ROLLBACK_ATOMIC
|
75
|
+
SQLITE_IOERR_DATA
|
76
|
+
SQLITE_IOERR_CORRUPTFS
|
77
|
+
SQLITE_LOCKED_SHAREDCACHE
|
78
|
+
SQLITE_LOCKED_VTAB
|
79
|
+
SQLITE_BUSY_RECOVERY
|
80
|
+
SQLITE_BUSY_SNAPSHOT
|
81
|
+
SQLITE_BUSY_TIMEOUT
|
82
|
+
SQLITE_CANTOPEN_NOTEMPDIR
|
83
|
+
SQLITE_CANTOPEN_ISDIR
|
84
|
+
SQLITE_CANTOPEN_FULLPATH
|
85
|
+
SQLITE_CANTOPEN_CONVPATH
|
86
|
+
SQLITE_CANTOPEN_DIRTYWAL
|
87
|
+
SQLITE_CANTOPEN_SYMLINK
|
88
|
+
SQLITE_CORRUPT_VTAB
|
89
|
+
SQLITE_CORRUPT_SEQUENCE
|
90
|
+
SQLITE_CORRUPT_INDEX
|
91
|
+
SQLITE_READONLY_RECOVERY
|
92
|
+
SQLITE_READONLY_CANTLOCK
|
93
|
+
SQLITE_READONLY_ROLLBACK
|
94
|
+
SQLITE_READONLY_DBMOVED
|
95
|
+
SQLITE_READONLY_CANTINIT
|
96
|
+
SQLITE_READONLY_DIRECTORY
|
97
|
+
SQLITE_ABORT_ROLLBACK
|
98
|
+
SQLITE_CONSTRAINT_CHECK
|
99
|
+
SQLITE_CONSTRAINT_COMMITHOOK
|
100
|
+
SQLITE_CONSTRAINT_FOREIGNKEY
|
101
|
+
SQLITE_CONSTRAINT_FUNCTION
|
102
|
+
SQLITE_CONSTRAINT_NOTNULL
|
103
|
+
SQLITE_CONSTRAINT_PRIMARYKEY
|
104
|
+
SQLITE_CONSTRAINT_TRIGGER
|
105
|
+
SQLITE_CONSTRAINT_UNIQUE
|
106
|
+
SQLITE_CONSTRAINT_VTAB
|
107
|
+
SQLITE_CONSTRAINT_ROWID
|
108
|
+
SQLITE_CONSTRAINT_PINNED
|
109
|
+
SQLITE_NOTICE_RECOVER_WAL
|
110
|
+
SQLITE_NOTICE_RECOVER_ROLLBACK
|
111
|
+
SQLITE_WARNING_AUTOINDEX
|
112
|
+
SQLITE_AUTH_USER
|
113
|
+
SQLITE_OK_LOAD_PERMANENTLY
|
114
|
+
SQLITE_OK_SYMLINK
|
115
|
+
]
|
116
|
+
|
117
|
+
deprecated_codes = %w[ SQLITE_GET_LOCKPROXYFILE SQLITE_SET_LOCKPROXYFILE SQLITE_LAST_ERRNO ]
|
118
|
+
version_codes = %w[ SQLITE_VERSION SQLITE_VERSION_NUMBER SQLITE_SOURCE_ID ]
|
119
|
+
rtree_codes = %w[ NOT_WITHIN PARTLY_WITHIN FULLY_WITHIN ]
|
120
|
+
|
121
|
+
authorizer_codes = %w[
|
122
|
+
SQLITE_DENY
|
123
|
+
SQLITE_IGNORE
|
124
|
+
SQLITE_CREATE_INDEX
|
125
|
+
SQLITE_CREATE_TABLE
|
126
|
+
SQLITE_CREATE_TEMP_INDEX
|
127
|
+
SQLITE_CREATE_TEMP_TABLE
|
128
|
+
SQLITE_CREATE_TEMP_TRIGGER
|
129
|
+
SQLITE_CREATE_TEMP_VIEW
|
130
|
+
SQLITE_CREATE_TRIGGER
|
131
|
+
SQLITE_CREATE_VIEW
|
132
|
+
SQLITE_DELETE
|
133
|
+
SQLITE_DROP_INDEX
|
134
|
+
SQLITE_DROP_TABLE
|
135
|
+
SQLITE_DROP_TEMP_INDEX
|
136
|
+
SQLITE_DROP_TEMP_TABLE
|
137
|
+
SQLITE_DROP_TEMP_TRIGGER
|
138
|
+
SQLITE_DROP_TEMP_VIEW
|
139
|
+
SQLITE_DROP_TRIGGER
|
140
|
+
SQLITE_DROP_VIEW
|
141
|
+
SQLITE_INSERT
|
142
|
+
SQLITE_PRAGMA
|
143
|
+
SQLITE_READ
|
144
|
+
SQLITE_SELECT
|
145
|
+
SQLITE_TRANSACTION
|
146
|
+
SQLITE_UPDATE
|
147
|
+
SQLITE_ATTACH
|
148
|
+
SQLITE_DETACH
|
149
|
+
SQLITE_ALTER_TABLE
|
150
|
+
SQLITE_REINDEX
|
151
|
+
SQLITE_ANALYZE
|
152
|
+
SQLITE_CREATE_VTABLE
|
153
|
+
SQLITE_DROP_VTABLE
|
154
|
+
SQLITE_FUNCTION
|
155
|
+
SQLITE_SAVEPOINT
|
156
|
+
SQLITE_COPY
|
157
|
+
SQLITE_RECURSIVE
|
158
|
+
]
|
159
|
+
|
160
|
+
text_encoding_codes = %w[
|
161
|
+
SQLITE_UTF8
|
162
|
+
SQLITE_UTF16LE
|
163
|
+
SQLITE_UTF16BE
|
164
|
+
SQLITE_UTF16
|
165
|
+
SQLITE_ANY
|
166
|
+
SQLITE_UTF16_ALIGNED
|
167
|
+
SQLITE_DETERMINISTIC
|
168
|
+
SQLITE_DIRECTONLY
|
169
|
+
SQLITE_SUBTYPE
|
170
|
+
SQLITE_INNOCUOUS
|
171
|
+
]
|
172
|
+
|
173
|
+
data_type_codes = %w[
|
174
|
+
SQLITE_INTEGER
|
175
|
+
SQLITE_FLOAT
|
176
|
+
SQLITE_BLOB
|
177
|
+
SQLITE_NULL
|
178
|
+
SQLITE3_TEXT
|
179
|
+
]
|
180
|
+
|
181
|
+
fts5_codes = %w[
|
182
|
+
FTS5_TOKENIZE_QUERY
|
183
|
+
FTS5_TOKENIZE_PREFIX
|
184
|
+
FTS5_TOKENIZE_DOCUMENT
|
185
|
+
FTS5_TOKENIZE_AUX
|
186
|
+
FTS5_TOKEN_COLOCATED
|
187
|
+
]
|
188
|
+
|
189
|
+
ignore_codes = [
|
190
|
+
# vtab related
|
191
|
+
"SQLITE_ROLLBACK",
|
192
|
+
"SQLITE_FAIL",
|
193
|
+
"SQLITE_REPLACE",
|
194
|
+
"SQLITE_VTAB_CONSTRAINT_SUPPORT",
|
195
|
+
"SQLITE_VTAB_INNOCUOUS",
|
196
|
+
"SQLITE_VTAB_DIRECTONLY",
|
197
|
+
|
198
|
+
# sqlite destructor callback codes
|
199
|
+
"SQLITE_STATIC",
|
200
|
+
"SQLITE_TRANSIENT",
|
201
|
+
]
|
202
|
+
|
203
|
+
# oddball name
|
204
|
+
module_name_mapping = {
|
205
|
+
|
206
|
+
"DBCONFIG" => "DBConfig",
|
207
|
+
"DBSTATUS" => "DBStatus",
|
208
|
+
"IOCAP" => "IOCap",
|
209
|
+
"SHM" => "SHM",
|
210
|
+
"SCANSTAT" => "ScanStat",
|
211
|
+
"STMTSTATUS" => "StatementStatus",
|
212
|
+
"CHANGESETAPPLY" => "ChangesetApply",
|
213
|
+
"CHANGESETSTART" => "ChangesetStart",
|
214
|
+
"TXN" => "Transaction",
|
215
|
+
}
|
216
|
+
|
217
|
+
defines = []
|
218
|
+
IO.readlines(sqlite3_h_fname).each do |l|
|
219
|
+
result = {
|
220
|
+
"c_define" => nil,
|
221
|
+
"c_value" => nil,
|
222
|
+
"docstring" => nil,
|
223
|
+
|
224
|
+
"is_error_code" => false,
|
225
|
+
|
226
|
+
"r_module" => nil,
|
227
|
+
"r_constant" => nil,
|
228
|
+
}
|
229
|
+
|
230
|
+
if l =~ /beginning-of-error-codes/ .. l =~ /end-of-error-codes/ then
|
231
|
+
result["is_error_code"] = true
|
232
|
+
end
|
233
|
+
|
234
|
+
l.strip!
|
235
|
+
md = l.match(/\A#define\s+(\w+)\s+([^\/]+)\s*(\/\*(.*)\*\/)?\Z/)
|
236
|
+
next unless md
|
237
|
+
|
238
|
+
# Name munging
|
239
|
+
c_define = md[1]
|
240
|
+
|
241
|
+
c_parts = c_define.gsub(/^SQLITE_/,'').split("_")
|
242
|
+
r_module = c_parts.shift
|
243
|
+
r_constant = c_parts.join("_")
|
244
|
+
|
245
|
+
|
246
|
+
# custom module naming so they are human readable
|
247
|
+
r_module = module_name_mapping.fetch(r_module) { |m| r_module.capitalize }
|
248
|
+
|
249
|
+
case c_define
|
250
|
+
when *version_codes
|
251
|
+
next
|
252
|
+
|
253
|
+
when *deprecated_codes
|
254
|
+
next
|
255
|
+
|
256
|
+
when *rtree_codes
|
257
|
+
r_module = "RTree"
|
258
|
+
r_constant = c_define
|
259
|
+
|
260
|
+
when *result_codes
|
261
|
+
r_module = "ResultCode"
|
262
|
+
r_constant = c_define.gsub(/^SQLITE_/,'')
|
263
|
+
|
264
|
+
when *authorizer_codes
|
265
|
+
r_module = "Authorizer"
|
266
|
+
r_constant = c_define.gsub(/^SQLITE_/,'')
|
267
|
+
|
268
|
+
when *text_encoding_codes
|
269
|
+
r_module = "TextEncoding"
|
270
|
+
r_constant = c_define.gsub(/^SQLITE_/,'')
|
271
|
+
|
272
|
+
when *data_type_codes
|
273
|
+
r_module = "DataType"
|
274
|
+
r_constant = c_define.gsub(/^SQLITE(3)?_/,'')
|
275
|
+
|
276
|
+
when *fts5_codes
|
277
|
+
r_module = "FTS5"
|
278
|
+
r_constant = c_define.gsub(/^FTS5_/,'')
|
279
|
+
|
280
|
+
when *ignore_codes
|
281
|
+
next
|
282
|
+
|
283
|
+
when /TESTCTRL/ # sqlite3 codes used in testing
|
284
|
+
next
|
285
|
+
|
286
|
+
when /^__/ # sqlite3 internal items
|
287
|
+
next
|
288
|
+
end
|
289
|
+
|
290
|
+
result["c_define"] = c_define
|
291
|
+
result["c_value"] = md[2].strip
|
292
|
+
if !md[4].nil? && (md[4].strip.length > 0) then
|
293
|
+
result["docstring"] = md[4].strip
|
294
|
+
end
|
295
|
+
result["r_module"] = r_module
|
296
|
+
result["r_constant"] = r_constant
|
297
|
+
|
298
|
+
defines << result
|
299
|
+
end
|
300
|
+
|
301
|
+
#
|
302
|
+
# rework defines into constants
|
303
|
+
#
|
304
|
+
CONSTANTS = defines.group_by{ |d| d["r_module"] }
|
305
|
+
|
306
|
+
fname = File.expand_path(File.join(File.dirname(__FILE__), "amalgalite_constants.c"))
|
307
|
+
|
308
|
+
|
309
|
+
File.open(fname, "w+") do |f|
|
310
|
+
f.puts "/* Generated by gen_constants.rb -- do not edit */"
|
311
|
+
f.puts
|
312
|
+
f.puts '#include "amalgalite.h"'
|
313
|
+
f.puts '/**'
|
314
|
+
f.puts ' * Document-class: Amalgalite::SQLite3::Constants'
|
315
|
+
f.puts ' *'
|
316
|
+
f.puts ' * class holding constants in the sqlite extension'
|
317
|
+
f.puts ' */'
|
318
|
+
f.puts "void Init_amalgalite_constants( )"
|
319
|
+
f.puts "{"
|
320
|
+
f.puts
|
321
|
+
f.puts ' VALUE ma = rb_define_module("Amalgalite");'
|
322
|
+
f.puts ' VALUE mas = rb_define_module_under(ma, "SQLite3");'
|
323
|
+
f.puts
|
324
|
+
f.puts " /*"
|
325
|
+
f.puts " * module encapsulating all the SQLite C extension constants "
|
326
|
+
f.puts " */"
|
327
|
+
f.puts ' VALUE mC = rb_define_module_under( mas, "Constants");'
|
328
|
+
|
329
|
+
|
330
|
+
CONSTANTS.keys.sort.each do |mod|
|
331
|
+
f.puts " /**"
|
332
|
+
f.puts " * module encapsulating the SQLite3 C extension constants for #{mod}"
|
333
|
+
f.puts " */"
|
334
|
+
f.puts " VALUE mC_#{mod} = rb_define_module_under(mC, \"#{mod}\");"
|
335
|
+
f.puts
|
336
|
+
end
|
337
|
+
|
338
|
+
CONSTANTS.keys.sort.each do |mod|
|
339
|
+
const_set = CONSTANTS[mod]
|
340
|
+
const_set.sort_by { |c| c["c_define"] }.each do |result|
|
341
|
+
sql_const = result["c_define"]
|
342
|
+
const_doc = " /* no meaningful autogenerated documentation -- constant is self explanatory ?*/"
|
343
|
+
if !result["docstring"].nil? then
|
344
|
+
const_doc = " /* #{result['c_value']} -- #{result['docstring']} */"
|
345
|
+
end
|
346
|
+
ruby_constant = result['r_constant']
|
347
|
+
f.puts const_doc
|
348
|
+
f.puts " rb_define_const(mC_#{mod}, \"#{ruby_constant}\", INT2FIX(#{sql_const}));"
|
349
|
+
f.puts
|
350
|
+
end
|
351
|
+
end
|
352
|
+
f.puts "}"
|
353
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
Top level "methods"
|
2
|
+
===================
|
3
|
+
|
4
|
+
*done* const char* sqlite3_libversion(void)
|
5
|
+
*done* int sqlite3_libversion_number(void)
|
6
|
+
*done* int sqlite3_threadsave(void)
|
7
|
+
*done* int sqlite3_complete(const char*sql);
|
8
|
+
*done* int sqlite3_complete16(const void *sql);
|
9
|
+
|
10
|
+
*done* sqlite3_int64 sqlite3_memory_used(void);
|
11
|
+
*done* sqlite3_int64 sqtlie3_memory_highwater(int resetFlag);
|
12
|
+
*done* void sqlite3_randomness(int N, void *p)
|
13
|
+
|
14
|
+
*future* int sqlite3_enabled_shared_cache(int); # TODO maybe
|
15
|
+
*future* int sqlite3_release_memory(int); // maybe, hook into gc calls ?
|
16
|
+
*future* void sqlite3_soft_heap_limit(int);
|
17
|
+
*future* char* sqlite3_temp_directory;
|
18
|
+
|
19
|
+
UTF-8 vs. UTF-16
|
20
|
+
----------------
|
21
|
+
|
22
|
+
in cases where there is a xxx16() method in the C api, the ruby methods add a
|
23
|
+
flag to the method.
|
24
|
+
|
25
|
+
Core 'Objects'
|
26
|
+
==============
|
27
|
+
|
28
|
+
sqlite3 (typdef struct sqlite3) -> main database handle
|
29
|
+
-------
|
30
|
+
*done* int sqlite3_open_v2(*filename, sqlite3**, flags, NULL)
|
31
|
+
*done* int sqlite3_open16
|
32
|
+
*done* int sqlite3_extended_result_codes(sqlite3, int onoff) # default to turning this on
|
33
|
+
*skipped* called during rb_raise
|
34
|
+
*skipped* const char *sqlite3_errmsg(sqlite3*);
|
35
|
+
*skipped* const void *sqlite3_errmsg16(sqlite3*);
|
36
|
+
*done* int sqlite3_close(sqlite3 *)
|
37
|
+
*skipped* int sqlite3_exec -> don't use, wrap in ruby exec
|
38
|
+
*done* sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*)
|
39
|
+
*done* int sqlite3_get_autocommit(sqlite3*)
|
40
|
+
*done* int sqlite3_changes(sqlite3*)
|
41
|
+
*done* int sqlite3_total_changes(sqlite3*)
|
42
|
+
*skipped* int sqlite3_errcode(sqlite3 *db)
|
43
|
+
*done* int sqlite3_prepare_v2(sqlite3* db, sql, nbyte, sqlite3_stmt**, const char **tail)
|
44
|
+
|
45
|
+
int sqlite3_prepare16_v2(sqlite3* db, sql, nbyte, sqlite3_stmt**, const char **tail)
|
46
|
+
|
47
|
+
// not yet, but implement if/when a purchase of sqlite3 encryption works
|
48
|
+
TODO: int sqlite3_key(sqlite3* db, const void *pKey, int nKey);
|
49
|
+
TODO: int sqlite3_rekey(sqlite3* db, const void *pKey, int nKey);
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
TODO: int sqlite3_busy_timeout(sqlite3*)
|
54
|
+
*done* void sqlite3_progress_hander(sqlite3*, int, int(*)(void*), void*)
|
55
|
+
|
56
|
+
*done* tracing should be an IO object, if it is true then send it to STDERR
|
57
|
+
*done* tracing should also yield a block like a transaction so that during the block the db has tracing turned on.
|
58
|
+
*done* sqlite3_trace
|
59
|
+
|
60
|
+
TODO: create Table and Column classes
|
61
|
+
TODO: int sqlite3_table_column_metadata();
|
62
|
+
|
63
|
+
for later implementation
|
64
|
+
________________________
|
65
|
+
sqlite3_enable_load_extensions
|
66
|
+
sqlite3_load_extension
|
67
|
+
sqlite3_interrupt
|
68
|
+
sqlite3_busy_handler(sqlite3*, function pointer, void *)
|
69
|
+
|
70
|
+
*skip - experimental* sqlite3_profile
|
71
|
+
*Skip - experimental* sqlite3_limit(sqlite3*, int id, int newVal) -- maybe implement
|
72
|
+
*skip - experimental* sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
|
73
|
+
*skip - experimental* sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
|
74
|
+
*skip - experimental* sqlite3_update_hook(sqlite3*, function ponter, void*);
|
75
|
+
|
76
|
+
|
77
|
+
sqlite3_stmt (typedef struct sqlite3_stmt) -> handle for statements
|
78
|
+
------------
|
79
|
+
*done* const char *sqlite3_sql(sqlite3_stmt *pStmt)
|
80
|
+
*done* int sqlite3_bind_parameter_count(sqlite3_stmt*);
|
81
|
+
|
82
|
+
*done* sqlite3_bind_double(sqlite3_stmt*, int, double);
|
83
|
+
*done* sqlite3_bind_int(sqlite3_stmt*, int, int);
|
84
|
+
*done* sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
|
85
|
+
*done* sqlite3_bind_null(sqlite3_stmt*, int);
|
86
|
+
*done* sqlite3_bind_text(sqlite3_stmt*, int, constc char*, int n, void(*)(void*));
|
87
|
+
* skipping *sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
|
88
|
+
*done* const char* sqlite3_bind_parameter_name(sqlite3_stmt*, int )
|
89
|
+
*done* sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
|
90
|
+
*done* sqlite3_clear_bindings(sqlite3_stmt*);
|
91
|
+
*done* sqlite3_column_count(sqlite3_stmt *pStmt);
|
92
|
+
*done* sqlite3_column_name(sqlite3_stmt*, int N);
|
93
|
+
*skip - used internally* sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
|
94
|
+
*done* sqlite3_column_database_name(sqlite3_stmt*, int);
|
95
|
+
*done* sqlite3_column_table_name(sqlite3_stmt*, int);
|
96
|
+
*done* sqlite3_column_origin_name(sqlite3_stmt*, int);
|
97
|
+
*done* sqlite3_step(sqlite3_stmt*);
|
98
|
+
*done - as 'close' *int sqlite3_finalize(sqlite3_stmt *pStmt);
|
99
|
+
*done* int sqlite3_reset(sqlite3_stmt *pStmt);
|
100
|
+
*done - same as sqlite3_column_count* sqlite3_data_count(sqlite3_stmt *pStmt);
|
101
|
+
*do not use* sqlite3_value* sqlite3_column_value(sqlite3_stmt*, int iCol);
|
102
|
+
|
103
|
+
sqlite3_bind_text16(sqlite3_stmt*, int, constc char*, int, void(*)(void*));
|
104
|
+
* done *sqlite3_column_database_name16(sqlite3_stmt*, int);
|
105
|
+
* done *sqlite3_column_table_name16(sqlite3_stmt*, int);
|
106
|
+
* done *sqlite3_column_origin_name16(sqlite3_stmt*, int);
|
107
|
+
sqlite3_column_name16(sqlite3_stmt*, int N);
|
108
|
+
|
109
|
+
*done* sqlite3_column_decltype(sqlite3_stmt*, int);
|
110
|
+
sqlite3_column_decltype16(sqlite3_stmt*, int);
|
111
|
+
|
112
|
+
// use this to find the type and then call the appropriate method afterwards.
|
113
|
+
*done* sqlite3_column_type(sqlite3_stmt*, int iCol);
|
114
|
+
|
115
|
+
# binding by name or index, if passed in an array to the bind() method then
|
116
|
+
# bind by index, if passed in a hash, bind by name, using hte keys of the hash
|
117
|
+
*done* sqlite3_bind_blob(sqlite3_stmt*, int, const void *, int n, void(*)(void*));
|
118
|
+
*done* sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
|
119
|
+
|
120
|
+
|
121
|
+
sqlite3_blob
|
122
|
+
------------
|
123
|
+
// BLOB
|
124
|
+
*done* sqlite3_blob_open(sqlite3*, *db, *table, *column, rowid, flags, **blob);
|
125
|
+
*done* sqlite3_blob_close(sqlite3_blob*)
|
126
|
+
*done* sqlite3_blob_bytes(sqlite3_blob*)
|
127
|
+
*done* sqlite3_blob_read(sqlite3_blob*, *to_buffer, bytes_to_read, starting_at_offset);
|
128
|
+
*done* sqlite3_blob_write(sqlite3_blob*, *from_buffer, bytes_to_write, starting_at_offset);
|
129
|
+
|
130
|
+
Result Codes
|
131
|
+
============
|
132
|
+
|
133
|
+
*done* Convert to Individual Exceptions and allow the top level module generate them
|
134
|
+
based upon integer value
|