sqlite3-ruby 1.2.3-x86-mingw32
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.
Potentially problematic release.
This version of sqlite3-ruby might be problematic. Click here for more details.
- data/README.rdoc +51 -0
- data/doc/faq/faq.html +408 -0
- data/doc/faq/faq.rb +145 -0
- data/doc/faq/faq.yml +426 -0
- data/ext/sqlite3_api/MANIFEST +4 -0
- data/ext/sqlite3_api/Makefile +142 -0
- data/ext/sqlite3_api/extconf.rb +16 -0
- data/ext/sqlite3_api/mkmf.log +66 -0
- data/ext/sqlite3_api/sqlite3_api.i +358 -0
- data/ext/sqlite3_api/sqlite3_api.so +0 -0
- data/ext/sqlite3_api/sqlite3_api_wrap.c +3094 -0
- data/ext/sqlite3_api/sqlite3_api_wrap.o +0 -0
- data/ext/sqlite3_api/win32/build.bat +7 -0
- data/lib/sqlite3.rb +1 -0
- data/lib/sqlite3/constants.rb +49 -0
- data/lib/sqlite3/database.rb +715 -0
- data/lib/sqlite3/driver/dl/api.rb +152 -0
- data/lib/sqlite3/driver/dl/driver.rb +307 -0
- data/lib/sqlite3/driver/native/driver.rb +211 -0
- data/lib/sqlite3/errors.rb +68 -0
- data/lib/sqlite3/pragmas.rb +271 -0
- data/lib/sqlite3/resultset.rb +176 -0
- data/lib/sqlite3/statement.rb +230 -0
- data/lib/sqlite3/translator.rb +109 -0
- data/lib/sqlite3/value.rb +57 -0
- data/lib/sqlite3/version.rb +14 -0
- data/test/bm.rb +140 -0
- data/test/driver/dl/tc_driver.rb +292 -0
- data/test/mocks.rb +45 -0
- data/test/native-vs-dl.rb +126 -0
- data/test/tc_database.rb +198 -0
- data/test/tc_errors.rb +21 -0
- data/test/tc_integration.rb +1044 -0
- data/test/tests.rb +6 -0
- metadata +96 -0
@@ -0,0 +1,142 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
#### Start of system configuration section. ####
|
5
|
+
|
6
|
+
srcdir = .
|
7
|
+
topdir = c:/ruby18/lib/ruby/1.8/i386-mingw32
|
8
|
+
hdrdir = $(topdir)
|
9
|
+
VPATH = $(srcdir);$(topdir);$(hdrdir)
|
10
|
+
|
11
|
+
DESTDIR = c:
|
12
|
+
prefix = $(DESTDIR)/ruby18
|
13
|
+
exec_prefix = $(prefix)
|
14
|
+
sitedir = $(prefix)/lib/ruby/site_ruby
|
15
|
+
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
16
|
+
archdir = $(rubylibdir)/$(arch)
|
17
|
+
sbindir = $(exec_prefix)/sbin
|
18
|
+
datadir = $(prefix)/share
|
19
|
+
includedir = $(prefix)/include
|
20
|
+
infodir = $(prefix)/info
|
21
|
+
sysconfdir = $(prefix)/etc
|
22
|
+
mandir = $(prefix)/man
|
23
|
+
libdir = $(exec_prefix)/lib
|
24
|
+
sharedstatedir = $(prefix)/com
|
25
|
+
oldincludedir = $(DESTDIR)/usr/include
|
26
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
27
|
+
bindir = $(exec_prefix)/bin
|
28
|
+
localstatedir = $(prefix)/var
|
29
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
30
|
+
libexecdir = $(exec_prefix)/libexec
|
31
|
+
|
32
|
+
CC = gcc
|
33
|
+
LIBRUBY = lib$(LIBRUBY_SO).a
|
34
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
35
|
+
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
36
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
37
|
+
|
38
|
+
RUBY_EXTCONF_H =
|
39
|
+
CFLAGS = -g -O2
|
40
|
+
INCFLAGS = -I. -I. -Ic:/ruby18/lib/ruby/1.8/i386-mingw32 -I.
|
41
|
+
DEFS =
|
42
|
+
CPPFLAGS = -DHAVE_SQLITE3_H -Ic:/src/include
|
43
|
+
CXXFLAGS = $(CFLAGS)
|
44
|
+
DLDFLAGS = -L. -Wl,--enable-auto-image-base,--enable-auto-import,--export-all
|
45
|
+
LDSHARED = gcc -shared -s
|
46
|
+
AR = ar
|
47
|
+
EXEEXT = .exe
|
48
|
+
|
49
|
+
RUBY_INSTALL_NAME = ruby
|
50
|
+
RUBY_SO_NAME = msvcrt-ruby18
|
51
|
+
arch = i386-mingw32
|
52
|
+
sitearch = i386-msvcrt
|
53
|
+
ruby_version = 1.8
|
54
|
+
ruby = c:/ruby18/bin/ruby
|
55
|
+
RUBY = $(ruby)
|
56
|
+
RM = rm -f
|
57
|
+
MAKEDIRS = mkdir -p
|
58
|
+
INSTALL = /bin/install -c
|
59
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
60
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
61
|
+
COPY = cp
|
62
|
+
|
63
|
+
#### End of system configuration section. ####
|
64
|
+
|
65
|
+
preload =
|
66
|
+
|
67
|
+
libpath = . $(libdir) c:/src/lib
|
68
|
+
LIBPATH = -L. -L$(libdir) -Lc:/src/lib
|
69
|
+
DEFFILE =
|
70
|
+
|
71
|
+
CLEANFILES = mkmf.log
|
72
|
+
DISTCLEANFILES =
|
73
|
+
|
74
|
+
extout =
|
75
|
+
extout_prefix =
|
76
|
+
target_prefix =
|
77
|
+
LOCAL_LIBS =
|
78
|
+
LIBS = $(LIBRUBYARG_SHARED) -lsqlite3 -lshell32 -lws2_32
|
79
|
+
SRCS = sqlite3_api_wrap.c
|
80
|
+
OBJS = sqlite3_api_wrap.o
|
81
|
+
TARGET = sqlite3_api
|
82
|
+
DLLIB = $(TARGET).so
|
83
|
+
EXTSTATIC =
|
84
|
+
STATIC_LIB =
|
85
|
+
|
86
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
87
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
88
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
89
|
+
|
90
|
+
TARGET_SO = $(DLLIB)
|
91
|
+
CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
|
92
|
+
CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
|
93
|
+
|
94
|
+
all: $(DLLIB)
|
95
|
+
static: $(STATIC_LIB)
|
96
|
+
|
97
|
+
clean:
|
98
|
+
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
99
|
+
|
100
|
+
distclean: clean
|
101
|
+
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
102
|
+
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
103
|
+
|
104
|
+
realclean: distclean
|
105
|
+
install: install-so install-rb
|
106
|
+
|
107
|
+
install-so: $(RUBYARCHDIR)
|
108
|
+
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
109
|
+
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
110
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
111
|
+
install-rb: pre-install-rb install-rb-default
|
112
|
+
install-rb-default: pre-install-rb-default
|
113
|
+
pre-install-rb: Makefile
|
114
|
+
pre-install-rb-default: Makefile
|
115
|
+
$(RUBYARCHDIR):
|
116
|
+
$(MAKEDIRS) $@
|
117
|
+
|
118
|
+
site-install: site-install-so site-install-rb
|
119
|
+
site-install-so: install-so
|
120
|
+
site-install-rb: install-rb
|
121
|
+
|
122
|
+
.SUFFIXES: .c .m .cc .cxx .cpp .o
|
123
|
+
|
124
|
+
.cc.o:
|
125
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
126
|
+
|
127
|
+
.cxx.o:
|
128
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
129
|
+
|
130
|
+
.cpp.o:
|
131
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
132
|
+
|
133
|
+
.c.o:
|
134
|
+
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
|
135
|
+
|
136
|
+
$(DLLIB): $(OBJS)
|
137
|
+
@-$(RM) $@
|
138
|
+
$(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
$(OBJS): ruby.h defines.h
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'mkmf'
|
2
|
+
|
3
|
+
SWIG_WRAP = "sqlite3_api_wrap.c"
|
4
|
+
|
5
|
+
dir_config( "sqlite3", "/usr/local" )
|
6
|
+
|
7
|
+
have_library( "rt", "fdatasync" )
|
8
|
+
|
9
|
+
if have_header( "sqlite3.h" ) && have_library( "sqlite3", "sqlite3_open" )
|
10
|
+
if !File.exists?( SWIG_WRAP ) || with_config( "swig", false )
|
11
|
+
puts "creating #{SWIG_WRAP}"
|
12
|
+
system "swig -ruby sqlite3_api.i" or raise "could not build wrapper via swig (perhaps swig is not installed?)"
|
13
|
+
end
|
14
|
+
|
15
|
+
create_makefile( "sqlite3_api" )
|
16
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
have_library: checking for fdatasync() in -lrt... -------------------- no
|
2
|
+
|
3
|
+
"gcc -o conftest -I. -Ic:/ruby18/lib/ruby/1.8/i386-mingw32 -I. -Ic:/src/include -g -O2 conftest.c -L. -Lc:/ruby18/lib -Lc:/src/lib -L. -lmsvcrt-ruby18-static -lrt -lshell32 -lws2_32 "
|
4
|
+
conftest.c: In function `t':
|
5
|
+
conftest.c:6: error: `fdatasync' undeclared (first use in this function)
|
6
|
+
conftest.c:6: error: (Each undeclared identifier is reported only once
|
7
|
+
conftest.c:6: error: for each function it appears in.)
|
8
|
+
checked program was:
|
9
|
+
/* begin */
|
10
|
+
1: #include <windows.h>
|
11
|
+
2: #include <winsock.h>
|
12
|
+
3:
|
13
|
+
4: /*top*/
|
14
|
+
5: int main() { return 0; }
|
15
|
+
6: int t() { void ((*volatile p)()); p = (void ((*)()))fdatasync; return 0; }
|
16
|
+
/* end */
|
17
|
+
|
18
|
+
"gcc -o conftest -I. -Ic:/ruby18/lib/ruby/1.8/i386-mingw32 -I. -Ic:/src/include -g -O2 conftest.c -L. -Lc:/ruby18/lib -Lc:/src/lib -L. -lmsvcrt-ruby18-static -lrt -lshell32 -lws2_32 "
|
19
|
+
C:\Ruby18\devkit\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lrt
|
20
|
+
collect2: ld returned 1 exit status
|
21
|
+
checked program was:
|
22
|
+
/* begin */
|
23
|
+
1: /*top*/
|
24
|
+
2: int main() { return 0; }
|
25
|
+
3: int t() { fdatasync(); return 0; }
|
26
|
+
/* end */
|
27
|
+
|
28
|
+
--------------------
|
29
|
+
|
30
|
+
have_header: checking for sqlite3.h... -------------------- yes
|
31
|
+
|
32
|
+
"gcc -E -I. -Ic:/ruby18/lib/ruby/1.8/i386-mingw32 -I. -Ic:/src/include -g -O2 conftest.c -o conftest.i"
|
33
|
+
checked program was:
|
34
|
+
/* begin */
|
35
|
+
1: #include <sqlite3.h>
|
36
|
+
/* end */
|
37
|
+
|
38
|
+
--------------------
|
39
|
+
|
40
|
+
have_library: checking for sqlite3_open() in -lsqlite3... -------------------- yes
|
41
|
+
|
42
|
+
"gcc -o conftest -I. -Ic:/ruby18/lib/ruby/1.8/i386-mingw32 -I. -Ic:/src/include -g -O2 conftest.c -L. -Lc:/ruby18/lib -Lc:/src/lib -L. -lmsvcrt-ruby18-static -lsqlite3 -lshell32 -lws2_32 "
|
43
|
+
conftest.c: In function `t':
|
44
|
+
conftest.c:6: error: `sqlite3_open' undeclared (first use in this function)
|
45
|
+
conftest.c:6: error: (Each undeclared identifier is reported only once
|
46
|
+
conftest.c:6: error: for each function it appears in.)
|
47
|
+
checked program was:
|
48
|
+
/* begin */
|
49
|
+
1: #include <windows.h>
|
50
|
+
2: #include <winsock.h>
|
51
|
+
3:
|
52
|
+
4: /*top*/
|
53
|
+
5: int main() { return 0; }
|
54
|
+
6: int t() { void ((*volatile p)()); p = (void ((*)()))sqlite3_open; return 0; }
|
55
|
+
/* end */
|
56
|
+
|
57
|
+
"gcc -o conftest -I. -Ic:/ruby18/lib/ruby/1.8/i386-mingw32 -I. -Ic:/src/include -g -O2 conftest.c -L. -Lc:/ruby18/lib -Lc:/src/lib -L. -lmsvcrt-ruby18-static -lsqlite3 -lshell32 -lws2_32 "
|
58
|
+
checked program was:
|
59
|
+
/* begin */
|
60
|
+
1: /*top*/
|
61
|
+
2: int main() { return 0; }
|
62
|
+
3: int t() { sqlite3_open(); return 0; }
|
63
|
+
/* end */
|
64
|
+
|
65
|
+
--------------------
|
66
|
+
|
@@ -0,0 +1,358 @@
|
|
1
|
+
%module "SQLite3::driver::native::API"
|
2
|
+
%include "typemaps.i"
|
3
|
+
%{
|
4
|
+
#include <sqlite3.h>
|
5
|
+
#include "ruby.h"
|
6
|
+
|
7
|
+
#ifndef RSTRING_PTR
|
8
|
+
#define RSTRING_PTR(s) (RSTRING(s)->ptr)
|
9
|
+
#endif
|
10
|
+
|
11
|
+
#ifndef RSTRING_LEN
|
12
|
+
#define RSTRING_LEN(s) (RSTRING(s)->len)
|
13
|
+
#endif
|
14
|
+
|
15
|
+
#define Init_API Init_sqlite3_api
|
16
|
+
|
17
|
+
struct CallbackData {
|
18
|
+
VALUE proc;
|
19
|
+
VALUE proc2;
|
20
|
+
VALUE data;
|
21
|
+
};
|
22
|
+
|
23
|
+
typedef struct CallbackData CallbackData;
|
24
|
+
typedef void RUBY_BLOB;
|
25
|
+
typedef void RUBY_VALBLOB;
|
26
|
+
|
27
|
+
int Sqlite3_ruby_busy_handler(void* data,int value) {
|
28
|
+
VALUE result;
|
29
|
+
CallbackData *cb = (CallbackData*)data;
|
30
|
+
result = rb_funcall(
|
31
|
+
cb->proc, rb_intern("call"), 2, cb->data, INT2FIX(value) );
|
32
|
+
return FIX2INT(result);
|
33
|
+
}
|
34
|
+
|
35
|
+
static void mark_CallbackData(void* ptr) {
|
36
|
+
CallbackData* cb = (CallbackData*)ptr;
|
37
|
+
if (cb->proc != Qnil)
|
38
|
+
rb_gc_mark(cb->proc);
|
39
|
+
if (cb->proc2 != Qnil)
|
40
|
+
rb_gc_mark(cb->proc2);
|
41
|
+
if (cb->data != Qnil)
|
42
|
+
rb_gc_mark(cb->data);
|
43
|
+
}
|
44
|
+
|
45
|
+
int Sqlite3_ruby_authorizer(void* data,int type,
|
46
|
+
const char* a,const char* b,const char* c,const char* d)
|
47
|
+
{
|
48
|
+
VALUE result;
|
49
|
+
CallbackData *cb = (CallbackData*)data;
|
50
|
+
result = rb_funcall(
|
51
|
+
cb->proc, rb_intern("call"), 6, cb->data, INT2FIX(type),
|
52
|
+
( a ? rb_str_new2(a) : Qnil ), ( b ? rb_str_new2(b) : Qnil ),
|
53
|
+
( c ? rb_str_new2(c) : Qnil ), ( d ? rb_str_new2(d) : Qnil ) );
|
54
|
+
return FIX2INT(result);
|
55
|
+
}
|
56
|
+
|
57
|
+
void Sqlite3_ruby_trace(void* data, const char *sql) {
|
58
|
+
CallbackData *cb = (CallbackData*)data;
|
59
|
+
rb_funcall( cb->proc, rb_intern("call"), 2, cb->data,
|
60
|
+
sql ? rb_str_new2(sql) : Qnil );
|
61
|
+
}
|
62
|
+
|
63
|
+
void Sqlite3_ruby_function_step(sqlite3_context* ctx,int n,
|
64
|
+
sqlite3_value** args)
|
65
|
+
{
|
66
|
+
CallbackData *data;
|
67
|
+
VALUE rb_args;
|
68
|
+
VALUE *rb_context;
|
69
|
+
int idx;
|
70
|
+
|
71
|
+
data = (CallbackData*)sqlite3_user_data(ctx);
|
72
|
+
|
73
|
+
if( data->proc2 != Qnil ) {
|
74
|
+
rb_context = (VALUE*)sqlite3_aggregate_context(ctx,sizeof(VALUE));
|
75
|
+
if( *rb_context == 0 ) {
|
76
|
+
*rb_context = rb_hash_new();
|
77
|
+
rb_gc_register_address( rb_context );
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
rb_args = rb_ary_new2(n+1);
|
82
|
+
rb_ary_push( rb_args, SWIG_NewPointerObj(ctx,SWIGTYPE_p_sqlite3_context,0) );
|
83
|
+
for( idx = 0; idx < n; idx++ ) {
|
84
|
+
rb_ary_push( rb_args, SWIG_NewPointerObj(args[idx],
|
85
|
+
SWIGTYPE_p_sqlite3_value,0) );
|
86
|
+
}
|
87
|
+
|
88
|
+
rb_apply( data->proc, rb_intern("call"), rb_args );
|
89
|
+
}
|
90
|
+
|
91
|
+
void Sqlite3_ruby_function_final(sqlite3_context *ctx) {
|
92
|
+
VALUE *rb_context;
|
93
|
+
CallbackData *data;
|
94
|
+
|
95
|
+
rb_context = (VALUE*)sqlite3_aggregate_context(ctx,sizeof(VALUE));
|
96
|
+
if( *rb_context == 0 ) {
|
97
|
+
*rb_context = rb_hash_new();
|
98
|
+
rb_gc_register_address( rb_context );
|
99
|
+
}
|
100
|
+
|
101
|
+
data = (CallbackData*)sqlite3_user_data(ctx);
|
102
|
+
|
103
|
+
rb_funcall( data->proc2, rb_intern("call"), 1,
|
104
|
+
SWIG_NewPointerObj(ctx,SWIGTYPE_p_sqlite3_context,0) );
|
105
|
+
|
106
|
+
rb_gc_unregister_address( rb_context );
|
107
|
+
}
|
108
|
+
%}
|
109
|
+
|
110
|
+
%markfunc CallbackData "mark_CallbackData";
|
111
|
+
|
112
|
+
struct CallbackData {
|
113
|
+
VALUE proc;
|
114
|
+
VALUE proc2;
|
115
|
+
VALUE data;
|
116
|
+
};
|
117
|
+
|
118
|
+
%typemap(in) const void *str {
|
119
|
+
$1 = (void*)RSTRING_PTR($input);
|
120
|
+
}
|
121
|
+
|
122
|
+
%typemap(in) (const char *filename, sqlite3**) {
|
123
|
+
$1 = STR2CSTR($input);
|
124
|
+
$2 = (sqlite3**)malloc( sizeof( sqlite3* ) );
|
125
|
+
}
|
126
|
+
|
127
|
+
%typemap(argout) (const char *filename, sqlite3**) {
|
128
|
+
VALUE ary;
|
129
|
+
ary = rb_ary_new2(2);
|
130
|
+
rb_ary_push( ary, $result );
|
131
|
+
rb_ary_push( ary, SWIG_NewPointerObj( *$2, SWIGTYPE_p_sqlite3, 0 ) );
|
132
|
+
free( $2 );
|
133
|
+
$result = ary;
|
134
|
+
}
|
135
|
+
|
136
|
+
%typemap(in) (const void *filename, sqlite3**) {
|
137
|
+
$1 = (void*)RSTRING_PTR($input);
|
138
|
+
$2 = (sqlite3**)malloc( sizeof( sqlite3* ) );
|
139
|
+
}
|
140
|
+
|
141
|
+
%typemap(argout) (const void *filename, sqlite3**) {
|
142
|
+
VALUE ary;
|
143
|
+
ary = rb_ary_new2(2);
|
144
|
+
rb_ary_push( ary, $result );
|
145
|
+
rb_ary_push( ary, SWIG_NewPointerObj( *$2, SWIGTYPE_p_sqlite3, 0 ) );
|
146
|
+
free( $2 );
|
147
|
+
$result = ary;
|
148
|
+
}
|
149
|
+
|
150
|
+
typedef void RUBY_BLOB;
|
151
|
+
%typemap(out) const RUBY_BLOB * {
|
152
|
+
$result = $1 ?
|
153
|
+
rb_str_new( (char*)$1, sqlite3_column_bytes( arg1, arg2 ) ) : Qnil;
|
154
|
+
}
|
155
|
+
|
156
|
+
typedef void RUBY_VALBLOB;
|
157
|
+
%typemap(out) const RUBY_VALBLOB * {
|
158
|
+
$result = $1 ? rb_str_new( (char*)$1, sqlite3_value_bytes( arg1 ) ) : Qnil;
|
159
|
+
}
|
160
|
+
|
161
|
+
%typemap(out) const void * {
|
162
|
+
int i;
|
163
|
+
if( $1 ) {
|
164
|
+
for( i = 0; ((char*)$1)[i]; i += 2 );
|
165
|
+
$result = rb_str_new( (char*)$1, i );
|
166
|
+
} else $result = Qnil;
|
167
|
+
}
|
168
|
+
|
169
|
+
%typemap(in) (const char * sql,int,sqlite3_stmt**,const char**) (sqlite3_stmt *stmt, char *errmsg) {
|
170
|
+
$1 = RSTRING_PTR($input);
|
171
|
+
$2 = RSTRING_LEN($input);
|
172
|
+
$3 = &stmt2;
|
173
|
+
$4 = &errmsg2;
|
174
|
+
}
|
175
|
+
|
176
|
+
%typemap(argout) (const char* sql,int,sqlite3_stmt**,const char**) {
|
177
|
+
VALUE ary;
|
178
|
+
ary = rb_ary_new2(3);
|
179
|
+
rb_ary_push( ary, $result );
|
180
|
+
rb_ary_push( ary, SWIG_NewPointerObj( stmt2, SWIGTYPE_p_sqlite3_stmt, 0 ) );
|
181
|
+
rb_ary_push( ary, errmsg2 ? rb_str_new2( errmsg2 ) : Qnil );
|
182
|
+
$result = ary;
|
183
|
+
}
|
184
|
+
|
185
|
+
%typemap(in) (const void* sql,int,sqlite3_stmt**,const void**) (sqlite3_stmt *stmt, void *errmsg) {
|
186
|
+
$1 = RSTRING_PTR($input);
|
187
|
+
$2 = RSTRING_LEN($input);
|
188
|
+
$3 = &stmt2;
|
189
|
+
$4 = &errmsg2;
|
190
|
+
}
|
191
|
+
|
192
|
+
%typemap(argout) (const void* sql,int,sqlite3_stmt**,const void**) {
|
193
|
+
VALUE ary;
|
194
|
+
int i;
|
195
|
+
|
196
|
+
for( i = 0; ((char*)errmsg2)[i]; i += 2 );
|
197
|
+
|
198
|
+
ary = rb_ary_new2(3);
|
199
|
+
rb_ary_push( ary, $result );
|
200
|
+
rb_ary_push( ary, SWIG_NewPointerObj( stmt2, SWIGTYPE_p_sqlite3_stmt, 0 ) );
|
201
|
+
rb_ary_push( ary, errmsg2 ? rb_str_new( (char*)errmsg2, i ) : Qnil );
|
202
|
+
$result = ary;
|
203
|
+
}
|
204
|
+
|
205
|
+
%typemap(in) (const void *blob,int) {
|
206
|
+
$1 = (void*)RSTRING_PTR($input);
|
207
|
+
$2 = RSTRING_LEN($input);
|
208
|
+
}
|
209
|
+
|
210
|
+
%typemap(in) (const void *blob,int,void(*free)(void*)) {
|
211
|
+
$1 = (void*)RSTRING_PTR($input);
|
212
|
+
$2 = RSTRING_LEN($input);
|
213
|
+
$3 = SQLITE_TRANSIENT;
|
214
|
+
}
|
215
|
+
|
216
|
+
%typemap(in) (const char *text,int) {
|
217
|
+
$1 = RSTRING_PTR($input);
|
218
|
+
$2 = RSTRING_LEN($input);
|
219
|
+
}
|
220
|
+
|
221
|
+
%typemap(in) (const char *text,int,void(*free)(void*)) {
|
222
|
+
$1 = RSTRING_PTR($input);
|
223
|
+
$2 = RSTRING_LEN($input);
|
224
|
+
$3 = SQLITE_TRANSIENT;
|
225
|
+
}
|
226
|
+
|
227
|
+
%typemap(in) (const void *utf16,int) {
|
228
|
+
$1 = (void*)RSTRING_PTR($input);
|
229
|
+
$2 = RSTRING_LEN($input);
|
230
|
+
}
|
231
|
+
|
232
|
+
%typemap(in) (const void *utf16,int,void(*free)(void*)) {
|
233
|
+
$1 = (void*)RSTRING_PTR($input);
|
234
|
+
$2 = RSTRING_LEN($input);
|
235
|
+
$3 = SQLITE_TRANSIENT;
|
236
|
+
}
|
237
|
+
|
238
|
+
%typemap(out) sqlite_int64 {
|
239
|
+
$result = rb_ll2inum( $1 );
|
240
|
+
}
|
241
|
+
|
242
|
+
%typemap(out) const char * {
|
243
|
+
$result = $1 ? rb_str_new2($1) : Qnil;
|
244
|
+
}
|
245
|
+
|
246
|
+
%typemap(in) sqlite_int64 {
|
247
|
+
$1 = rb_num2ll( $input );
|
248
|
+
}
|
249
|
+
|
250
|
+
%typemap(in) (sqlite3_context*,int data_size) {
|
251
|
+
SWIG_ConvertPtr($input,(void**)&$1, SWIGTYPE_p_sqlite3_context, 1);
|
252
|
+
$2 = 4;
|
253
|
+
}
|
254
|
+
|
255
|
+
%typemap(out) VALUE* {
|
256
|
+
$result = *(VALUE*)$1;
|
257
|
+
}
|
258
|
+
|
259
|
+
%constant int Sqlite3_ruby_busy_handler(void*,int);
|
260
|
+
%constant int Sqlite3_ruby_authorizer(void*,int,const char*,const char*,const char*,const char*);
|
261
|
+
%constant void Sqlite3_ruby_trace(void*,const char*);
|
262
|
+
%constant void Sqlite3_ruby_function_step(sqlite3_context* ctx,int n,
|
263
|
+
sqlite3_value** args);
|
264
|
+
%constant void Sqlite3_ruby_function_final(sqlite3_context* ctx);
|
265
|
+
|
266
|
+
const char *sqlite3_libversion(void);
|
267
|
+
int sqlite3_close(sqlite3*);
|
268
|
+
|
269
|
+
sqlite_int64 sqlite3_last_insert_rowid(sqlite3*);
|
270
|
+
|
271
|
+
int sqlite3_changes(sqlite3*);
|
272
|
+
int sqlite3_total_changes(sqlite3*);
|
273
|
+
void sqlite3_interrupt(sqlite3*);
|
274
|
+
|
275
|
+
int sqlite3_complete(const char*);
|
276
|
+
int sqlite3_complete16(const void *str);
|
277
|
+
|
278
|
+
int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
|
279
|
+
int sqlite3_busy_timeout(sqlite3*,int);
|
280
|
+
int sqlite3_set_authorizer(sqlite3*, int(*)(void*,int,const char*,const char*,const char*,const char*), void*);
|
281
|
+
int sqlite3_trace(sqlite3*, void(*)(void*,const char*), void*);
|
282
|
+
|
283
|
+
int sqlite3_open(const char *filename, sqlite3 **);
|
284
|
+
int sqlite3_open16(const void *filename, sqlite3 **);
|
285
|
+
|
286
|
+
int sqlite3_errcode(sqlite3*);
|
287
|
+
const char *sqlite3_errmsg(sqlite3*);
|
288
|
+
const void *sqlite3_errmsg16(sqlite3*);
|
289
|
+
|
290
|
+
int sqlite3_prepare(sqlite3*,const char* sql,int,sqlite3_stmt**,const char**);
|
291
|
+
int sqlite3_prepare16(sqlite3*,const void* sql,int,sqlite3_stmt**,const void**);
|
292
|
+
|
293
|
+
int sqlite3_bind_blob(sqlite3_stmt*,int,const void *blob,int,void(*free)(void*));
|
294
|
+
int sqlite3_bind_double(sqlite3_stmt*,int,double);
|
295
|
+
int sqlite3_bind_int(sqlite3_stmt*,int,int);
|
296
|
+
int sqlite3_bind_int64(sqlite3_stmt*,int,sqlite_int64);
|
297
|
+
int sqlite3_bind_null(sqlite3_stmt*,int);
|
298
|
+
int sqlite3_bind_text(sqlite3_stmt*,int,const char*text,int,void(*free)(void*));
|
299
|
+
int sqlite3_bind_text16(sqlite3_stmt*,int,const void*utf16,int,void(*free)(void*));
|
300
|
+
|
301
|
+
int sqlite3_bind_parameter_count(sqlite3_stmt*);
|
302
|
+
const char *sqlite3_bind_parameter_name(sqlite3_stmt*,int);
|
303
|
+
int sqlite3_bind_parameter_index(sqlite3_stmt*,const char*);
|
304
|
+
|
305
|
+
int sqlite3_column_count(sqlite3_stmt*);
|
306
|
+
const char *sqlite3_column_name(sqlite3_stmt*,int);
|
307
|
+
const void *sqlite3_column_name16(sqlite3_stmt*,int);
|
308
|
+
const char *sqlite3_column_decltype(sqlite3_stmt*,int);
|
309
|
+
const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
|
310
|
+
|
311
|
+
int sqlite3_step(sqlite3_stmt*);
|
312
|
+
|
313
|
+
int sqlite3_data_count(sqlite3_stmt*);
|
314
|
+
|
315
|
+
const RUBY_BLOB *sqlite3_column_blob(sqlite3_stmt*,int);
|
316
|
+
int sqlite3_column_bytes(sqlite3_stmt*,int);
|
317
|
+
int sqlite3_column_bytes16(sqlite3_stmt*,int);
|
318
|
+
double sqlite3_column_double(sqlite3_stmt*,int);
|
319
|
+
double sqlite3_column_int(sqlite3_stmt*,int);
|
320
|
+
sqlite_int64 sqlite3_column_int64(sqlite3_stmt*,int);
|
321
|
+
const char *sqlite3_column_text(sqlite3_stmt*,int);
|
322
|
+
const void *sqlite3_column_text16(sqlite3_stmt*,int);
|
323
|
+
int sqlite3_column_type(sqlite3_stmt*,int);
|
324
|
+
|
325
|
+
int sqlite3_finalize(sqlite3_stmt*);
|
326
|
+
int sqlite3_reset(sqlite3_stmt*);
|
327
|
+
|
328
|
+
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*));
|
329
|
+
|
330
|
+
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*));
|
331
|
+
|
332
|
+
int sqlite3_aggregate_count(sqlite3_context*);
|
333
|
+
|
334
|
+
const RUBY_VALBLOB *sqlite3_value_blob(sqlite3_value*);
|
335
|
+
int sqlite3_value_bytes(sqlite3_value*);
|
336
|
+
int sqlite3_value_bytes16(sqlite3_value*);
|
337
|
+
double sqlite3_value_double(sqlite3_value*);
|
338
|
+
int sqlite3_value_int(sqlite3_value*);
|
339
|
+
sqlite_int64 sqlite3_value_int64(sqlite3_value*);
|
340
|
+
const char *sqlite3_value_text(sqlite3_value*);
|
341
|
+
const void *sqlite3_value_text16(sqlite3_value*);
|
342
|
+
const void *sqlite3_value_text16le(sqlite3_value*);
|
343
|
+
const void *sqlite3_value_text16be(sqlite3_value*);
|
344
|
+
int sqlite3_value_type(sqlite3_value*);
|
345
|
+
|
346
|
+
void sqlite3_result_blob(sqlite3_context*,const void *blob,int,void(*free)(void*));
|
347
|
+
void sqlite3_result_double(sqlite3_context*,double);
|
348
|
+
void sqlite3_result_error(sqlite3_context*,const char *text,int);
|
349
|
+
void sqlite3_result_error16(sqlite3_context*,const void *blob,int);
|
350
|
+
void sqlite3_result_int(sqlite3_context*,int);
|
351
|
+
void sqlite3_result_int64(sqlite3_context*,sqlite_int64);
|
352
|
+
void sqlite3_result_text(sqlite3_context*,const char* text,int,void(*free)(void*));
|
353
|
+
void sqlite3_result_text16(sqlite3_context*,const void* utf16,int,void(*free)(void*));
|
354
|
+
void sqlite3_result_text16le(sqlite3_context*,const void* utf16,int,void(*free)(void*));
|
355
|
+
void sqlite3_result_text16be(sqlite3_context*,const void* utf16,int,void(*free)(void*));
|
356
|
+
void sqlite3_result_value(sqlite3_context*,sqlite3_value*);
|
357
|
+
|
358
|
+
VALUE *sqlite3_aggregate_context(sqlite3_context*,int data_size);
|