sqlite3-ruby 0.9.0-mswin32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sqlite3-ruby might be problematic. Click here for more details.
- data/README +36 -0
- data/doc/faq/faq.html +382 -0
- data/doc/faq/faq.rb +177 -0
- data/doc/faq/faq.yml +426 -0
- data/ext/sqlite3_api/MANIFEST +4 -0
- data/ext/sqlite3_api/extconf.rb +8 -0
- data/ext/sqlite3_api/post-clean.rb +3 -0
- data/ext/sqlite3_api/post-distclean.rb +4 -0
- data/ext/sqlite3_api/sqlite3_api.i +339 -0
- data/lib/sqlite3.rb +33 -0
- data/lib/sqlite3/constants.rb +81 -0
- data/lib/sqlite3/database.rb +720 -0
- data/lib/sqlite3/driver/dl/api.rb +184 -0
- data/lib/sqlite3/driver/dl/driver.rb +334 -0
- data/lib/sqlite3/driver/native/driver.rb +218 -0
- data/lib/sqlite3/errors.rb +84 -0
- data/lib/sqlite3/pragmas.rb +254 -0
- data/lib/sqlite3/resultset.rb +172 -0
- data/lib/sqlite3/statement.rb +218 -0
- data/lib/sqlite3/translator.rb +135 -0
- data/lib/sqlite3/value.rb +89 -0
- data/lib/sqlite3/version.rb +45 -0
- data/lib/sqlite3_api.so +0 -0
- data/test/bm.rb +140 -0
- data/test/driver/dl/tc_driver.rb +322 -0
- data/test/mocks.rb +99 -0
- data/test/native-vs-dl.rb +126 -0
- data/test/tc_database.rb +216 -0
- data/test/tc_integration.rb +838 -0
- data/test/tests.rb +36 -0
- metadata +78 -0
@@ -0,0 +1,339 @@
|
|
1
|
+
%module "SQLite3::driver::native::API"
|
2
|
+
%include "typemaps.i"
|
3
|
+
%{
|
4
|
+
#include <sqlite3.h>
|
5
|
+
#include "ruby.h"
|
6
|
+
#include "intern.h"
|
7
|
+
|
8
|
+
#define Init_API Init_sqlite3_api
|
9
|
+
|
10
|
+
struct CallbackData {
|
11
|
+
VALUE proc;
|
12
|
+
VALUE proc2;
|
13
|
+
VALUE data;
|
14
|
+
};
|
15
|
+
|
16
|
+
typedef struct CallbackData CallbackData;
|
17
|
+
typedef void BLOB;
|
18
|
+
typedef void VALBLOB;
|
19
|
+
|
20
|
+
int Sqlite3_ruby_busy_handler(void* data,int value) {
|
21
|
+
VALUE result;
|
22
|
+
CallbackData *cb = (CallbackData*)data;
|
23
|
+
result = rb_funcall(
|
24
|
+
cb->proc, rb_intern("call"), 2, cb->data, INT2FIX(value) );
|
25
|
+
return FIX2INT(result);
|
26
|
+
}
|
27
|
+
|
28
|
+
int Sqlite3_ruby_authorizer(void* data,int type,
|
29
|
+
const char* a,const char* b,const char* c,const char* d)
|
30
|
+
{
|
31
|
+
VALUE result;
|
32
|
+
CallbackData *cb = (CallbackData*)data;
|
33
|
+
result = rb_funcall(
|
34
|
+
cb->proc, rb_intern("call"), 6, cb->data, INT2FIX(type),
|
35
|
+
( a ? rb_str_new2(a) : Qnil ), ( b ? rb_str_new2(b) : Qnil ),
|
36
|
+
( c ? rb_str_new2(c) : Qnil ), ( d ? rb_str_new2(d) : Qnil ) );
|
37
|
+
return FIX2INT(result);
|
38
|
+
}
|
39
|
+
|
40
|
+
void Sqlite3_ruby_trace(void* data, const char *sql) {
|
41
|
+
CallbackData *cb = (CallbackData*)data;
|
42
|
+
rb_funcall( cb->proc, rb_intern("call"), 2, cb->data,
|
43
|
+
sql ? rb_str_new2(sql) : Qnil );
|
44
|
+
}
|
45
|
+
|
46
|
+
void Sqlite3_ruby_function_step(sqlite3_context* ctx,int n,
|
47
|
+
sqlite3_value** args)
|
48
|
+
{
|
49
|
+
CallbackData *data;
|
50
|
+
VALUE rb_args;
|
51
|
+
VALUE *rb_context;
|
52
|
+
int idx;
|
53
|
+
|
54
|
+
data = (CallbackData*)sqlite3_user_data(ctx);
|
55
|
+
|
56
|
+
if( data->proc2 != Qnil ) {
|
57
|
+
rb_context = (VALUE*)sqlite3_aggregate_context(ctx,sizeof(VALUE));
|
58
|
+
if( *rb_context == 0 ) {
|
59
|
+
*rb_context = rb_hash_new();
|
60
|
+
rb_gc_register_address( rb_context );
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
rb_args = rb_ary_new2(n+1);
|
65
|
+
rb_ary_push( rb_args, SWIG_NewPointerObj(ctx,SWIGTYPE_p_sqlite3_context,0) );
|
66
|
+
for( idx = 0; idx < n; idx++ ) {
|
67
|
+
rb_ary_push( rb_args, SWIG_NewPointerObj(args[idx],
|
68
|
+
SWIGTYPE_p_sqlite3_value,0) );
|
69
|
+
}
|
70
|
+
|
71
|
+
rb_apply( data->proc, rb_intern("call"), rb_args );
|
72
|
+
}
|
73
|
+
|
74
|
+
void Sqlite3_ruby_function_final(sqlite3_context *ctx) {
|
75
|
+
VALUE *rb_context;
|
76
|
+
CallbackData *data;
|
77
|
+
|
78
|
+
rb_context = (VALUE*)sqlite3_aggregate_context(ctx,sizeof(VALUE));
|
79
|
+
if( *rb_context == 0 ) {
|
80
|
+
*rb_context = rb_hash_new();
|
81
|
+
rb_gc_register_address( rb_context );
|
82
|
+
}
|
83
|
+
|
84
|
+
data = (CallbackData*)sqlite3_user_data(ctx);
|
85
|
+
|
86
|
+
rb_funcall( data->proc2, rb_intern("call"), 1,
|
87
|
+
SWIG_NewPointerObj(ctx,SWIGTYPE_p_sqlite3_context,0) );
|
88
|
+
|
89
|
+
rb_gc_unregister_address( rb_context );
|
90
|
+
}
|
91
|
+
%}
|
92
|
+
|
93
|
+
struct CallbackData {
|
94
|
+
VALUE proc;
|
95
|
+
VALUE proc2;
|
96
|
+
VALUE data;
|
97
|
+
};
|
98
|
+
|
99
|
+
%typemap(in) const void *str {
|
100
|
+
$1 = (void*)RSTRING($input)->ptr;
|
101
|
+
}
|
102
|
+
|
103
|
+
%typemap(in) (const char *filename, sqlite3**) {
|
104
|
+
$1 = STR2CSTR($input);
|
105
|
+
$2 = (sqlite3**)malloc( sizeof( sqlite3* ) );
|
106
|
+
}
|
107
|
+
|
108
|
+
%typemap(argout) (const char *filename, sqlite3**) {
|
109
|
+
VALUE ary;
|
110
|
+
ary = rb_ary_new2(2);
|
111
|
+
rb_ary_push( ary, $result );
|
112
|
+
rb_ary_push( ary, SWIG_NewPointerObj( *$2, SWIGTYPE_p_sqlite3, 0 ) );
|
113
|
+
free( $2 );
|
114
|
+
$result = ary;
|
115
|
+
}
|
116
|
+
|
117
|
+
%typemap(in) (const void *filename, sqlite3**) {
|
118
|
+
$1 = (void*)RSTRING($input)->ptr;
|
119
|
+
$2 = (sqlite3**)malloc( sizeof( sqlite3* ) );
|
120
|
+
}
|
121
|
+
|
122
|
+
%typemap(argout) (const void *filename, sqlite3**) {
|
123
|
+
VALUE ary;
|
124
|
+
ary = rb_ary_new2(2);
|
125
|
+
rb_ary_push( ary, $result );
|
126
|
+
rb_ary_push( ary, SWIG_NewPointerObj( *$2, SWIGTYPE_p_sqlite3, 0 ) );
|
127
|
+
free( $2 );
|
128
|
+
$result = ary;
|
129
|
+
}
|
130
|
+
|
131
|
+
typedef void BLOB;
|
132
|
+
%typemap(out) const BLOB * {
|
133
|
+
$result = $1 ?
|
134
|
+
rb_str_new( (char*)$1, sqlite3_column_bytes( arg1, arg2 ) ) : Qnil;
|
135
|
+
}
|
136
|
+
|
137
|
+
typedef void VALBLOB;
|
138
|
+
%typemap(out) const VALBLOB * {
|
139
|
+
$result = $1 ? rb_str_new( (char*)$1, sqlite3_value_bytes( arg1 ) ) : Qnil;
|
140
|
+
}
|
141
|
+
|
142
|
+
%typemap(out) const void * {
|
143
|
+
int i;
|
144
|
+
if( $1 ) {
|
145
|
+
for( i = 0; ((char*)$1)[i]; i += 2 );
|
146
|
+
$result = rb_str_new( (char*)$1, i );
|
147
|
+
} else $result = Qnil;
|
148
|
+
}
|
149
|
+
|
150
|
+
%typemap(in) (const char * sql,int,sqlite3_stmt**,const char**) (sqlite3_stmt *stmt, char *errmsg) {
|
151
|
+
$1 = RSTRING($input)->ptr;
|
152
|
+
$2 = RSTRING($input)->len;
|
153
|
+
$3 = &stmt2;
|
154
|
+
$4 = &errmsg2;
|
155
|
+
}
|
156
|
+
|
157
|
+
%typemap(argout) (const char* sql,int,sqlite3_stmt**,const char**) {
|
158
|
+
VALUE ary;
|
159
|
+
ary = rb_ary_new2(3);
|
160
|
+
rb_ary_push( ary, $result );
|
161
|
+
rb_ary_push( ary, SWIG_NewPointerObj( stmt2, SWIGTYPE_p_sqlite3_stmt, 0 ) );
|
162
|
+
rb_ary_push( ary, errmsg2 ? rb_str_new2( errmsg2 ) : Qnil );
|
163
|
+
$result = ary;
|
164
|
+
}
|
165
|
+
|
166
|
+
%typemap(in) (const void* sql,int,sqlite3_stmt**,const void**) (sqlite3_stmt *stmt, void *errmsg) {
|
167
|
+
$1 = RSTRING($input)->ptr;
|
168
|
+
$2 = RSTRING($input)->len;
|
169
|
+
$3 = &stmt2;
|
170
|
+
$4 = &errmsg2;
|
171
|
+
}
|
172
|
+
|
173
|
+
%typemap(argout) (const void* sql,int,sqlite3_stmt**,const void**) {
|
174
|
+
VALUE ary;
|
175
|
+
int i;
|
176
|
+
|
177
|
+
for( i = 0; ((char*)errmsg2)[i]; i += 2 );
|
178
|
+
|
179
|
+
ary = rb_ary_new2(3);
|
180
|
+
rb_ary_push( ary, $result );
|
181
|
+
rb_ary_push( ary, SWIG_NewPointerObj( stmt2, SWIGTYPE_p_sqlite3_stmt, 0 ) );
|
182
|
+
rb_ary_push( ary, errmsg2 ? rb_str_new( (char*)errmsg2, i ) : Qnil );
|
183
|
+
$result = ary;
|
184
|
+
}
|
185
|
+
|
186
|
+
%typemap(in) (const void *blob,int) {
|
187
|
+
$1 = (void*)RSTRING($input)->ptr;
|
188
|
+
$2 = RSTRING($input)->len;
|
189
|
+
}
|
190
|
+
|
191
|
+
%typemap(in) (const void *blob,int,void(*free)(void*)) {
|
192
|
+
$1 = (void*)RSTRING($input)->ptr;
|
193
|
+
$2 = RSTRING($input)->len;
|
194
|
+
$3 = SQLITE_TRANSIENT;
|
195
|
+
}
|
196
|
+
|
197
|
+
%typemap(in) (const char *text,int) {
|
198
|
+
$1 = RSTRING($input)->ptr;
|
199
|
+
$2 = RSTRING($input)->len;
|
200
|
+
}
|
201
|
+
|
202
|
+
%typemap(in) (const char *text,int,void(*free)(void*)) {
|
203
|
+
$1 = RSTRING($input)->ptr;
|
204
|
+
$2 = RSTRING($input)->len;
|
205
|
+
$3 = SQLITE_TRANSIENT;
|
206
|
+
}
|
207
|
+
|
208
|
+
%typemap(in) (const void *utf16,int) {
|
209
|
+
$1 = (void*)RSTRING($input)->ptr;
|
210
|
+
$2 = RSTRING($input)->len;
|
211
|
+
}
|
212
|
+
|
213
|
+
%typemap(in) (const void *utf16,int,void(*free)(void*)) {
|
214
|
+
$1 = (void*)RSTRING($input)->ptr;
|
215
|
+
$2 = RSTRING($input)->len;
|
216
|
+
$3 = SQLITE_TRANSIENT;
|
217
|
+
}
|
218
|
+
|
219
|
+
%typemap(out) sqlite_int64 {
|
220
|
+
$result = rb_ll2inum( $1 );
|
221
|
+
}
|
222
|
+
|
223
|
+
%typemap(out) const char * {
|
224
|
+
$result = $1 ? rb_str_new2($1) : Qnil;
|
225
|
+
}
|
226
|
+
|
227
|
+
%typemap(in) sqlite_int64 {
|
228
|
+
$1 = rb_big2ll( $input );
|
229
|
+
}
|
230
|
+
|
231
|
+
%typemap(in) (sqlite3_context*,int data_size) {
|
232
|
+
SWIG_ConvertPtr($input,(void**)&$1, SWIGTYPE_p_sqlite3_context, 1);
|
233
|
+
$2 = 4;
|
234
|
+
}
|
235
|
+
|
236
|
+
%typemap(out) VALUE* {
|
237
|
+
$result = *(VALUE*)$1;
|
238
|
+
}
|
239
|
+
|
240
|
+
%constant int Sqlite3_ruby_busy_handler(void*,int);
|
241
|
+
%constant int Sqlite3_ruby_authorizer(void*,int,const char*,const char*,const char*,const char*);
|
242
|
+
%constant void Sqlite3_ruby_trace(void*,const char*);
|
243
|
+
%constant void Sqlite3_ruby_function_step(sqlite3_context* ctx,int n,
|
244
|
+
sqlite3_value** args);
|
245
|
+
%constant void Sqlite3_ruby_function_final(sqlite3_context* ctx);
|
246
|
+
|
247
|
+
const char *sqlite3_libversion(void);
|
248
|
+
int sqlite3_close(sqlite3*);
|
249
|
+
|
250
|
+
sqlite_int64 sqlite3_last_insert_rowid(sqlite3*);
|
251
|
+
|
252
|
+
int sqlite3_changes(sqlite3*);
|
253
|
+
int sqlite3_total_changes(sqlite3*);
|
254
|
+
void sqlite3_interrupt(sqlite3*);
|
255
|
+
|
256
|
+
int sqlite3_complete(const char*);
|
257
|
+
int sqlite3_complete16(const void *str);
|
258
|
+
|
259
|
+
int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
|
260
|
+
int sqlite3_busy_timeout(sqlite3*,int);
|
261
|
+
int sqlite3_set_authorizer(sqlite3*, int(*)(void*,int,const char*,const char*,const char*,const char*), void*);
|
262
|
+
int sqlite3_trace(sqlite3*, void(*)(void*,const char*), void*);
|
263
|
+
|
264
|
+
int sqlite3_open(const char *filename, sqlite3 **);
|
265
|
+
int sqlite3_open16(const void *filename, sqlite3 **);
|
266
|
+
|
267
|
+
int sqlite3_errcode(sqlite3*);
|
268
|
+
const char *sqlite3_errmsg(sqlite3*);
|
269
|
+
const void *sqlite3_errmsg16(sqlite3*);
|
270
|
+
|
271
|
+
int sqlite3_prepare(sqlite3*,const char* sql,int,sqlite3_stmt**,const char**);
|
272
|
+
int sqlite3_prepare16(sqlite3*,const void* sql,int,sqlite3_stmt**,const void**);
|
273
|
+
|
274
|
+
int sqlite3_bind_blob(sqlite3_stmt*,int,const void *blob,int,void(*free)(void*));
|
275
|
+
int sqlite3_bind_double(sqlite3_stmt*,int,double);
|
276
|
+
int sqlite3_bind_int(sqlite3_stmt*,int,int);
|
277
|
+
int sqlite3_bind_int64(sqlite3_stmt*,int,sqlite_int64);
|
278
|
+
int sqlite3_bind_null(sqlite3_stmt*,int);
|
279
|
+
int sqlite3_bind_text(sqlite3_stmt*,int,const char*text,int,void(*free)(void*));
|
280
|
+
int sqlite3_bind_text16(sqlite3_stmt*,int,const void*utf16,int,void(*free)(void*));
|
281
|
+
|
282
|
+
int sqlite3_bind_parameter_count(sqlite3_stmt*);
|
283
|
+
const char *sqlite3_bind_parameter_name(sqlite3_stmt*,int);
|
284
|
+
int sqlite3_bind_parameter_index(sqlite3_stmt*,const char*);
|
285
|
+
|
286
|
+
int sqlite3_column_count(sqlite3_stmt*);
|
287
|
+
const char *sqlite3_column_name(sqlite3_stmt*,int);
|
288
|
+
const void *sqlite3_column_name16(sqlite3_stmt*,int);
|
289
|
+
const char *sqlite3_column_decltype(sqlite3_stmt*,int);
|
290
|
+
const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
|
291
|
+
|
292
|
+
int sqlite3_step(sqlite3_stmt*);
|
293
|
+
|
294
|
+
int sqlite3_data_count(sqlite3_stmt*);
|
295
|
+
|
296
|
+
const BLOB *sqlite3_column_blob(sqlite3_stmt*,int);
|
297
|
+
int sqlite3_column_bytes(sqlite3_stmt*,int);
|
298
|
+
int sqlite3_column_bytes16(sqlite3_stmt*,int);
|
299
|
+
double sqlite3_column_double(sqlite3_stmt*,int);
|
300
|
+
double sqlite3_column_int(sqlite3_stmt*,int);
|
301
|
+
sqlite_int64 sqlite3_column_int64(sqlite3_stmt*,int);
|
302
|
+
const char *sqlite3_column_text(sqlite3_stmt*,int);
|
303
|
+
const void *sqlite3_column_text16(sqlite3_stmt*,int);
|
304
|
+
int sqlite3_column_type(sqlite3_stmt*,int);
|
305
|
+
|
306
|
+
int sqlite3_finalize(sqlite3_stmt*);
|
307
|
+
int sqlite3_reset(sqlite3_stmt*);
|
308
|
+
|
309
|
+
int sqlite3_create_function(sqlite3*,const char*str,int,int,void*,void(*func)(sqlite3_context*,int,sqlite3_value**),void(*step)(sqlite3_context*,int,sqlite3_value**),void(*final)(sqlite3_context*));
|
310
|
+
|
311
|
+
int sqlite3_create_function16(sqlite3*,const void*str,int,int,void*,void(*func)(sqlite3_context*,int,sqlite3_value**),void(*step)(sqlite3_context*,int,sqlite3_value**),void(*final)(sqlite3_context*));
|
312
|
+
|
313
|
+
int sqlite3_aggregate_count(sqlite3_context*);
|
314
|
+
|
315
|
+
const VALBLOB *sqlite3_value_blob(sqlite3_value*);
|
316
|
+
int sqlite3_value_bytes(sqlite3_value*);
|
317
|
+
int sqlite3_value_bytes16(sqlite3_value*);
|
318
|
+
double sqlite3_value_double(sqlite3_value*);
|
319
|
+
int sqlite3_value_int(sqlite3_value*);
|
320
|
+
sqlite_int64 sqlite3_value_int64(sqlite3_value*);
|
321
|
+
const char *sqlite3_value_text(sqlite3_value*);
|
322
|
+
const void *sqlite3_value_text16(sqlite3_value*);
|
323
|
+
const void *sqlite3_value_text16le(sqlite3_value*);
|
324
|
+
const void *sqlite3_value_text16be(sqlite3_value*);
|
325
|
+
int sqlite3_value_type(sqlite3_value*);
|
326
|
+
|
327
|
+
void sqlite3_result_blob(sqlite3_context*,const void *blob,int,void(*free)(void*));
|
328
|
+
void sqlite3_result_double(sqlite3_context*,double);
|
329
|
+
void sqlite3_result_error(sqlite3_context*,const char *text,int);
|
330
|
+
void sqlite3_result_error16(sqlite3_context*,const void *blob,int);
|
331
|
+
void sqlite3_result_int(sqlite3_context*,int);
|
332
|
+
void sqlite3_result_int64(sqlite3_context*,sqlite_int64);
|
333
|
+
void sqlite3_result_text(sqlite3_context*,const char* text,int,void(*free)(void*));
|
334
|
+
void sqlite3_result_text16(sqlite3_context*,const void* utf16,int,void(*free)(void*));
|
335
|
+
void sqlite3_result_text16le(sqlite3_context*,const void* utf16,int,void(*free)(void*));
|
336
|
+
void sqlite3_result_text16be(sqlite3_context*,const void* utf16,int,void(*free)(void*));
|
337
|
+
void sqlite3_result_value(sqlite3_context*,sqlite3_value*);
|
338
|
+
|
339
|
+
VALUE *sqlite3_aggregate_context(sqlite3_context*,int data_size);
|
data/lib/sqlite3.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#--
|
2
|
+
# =============================================================================
|
3
|
+
# Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
|
4
|
+
# All rights reserved.
|
5
|
+
#
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
7
|
+
# modification, are permitted provided that the following conditions are met:
|
8
|
+
#
|
9
|
+
# * Redistributions of source code must retain the above copyright notice,
|
10
|
+
# this list of conditions and the following disclaimer.
|
11
|
+
#
|
12
|
+
# * Redistributions in binary form must reproduce the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer in the
|
14
|
+
# documentation and/or other materials provided with the distribution.
|
15
|
+
#
|
16
|
+
# * The names of its contributors may not be used to endorse or promote
|
17
|
+
# products derived from this software without specific prior written
|
18
|
+
# permission.
|
19
|
+
#
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
24
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
# =============================================================================
|
31
|
+
#++
|
32
|
+
|
33
|
+
require 'sqlite3/database'
|
@@ -0,0 +1,81 @@
|
|
1
|
+
#--
|
2
|
+
# =============================================================================
|
3
|
+
# Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
|
4
|
+
# All rights reserved.
|
5
|
+
#
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
7
|
+
# modification, are permitted provided that the following conditions are met:
|
8
|
+
#
|
9
|
+
# * Redistributions of source code must retain the above copyright notice,
|
10
|
+
# this list of conditions and the following disclaimer.
|
11
|
+
#
|
12
|
+
# * Redistributions in binary form must reproduce the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer in the
|
14
|
+
# documentation and/or other materials provided with the distribution.
|
15
|
+
#
|
16
|
+
# * The names of its contributors may not be used to endorse or promote
|
17
|
+
# products derived from this software without specific prior written
|
18
|
+
# permission.
|
19
|
+
#
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
24
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
# =============================================================================
|
31
|
+
#++
|
32
|
+
|
33
|
+
module SQLite3 ; module Constants
|
34
|
+
|
35
|
+
module TextRep
|
36
|
+
UTF8 = 1
|
37
|
+
UTF16LE = 2
|
38
|
+
UTF16BE = 3
|
39
|
+
UTF16 = 4
|
40
|
+
ANY = 5
|
41
|
+
end
|
42
|
+
|
43
|
+
module ColumnType
|
44
|
+
INTEGER = 1
|
45
|
+
FLOAT = 2
|
46
|
+
TEXT = 3
|
47
|
+
BLOB = 4
|
48
|
+
NULL = 5
|
49
|
+
end
|
50
|
+
|
51
|
+
module ErrorCode
|
52
|
+
OK = 0 # Successful result
|
53
|
+
ERROR = 1 # SQL error or missing database
|
54
|
+
INTERNAL = 2 # An internal logic error in SQLite
|
55
|
+
PERM = 3 # Access permission denied
|
56
|
+
ABORT = 4 # Callback routine requested an abort
|
57
|
+
BUSY = 5 # The database file is locked
|
58
|
+
LOCKED = 6 # A table in the database is locked
|
59
|
+
NOMEM = 7 # A malloc() failed
|
60
|
+
READONLY = 8 # Attempt to write a readonly database
|
61
|
+
INTERRUPT = 9 # Operation terminated by sqlite_interrupt()
|
62
|
+
IOERR = 10 # Some kind of disk I/O error occurred
|
63
|
+
CORRUPT = 11 # The database disk image is malformed
|
64
|
+
NOTFOUND = 12 # (Internal Only) Table or record not found
|
65
|
+
FULL = 13 # Insertion failed because database is full
|
66
|
+
CANTOPEN = 14 # Unable to open the database file
|
67
|
+
PROTOCOL = 15 # Database lock protocol error
|
68
|
+
EMPTY = 16 # (Internal Only) Database table is empty
|
69
|
+
SCHEMA = 17 # The database schema changed
|
70
|
+
TOOBIG = 18 # Too much data for one row of a table
|
71
|
+
CONSTRAINT = 19 # Abort due to contraint violation
|
72
|
+
MISMATCH = 20 # Data type mismatch
|
73
|
+
MISUSE = 21 # Library used incorrectly
|
74
|
+
NOLFS = 22 # Uses OS features not supported on host
|
75
|
+
AUTH = 23 # Authorization denied
|
76
|
+
|
77
|
+
ROW = 100 # sqlite_step() has another row ready
|
78
|
+
DONE = 101 # sqlite_step() has finished executing
|
79
|
+
end
|
80
|
+
|
81
|
+
end ; end
|