amalgalite 1.1.2-x86-mswin32 → 1.3.0-x86-mswin32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CONTRIBUTING.md +49 -0
- data/{HISTORY.rdoc → HISTORY.md} +96 -73
- data/LICENSE +2 -2
- data/Manifest.txt +104 -0
- data/README.md +73 -0
- data/Rakefile +25 -0
- data/TODO.md +50 -0
- data/ext/amalgalite/{amalgalite3.c → c/amalgalite.c} +12 -12
- data/ext/amalgalite/{amalgalite3.h → c/amalgalite.h} +5 -5
- data/ext/amalgalite/{amalgalite3_blob.c → c/amalgalite_blob.c} +2 -2
- data/ext/amalgalite/{amalgalite3_constants.c → c/amalgalite_constants.c} +2 -2
- data/ext/amalgalite/{amalgalite3_database.c → c/amalgalite_database.c} +49 -21
- data/ext/amalgalite/{amalgalite3_requires_bootstrap.c → c/amalgalite_requires_bootstrap.c} +131 -58
- data/ext/amalgalite/{amalgalite3_statement.c → c/amalgalite_statement.c} +2 -2
- data/ext/amalgalite/{extconf.rb → c/extconf.rb} +4 -4
- data/ext/amalgalite/{gen_constants.rb → c/gen_constants.rb} +3 -3
- data/ext/amalgalite/c/notes.txt +134 -0
- data/ext/amalgalite/{sqlite3.c → c/sqlite3.c} +94602 -80497
- data/ext/amalgalite/{sqlite3.h → c/sqlite3.h} +1047 -216
- data/ext/amalgalite/{sqlite3_options.h → c/sqlite3_options.h} +0 -0
- data/ext/amalgalite/{sqlite3ext.h → c/sqlite3ext.h} +40 -13
- data/lib/amalgalite.rb +13 -6
- data/lib/amalgalite/1.8/amalgalite.so +0 -0
- data/lib/amalgalite/1.9/amalgalite.so +0 -0
- data/lib/amalgalite/2.0/amalgalite.so +0 -0
- data/lib/amalgalite/column.rb +7 -5
- data/lib/amalgalite/database.rb +18 -10
- data/lib/amalgalite/packer.rb +5 -2
- data/lib/amalgalite/requires.rb +47 -16
- data/lib/amalgalite/schema.rb +63 -36
- data/lib/amalgalite/sqlite3/version.rb +0 -1
- data/lib/amalgalite/statement.rb +7 -5
- data/lib/amalgalite/table.rb +9 -8
- data/lib/amalgalite/type_maps/default_map.rb +0 -1
- data/lib/amalgalite/type_maps/storage_map.rb +0 -2
- data/lib/amalgalite/type_maps/text_map.rb +0 -1
- data/lib/amalgalite/version.rb +3 -32
- data/spec/aggregate_spec.rb +1 -1
- data/spec/amalgalite_spec.rb +1 -1
- data/spec/blob_spec.rb +1 -1
- data/spec/boolean_spec.rb +2 -1
- data/spec/busy_handler.rb +1 -1
- data/spec/database_spec.rb +16 -11
- data/spec/default_map_spec.rb +1 -1
- data/spec/function_spec.rb +1 -1
- data/spec/integeration_spec.rb +2 -1
- data/spec/packer_spec.rb +4 -4
- data/spec/paths_spec.rb +1 -1
- data/spec/progress_handler_spec.rb +4 -5
- data/spec/requires_spec.rb +36 -2
- data/spec/rtree_spec.rb +6 -5
- data/spec/schema_spec.rb +28 -20
- data/spec/spec_helper.rb +2 -7
- data/spec/sqlite3/constants_spec.rb +1 -1
- data/spec/sqlite3/database_status_spec.rb +4 -4
- data/spec/sqlite3/status_spec.rb +5 -5
- data/spec/sqlite3/version_spec.rb +7 -7
- data/spec/sqlite3_spec.rb +3 -3
- data/spec/statement_spec.rb +3 -4
- data/spec/storage_map_spec.rb +1 -1
- data/spec/tap_spec.rb +4 -4
- data/spec/text_map_spec.rb +1 -1
- data/spec/type_map_spec.rb +1 -1
- data/spec/version_spec.rb +2 -9
- data/tasks/custom.rake +99 -0
- data/tasks/default.rake +277 -0
- data/tasks/extension.rake +28 -202
- data/tasks/this.rb +209 -0
- metadata +102 -191
- data/README.rdoc +0 -54
- data/gemspec.rb +0 -63
- data/lib/amalgalite/1.8/amalgalite3.so +0 -0
- data/lib/amalgalite/1.9/amalgalite3.so +0 -0
- data/tasks/announce.rake +0 -44
- data/tasks/config.rb +0 -107
- data/tasks/distribution.rake +0 -77
- data/tasks/documentation.rake +0 -36
- data/tasks/rspec.rake +0 -30
- data/tasks/utils.rb +0 -80
@@ -5,7 +5,7 @@
|
|
5
5
|
* vim: shiftwidth=4
|
6
6
|
*/
|
7
7
|
|
8
|
-
#include "
|
8
|
+
#include "amalgalite.h"
|
9
9
|
#include <stdio.h>
|
10
10
|
extern VALUE mA;
|
11
11
|
VALUE cAR;
|
@@ -28,57 +28,24 @@ void am_bootstrap_cleanup_and_raise( const char* msg, sqlite3* db, sqlite3_stmt*
|
|
28
28
|
}
|
29
29
|
|
30
30
|
|
31
|
-
|
32
|
-
* call-seq:
|
33
|
-
* Amalgalite::Requires::Bootstrap.lift( 'dbfile' => "lib.db", 'table_name' => "bootload", 'rowid_column' => "id", 'filename_column' => "filename", 'content_column' => "contents" )
|
34
|
-
*
|
35
|
-
* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*
|
36
|
-
*
|
37
|
-
* This is a boostrap mechanism to eval all the code in a particular column in a
|
38
|
-
* specially formatted table in an sqlite database. It should only be used for
|
39
|
-
* a specific purpose, mainly loading the Amalgalite ruby code directly from an
|
40
|
-
* sqlite table.
|
41
|
-
*
|
42
|
-
* Amalgalite::Requires adds in the ability to _require_ code that is in an
|
43
|
-
* sqlite database. Since Amalgalite::Requires is itself ruby code, if
|
44
|
-
* Amalgalite::Requires was in an sqlite database, it could not _require_
|
45
|
-
* itself. Therefore this method is made available. It is a pure C extension
|
46
|
-
* method that directly calls the sqlite3 C functions directly and uses the ruby
|
47
|
-
* C api to eval the data in the table.
|
48
|
-
*
|
49
|
-
* This method attaches to an sqlite3 database (filename) and then does:
|
50
|
-
*
|
51
|
-
* SELECT filename_column_name, content_column_name
|
52
|
-
* FROM table_name
|
53
|
-
* ORDER BY rowid_column_name
|
54
|
-
*
|
55
|
-
* For each row returned it does an _eval_ on the code in the
|
56
|
-
* *content_column_name* and then updates _$LOADED_FEATURES_ directly with the value from
|
57
|
-
* *filename_column_name*.
|
58
|
-
*
|
59
|
-
* The database to be opened by _lift_ *must* be an sqlite3 UTF-8 database.
|
60
|
-
*
|
61
|
-
*/
|
62
|
-
VALUE am_bootstrap_lift( VALUE self, VALUE args )
|
31
|
+
void am_bootstrap_from_db( sqlite3* db, VALUE args )
|
63
32
|
{
|
64
|
-
sqlite3* db = NULL;
|
65
33
|
sqlite3_stmt* stmt = NULL;
|
66
34
|
int rc;
|
67
|
-
int last_row_good;
|
68
35
|
char raise_msg[BUFSIZ];
|
36
|
+
int last_row_good;
|
69
37
|
|
70
|
-
VALUE am_db_c = rb_const_get( cARB, rb_intern("DEFAULT_DB") );
|
71
38
|
VALUE am_tbl_c = rb_const_get( cARB, rb_intern("DEFAULT_BOOTSTRAP_TABLE") );
|
72
39
|
VALUE am_pk_c = rb_const_get( cARB, rb_intern("DEFAULT_ROWID_COLUMN") );
|
73
40
|
VALUE am_fname_c = rb_const_get( cARB, rb_intern("DEFAULT_FILENAME_COLUMN") );
|
74
41
|
VALUE am_content_c = rb_const_get( cARB, rb_intern("DEFAULT_CONTENTS_COLUMN") );
|
75
42
|
|
76
|
-
char* dbfile = NULL;
|
77
43
|
char* tbl_name = NULL;
|
78
44
|
char* pk_col = NULL;
|
79
45
|
char* fname_col = NULL;
|
80
46
|
char* content_col = NULL;
|
81
47
|
|
48
|
+
|
82
49
|
char sql[BUFSIZ];
|
83
50
|
const char* sql_tail = NULL;
|
84
51
|
int sql_bytes = 0;
|
@@ -94,30 +61,13 @@ VALUE am_bootstrap_lift( VALUE self, VALUE args )
|
|
94
61
|
ID eval_id = rb_intern("eval");
|
95
62
|
|
96
63
|
|
97
|
-
if ( Qnil == args ) {
|
98
|
-
args = rb_hash_new();
|
99
|
-
} else {
|
100
|
-
args = rb_ary_shift( args );
|
101
|
-
}
|
102
64
|
|
103
|
-
Check_Type( args, T_HASH );
|
104
|
-
|
105
|
-
/* get the arguments */
|
106
|
-
dbfile = ( Qnil == (tmp = rb_hash_aref( args, rb_str_new2( "dbfile" ) ) ) ) ? StringValuePtr( am_db_c ) : StringValuePtr( tmp );
|
107
65
|
tbl_name = ( Qnil == (tmp = rb_hash_aref( args, rb_str_new2( "table_name" ) ) ) ) ? StringValuePtr( am_tbl_c ) : StringValuePtr( tmp );
|
108
66
|
pk_col = ( Qnil == (tmp = rb_hash_aref( args, rb_str_new2( "rowid_column" ) ) ) ) ? StringValuePtr( am_pk_c ) : StringValuePtr( tmp );
|
109
67
|
fname_col = ( Qnil == (tmp = rb_hash_aref( args, rb_str_new2( "filename_column" ) ) ) ) ? StringValuePtr( am_fname_c ) : StringValuePtr( tmp );
|
110
68
|
content_col = ( Qnil == (tmp = rb_hash_aref( args, rb_str_new2( "contents_column" ) ) ) ) ? StringValuePtr( am_content_c ) : StringValuePtr( tmp );
|
111
69
|
|
112
70
|
|
113
|
-
/* open the database */
|
114
|
-
rc = sqlite3_open_v2( dbfile , &db, SQLITE_OPEN_READONLY, NULL);
|
115
|
-
if ( SQLITE_OK != rc ) {
|
116
|
-
memset( raise_msg, 0, BUFSIZ );
|
117
|
-
snprintf(raise_msg, BUFSIZ, "Failure to open database %s for bootload: [SQLITE_ERROR %d] : %s", dbfile, rc, sqlite3_errmsg( db ) );
|
118
|
-
am_bootstrap_cleanup_and_raise( raise_msg, db, stmt );
|
119
|
-
}
|
120
|
-
|
121
71
|
/* prepare the db query */
|
122
72
|
memset( sql, 0, BUFSIZ );
|
123
73
|
sql_bytes = snprintf( sql, BUFSIZ, "SELECT %s, %s FROM %s ORDER BY %s", fname_col, content_col, tbl_name, pk_col );
|
@@ -167,24 +117,146 @@ VALUE am_bootstrap_lift( VALUE self, VALUE args )
|
|
167
117
|
am_bootstrap_cleanup_and_raise( raise_msg, db, stmt );
|
168
118
|
}
|
169
119
|
|
170
|
-
|
120
|
+
}
|
121
|
+
|
122
|
+
|
123
|
+
/**
|
124
|
+
* call-seq:
|
125
|
+
* Amalgalite::Requires::Bootstrap.lift( 'dbfile' => "lib.db", 'table_name' => "bootload", 'rowid_column' => "id", 'filename_column' => "filename", 'content_column' => "contents" )
|
126
|
+
*
|
127
|
+
* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*
|
128
|
+
*
|
129
|
+
* This is a boostrap mechanism to eval all the code in a particular column in a
|
130
|
+
* specially formatted table in an sqlite database. It should only be used for
|
131
|
+
* a specific purpose, mainly loading the Amalgalite ruby code directly from an
|
132
|
+
* sqlite table.
|
133
|
+
*
|
134
|
+
* Amalgalite::Requires adds in the ability to _require_ code that is in an
|
135
|
+
* sqlite database. Since Amalgalite::Requires is itself ruby code, if
|
136
|
+
* Amalgalite::Requires was in an sqlite database, it could not _require_
|
137
|
+
* itself. Therefore this method is made available. It is a pure C extension
|
138
|
+
* method that directly calls the sqlite3 C functions directly and uses the ruby
|
139
|
+
* C api to eval the data in the table.
|
140
|
+
*
|
141
|
+
* This method attaches to an sqlite3 database (filename) and then does:
|
142
|
+
*
|
143
|
+
* SELECT filename_column_name, content_column_name
|
144
|
+
* FROM table_name
|
145
|
+
* ORDER BY rowid_column_name
|
146
|
+
*
|
147
|
+
* For each row returned it does an _eval_ on the code in the
|
148
|
+
* *content_column_name* and then updates _$LOADED_FEATURES_ directly with the value from
|
149
|
+
* *filename_column_name*.
|
150
|
+
*
|
151
|
+
* The database to be opened by _lift_ *must* be an sqlite3 UTF-8 database.
|
152
|
+
*
|
153
|
+
*/
|
154
|
+
VALUE am_bootstrap_lift( VALUE self, VALUE args )
|
155
|
+
{
|
156
|
+
sqlite3 *db = NULL;
|
157
|
+
int rc;
|
158
|
+
char raise_msg[BUFSIZ];
|
159
|
+
VALUE tmp = Qnil;
|
160
|
+
|
161
|
+
VALUE am_db_c = rb_const_get( cARB, rb_intern("DEFAULT_DB") );
|
162
|
+
|
163
|
+
char *dbfile = NULL;
|
164
|
+
|
165
|
+
|
166
|
+
if ( Qnil == args ) {
|
167
|
+
args = rb_hash_new();
|
168
|
+
} else {
|
169
|
+
args = rb_ary_shift( args );
|
170
|
+
}
|
171
|
+
|
172
|
+
Check_Type( args, T_HASH );
|
173
|
+
|
174
|
+
/* get the arguments */
|
175
|
+
dbfile = ( Qnil == (tmp = rb_hash_aref( args, rb_str_new2( "dbfile" ) ) ) ) ? StringValuePtr( am_db_c ) : StringValuePtr( tmp );
|
176
|
+
|
177
|
+
/* open the database */
|
178
|
+
rc = sqlite3_open_v2( dbfile , &db, SQLITE_OPEN_READONLY, NULL);
|
179
|
+
if ( SQLITE_OK != rc ) {
|
180
|
+
memset( raise_msg, 0, BUFSIZ );
|
181
|
+
snprintf(raise_msg, BUFSIZ, "Failure to open database %s for bootload: [SQLITE_ERROR %d] : %s", dbfile, rc, sqlite3_errmsg( db ) );
|
182
|
+
am_bootstrap_cleanup_and_raise( raise_msg, db, NULL );
|
183
|
+
}
|
184
|
+
|
185
|
+
am_bootstrap_from_db( db, args );
|
171
186
|
|
172
187
|
/* close the database */
|
173
188
|
rc = sqlite3_close( db );
|
174
189
|
if ( SQLITE_OK != rc ) {
|
175
190
|
memset( raise_msg, 0, BUFSIZ );
|
176
191
|
snprintf( raise_msg, BUFSIZ, "Failure to close database : [SQLITE_ERROR %d] : %s\n", rc, sqlite3_errmsg( db )),
|
177
|
-
am_bootstrap_cleanup_and_raise( raise_msg, db,
|
192
|
+
am_bootstrap_cleanup_and_raise( raise_msg, db, NULL );
|
178
193
|
}
|
179
194
|
|
180
195
|
return Qnil;
|
181
196
|
}
|
182
197
|
|
198
|
+
/**
|
199
|
+
* call-seq:
|
200
|
+
* Amalgalite::Requires::Bootstrap.lift_str( sql, 'table_name' => "bootload", 'rowid_column' => "id", 'filename_column' => "filename", 'content_column' => "contents" )
|
201
|
+
*
|
202
|
+
* Bootstrap Amalgalite from a string containing an SQL dump. See Amalgalite::Requires::Bootstrap.lift.
|
203
|
+
*
|
204
|
+
* For example:
|
205
|
+
*
|
206
|
+
* Amalgalite::Requires::Bootstrap.lifts(File.read("lib.sql"))
|
207
|
+
*/
|
208
|
+
VALUE am_bootstrap_lift_str( VALUE self, VALUE args )
|
209
|
+
{
|
210
|
+
sqlite3 *db = NULL;
|
211
|
+
int rc;
|
212
|
+
char raise_msg[BUFSIZ];
|
213
|
+
VALUE sql = Qnil;
|
214
|
+
VALUE args_hsh = Qnil;
|
215
|
+
|
216
|
+
sql = rb_ary_shift(args);
|
217
|
+
StringValue(sql);
|
218
|
+
if ( Qnil == sql ) { rb_raise(eARB_Error, "SQL required." ); }
|
219
|
+
|
220
|
+
args_hsh = rb_ary_shift(args);
|
221
|
+
if ( Qnil == args_hsh ) { args_hsh = rb_hash_new(); }
|
222
|
+
|
223
|
+
|
224
|
+
rc = sqlite3_open_v2( ":memory:", &db, SQLITE_OPEN_READWRITE, NULL );
|
225
|
+
if ( SQLITE_OK != rc ) {
|
226
|
+
memset( raise_msg, 0, BUFSIZ );
|
227
|
+
snprintf(raise_msg, BUFSIZ, "Failure to open database :memory: for bootload: [SQLITE_ERROR %d] : %s", rc, sqlite3_errmsg( db ) );
|
228
|
+
am_bootstrap_cleanup_and_raise( raise_msg, db, NULL );
|
229
|
+
}
|
230
|
+
|
231
|
+
/* Load the bootstrap SQL into the database */
|
232
|
+
rc = sqlite3_exec( db, StringValuePtr( sql ), NULL, NULL, NULL );
|
233
|
+
|
234
|
+
if ( SQLITE_OK != rc ) {
|
235
|
+
memset( raise_msg, 0, BUFSIZ );
|
236
|
+
snprintf(raise_msg, BUFSIZ, "Failure to import bootload sql: [SQLITE_ERROR %d] : %s", rc, sqlite3_errmsg( db ) );
|
237
|
+
am_bootstrap_cleanup_and_raise( raise_msg, db, NULL );
|
238
|
+
}
|
239
|
+
|
240
|
+
am_bootstrap_from_db( db, args_hsh );
|
241
|
+
|
242
|
+
rc = sqlite3_close( db );
|
243
|
+
|
244
|
+
if ( SQLITE_OK != rc ) {
|
245
|
+
memset( raise_msg, 0, BUFSIZ );
|
246
|
+
snprintf( raise_msg, BUFSIZ, "Failure to close database : [SQLITE_ERROR %d] : %s\n", rc, sqlite3_errmsg( db )),
|
247
|
+
am_bootstrap_cleanup_and_raise( raise_msg, db, NULL );
|
248
|
+
}
|
249
|
+
|
250
|
+
return Qnil;
|
251
|
+
|
252
|
+
}
|
253
|
+
|
254
|
+
|
183
255
|
/**
|
184
256
|
* Bootstrapping module to help _require_ when Amalgalite::Requires is not
|
185
257
|
* availble in files.
|
186
258
|
*/
|
187
|
-
void
|
259
|
+
void Init_amalgalite_requires_bootstrap()
|
188
260
|
{
|
189
261
|
|
190
262
|
mA = rb_define_module("Amalgalite");
|
@@ -193,7 +265,8 @@ void Init_amalgalite3_requires_bootstrap()
|
|
193
265
|
|
194
266
|
eARB_Error = rb_define_class_under(cARB, "Error", rb_eStandardError);
|
195
267
|
|
196
|
-
rb_define_module_function(cARB, "lift", am_bootstrap_lift, -2);
|
268
|
+
rb_define_module_function(cARB, "lift", am_bootstrap_lift, -2);
|
269
|
+
rb_define_module_function(cARB, "lifts", am_bootstrap_lift, -2);
|
197
270
|
|
198
271
|
/* constants for default db, table, column, rowid, contents */
|
199
272
|
rb_define_const(cARB, "DEFAULT_DB", rb_str_new2( "lib.db" ));
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#include "
|
1
|
+
#include "amalgalite.h"
|
2
2
|
/**
|
3
3
|
* Copyright (c) 2008 Jeremy Hinegardner
|
4
4
|
* All rights reserved. See LICENSE and/or COPYING for details.
|
@@ -604,7 +604,7 @@ VALUE am_sqlite3_statement_alloc(VALUE klass)
|
|
604
604
|
* Amagalite Database extension
|
605
605
|
*/
|
606
606
|
|
607
|
-
void
|
607
|
+
void Init_amalgalite_statement( )
|
608
608
|
{
|
609
609
|
|
610
610
|
VALUE ma = rb_define_module("Amalgalite");
|
@@ -20,17 +20,17 @@ else
|
|
20
20
|
end
|
21
21
|
|
22
22
|
# remove the -g flags if it exists
|
23
|
-
%w[ -ggdb -g ].each do |debug|
|
23
|
+
%w[ -ggdb\\d* -g\\d* ].each do |debug|
|
24
24
|
$CFLAGS = $CFLAGS.gsub(/#{debug}/,'')
|
25
|
-
RbConfig::MAKEFILE_CONFIG['debugflags'] =
|
25
|
+
RbConfig::MAKEFILE_CONFIG['debugflags'] = RbConfig::MAKEFILE_CONFIG['debugflags'].gsub(/#{debug}/,'') if RbConfig::MAKEFILE_CONFIG['debugflags']
|
26
26
|
end
|
27
27
|
|
28
28
|
%w[ shorten-64-to-32 write-strings ].each do |warning|
|
29
29
|
$CFLAGS = $CFLAGS.gsub(/-W#{warning}/,'')
|
30
|
-
|
30
|
+
RbConfig::MAKEFILE_CONFIG['warnflags'] = RbConfig::MAKEFILE_CONFIG['warnflags'].gsub(/-W#{warning}/,'') if RbConfig::MAKEFILE_CONFIG['warnflags']
|
31
31
|
end
|
32
32
|
|
33
33
|
|
34
34
|
|
35
35
|
subdir = RUBY_VERSION.sub(/\.\d$/,'')
|
36
|
-
create_makefile("amalgalite/#{subdir}/
|
36
|
+
create_makefile("amalgalite/#{subdir}/amalgalite")
|
@@ -135,17 +135,17 @@ CONSTANTS = {
|
|
135
135
|
|
136
136
|
}
|
137
137
|
|
138
|
-
fname = File.expand_path(File.join(File.dirname(__FILE__), "
|
138
|
+
fname = File.expand_path(File.join(File.dirname(__FILE__), "amalgalite_constants.c"))
|
139
139
|
File.open(fname, "w+") do |f|
|
140
140
|
f.puts "/* Generated by gen_constants.rb -- do not edit */"
|
141
141
|
f.puts
|
142
|
-
f.puts '#include "
|
142
|
+
f.puts '#include "amalgalite.h"'
|
143
143
|
f.puts '/**'
|
144
144
|
f.puts ' * Document-class: Amalgalite::SQLite3::Constants'
|
145
145
|
f.puts ' *'
|
146
146
|
f.puts ' * class holding constants in the sqlite extension'
|
147
147
|
f.puts ' */'
|
148
|
-
f.puts "void
|
148
|
+
f.puts "void Init_amalgalite_constants( )"
|
149
149
|
f.puts "{"
|
150
150
|
f.puts
|
151
151
|
f.puts ' VALUE ma = rb_define_module("Amalgalite");'
|
@@ -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
|