sqlite3-ruby 1.2.5-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/ChangeLog.cvs +88 -0
  2. data/History.txt +68 -0
  3. data/LICENSE +27 -0
  4. data/Manifest.txt +41 -0
  5. data/README.txt +56 -0
  6. data/Rakefile +5 -0
  7. data/ext/sqlite3_api/extconf.rb +10 -0
  8. data/ext/sqlite3_api/sqlite3_api.i +362 -0
  9. data/ext/sqlite3_api/sqlite3_api_wrap.c +5018 -0
  10. data/faq/faq.rb +145 -0
  11. data/faq/faq.yml +426 -0
  12. data/lib/1.8/sqlite3_api.so +0 -0
  13. data/lib/1.9/sqlite3_api.so +0 -0
  14. data/lib/sqlite3.rb +1 -0
  15. data/lib/sqlite3/constants.rb +49 -0
  16. data/lib/sqlite3/database.rb +721 -0
  17. data/lib/sqlite3/driver/dl/api.rb +152 -0
  18. data/lib/sqlite3/driver/dl/driver.rb +307 -0
  19. data/lib/sqlite3/driver/native/driver.rb +219 -0
  20. data/lib/sqlite3/errors.rb +68 -0
  21. data/lib/sqlite3/pragmas.rb +271 -0
  22. data/lib/sqlite3/resultset.rb +180 -0
  23. data/lib/sqlite3/statement.rb +231 -0
  24. data/lib/sqlite3/translator.rb +109 -0
  25. data/lib/sqlite3/value.rb +57 -0
  26. data/lib/sqlite3/version.rb +16 -0
  27. data/setup.rb +1333 -0
  28. data/tasks/benchmark.rake +9 -0
  29. data/tasks/faq.rake +9 -0
  30. data/tasks/gem.rake +32 -0
  31. data/tasks/native.rake +35 -0
  32. data/tasks/vendor_sqlite3.rake +104 -0
  33. data/test/bm.rb +140 -0
  34. data/test/driver/dl/tc_driver.rb +292 -0
  35. data/test/helper.rb +67 -0
  36. data/test/native-vs-dl.rb +126 -0
  37. data/test/test_database.rb +217 -0
  38. data/test/test_errors.rb +17 -0
  39. data/test/test_integration.rb +542 -0
  40. data/test/test_integration_open_close.rb +30 -0
  41. data/test/test_integration_pending.rb +111 -0
  42. data/test/test_integration_resultset.rb +159 -0
  43. data/test/test_integration_statement.rb +195 -0
  44. metadata +143 -0
@@ -0,0 +1,88 @@
1
+ 2005-01-05 09:40 minam
2
+
3
+ * Rakefile, sqlite3-ruby-win32.gemspec, sqlite3-ruby.gemspec: Added
4
+ win32 gem.
5
+
6
+ 2005-01-05 07:31 minam
7
+
8
+ * Rakefile, test/tc_integration.rb, test/tests.rb: Added
9
+ native-vs-dl benchmark to Rakefile. Added SQLITE3_DRIVERS
10
+ environment variable to integration test to specify which
11
+ driver(s) should be tested (defaults to "Native").
12
+
13
+ 2005-01-04 14:26 minam
14
+
15
+ * ext/sqlite3_api/sqlite3_api.i, lib/sqlite3/database.rb,
16
+ lib/sqlite3/driver/native/driver.rb, test/tc_database.rb,
17
+ test/tc_integration.rb, test/tests.rb: Unit tests: done. Bugs:
18
+ fixed.
19
+
20
+ 2005-01-03 23:13 minam
21
+
22
+ * ext/sqlite3_api/sqlite3_api.i, lib/sqlite3/database.rb,
23
+ lib/sqlite3/driver/dl/driver.rb,
24
+ lib/sqlite3/driver/native/driver.rb, test/tc_integration.rb:
25
+ Custom functions (aggregate and otherwise) are supported by the
26
+ native driver now. Test cases for the same.
27
+
28
+ 2005-01-03 13:51 minam
29
+
30
+ * ext/sqlite3_api/MANIFEST, ext/sqlite3_api/extconf.rb,
31
+ ext/sqlite3_api/post-clean.rb, ext/sqlite3_api/post-distclean.rb,
32
+ ext/sqlite3_api/sqlite3_api.i, lib/sqlite3/database.rb,
33
+ lib/sqlite3/resultset.rb, lib/sqlite3/version.rb,
34
+ lib/sqlite3/driver/dl/driver.rb,
35
+ lib/sqlite3/driver/native/driver.rb, test/native-vs-dl.rb,
36
+ test/tc_integration.rb: Added preliminary implementation of
37
+ native driver (swig-based), and integration tests.
38
+
39
+ 2004-12-29 19:37 minam
40
+
41
+ * lib/sqlite3/driver/dl/driver.rb: Some fixes to allow the DL
42
+ driver to work with Ruby 1.8.1.
43
+
44
+ 2004-12-29 14:52 minam
45
+
46
+ * lib/sqlite3/: database.rb, version.rb: Made #quote a class method
47
+ (again). Bumped version to 0.6.
48
+
49
+ 2004-12-25 22:59 minam
50
+
51
+ * lib/sqlite3/driver/dl/api.rb: Added check for darwin in supported
52
+ platforms (thanks to bitsweat).
53
+
54
+ 2004-12-22 12:38 minam
55
+
56
+ * Rakefile: Rakefile wasn't packaging the README file.
57
+
58
+ 2004-12-21 22:28 minam
59
+
60
+ * Rakefile, sqlite3-ruby.gemspec, test/bm.rb: Packaging now works.
61
+ Added benchmarks.
62
+
63
+ 2004-12-21 21:45 minam
64
+
65
+ * LICENSE, README, Rakefile, setup.rb, sqlite3-ruby.gemspec,
66
+ doc/faq/faq.rb, doc/faq/faq.yml, lib/sqlite3.rb,
67
+ lib/sqlite3/statement.rb, lib/sqlite3/constants.rb,
68
+ lib/sqlite3/database.rb, lib/sqlite3/resultset.rb,
69
+ lib/sqlite3/translator.rb, lib/sqlite3/value.rb,
70
+ lib/sqlite3/version.rb, lib/sqlite3/errors.rb,
71
+ lib/sqlite3/pragmas.rb, lib/sqlite3/driver/dl/api.rb,
72
+ lib/sqlite3/driver/dl/driver.rb, test/mocks.rb,
73
+ test/tc_database.rb, test/tests.rb, test/driver/dl/tc_driver.rb:
74
+ Initial import
75
+
76
+ 2004-12-21 21:45 minam
77
+
78
+ * LICENSE, README, Rakefile, setup.rb, sqlite3-ruby.gemspec,
79
+ doc/faq/faq.rb, doc/faq/faq.yml, lib/sqlite3.rb,
80
+ lib/sqlite3/statement.rb, lib/sqlite3/constants.rb,
81
+ lib/sqlite3/database.rb, lib/sqlite3/resultset.rb,
82
+ lib/sqlite3/translator.rb, lib/sqlite3/value.rb,
83
+ lib/sqlite3/version.rb, lib/sqlite3/errors.rb,
84
+ lib/sqlite3/pragmas.rb, lib/sqlite3/driver/dl/api.rb,
85
+ lib/sqlite3/driver/dl/driver.rb, test/mocks.rb,
86
+ test/tc_database.rb, test/tests.rb, test/driver/dl/tc_driver.rb:
87
+ Initial revision
88
+
@@ -0,0 +1,68 @@
1
+ === 1.2.5 / 25 Jul 2009
2
+
3
+ * Check for illegal nil before executing SQL [Erik Veenstra]
4
+ * Switch to Hoe for gem task management and packaging.
5
+ * Advertise rake-compiler as development dependency.
6
+ * Build gem binaries for Windows.
7
+ * Improved Ruby 1.9 support compatibility.
8
+ * Taint returned values. Patch #20325.
9
+
10
+
11
+ === 1.2.4.1 (internal) / 5 Jul 2009
12
+
13
+ * Check for illegal nil before executing SQL [Erik Veenstra]
14
+ * Switch to Hoe for gem task management and packaging.
15
+ * Advertise rake-compiler as development dependency.
16
+ * Build gem binaries for Windows.
17
+ * Improved Ruby 1.9 support compatibility.
18
+
19
+
20
+ === 1.2.4 / 27 Aug 2008
21
+
22
+ * Package the updated C file for source builds. [Jamis Buck]
23
+
24
+
25
+ === 1.2.3 / 26 Aug 2008
26
+
27
+ * Fix incorrect permissions on database.rb and translator.rb [Various]
28
+
29
+ * Avoid using Object#extend for greater speedups [Erik Veenstra]
30
+
31
+ * Ruby 1.9 compatibility tweaks for Array#zip [jimmy88@gmail.com]
32
+
33
+ * Fix linking against Ruby 1.8.5 [Rob Holland <rob@inversepath.com>]
34
+
35
+
36
+ === 1.2.2 / 31 May 2008
37
+
38
+ * Make the table_info method adjust the returned default value for the rows
39
+ so that the sqlite3 change in 3.3.8 and greater can be handled
40
+ transparently [Jamis Buck <jamis@37signals.com>]
41
+
42
+ * Ruby 1.9 compatibility tweaks [Roman Le Negrate <roman2k@free.fr>]
43
+
44
+ * Various performance enhancements [thanks Erik Veenstra]
45
+
46
+ * Correct busy_handler documentation [Rob Holland <rob@inversepath.com>]
47
+
48
+ * Use int_bind64 on Fixnum values larger than a 32bit C int can take. [Rob Holland <rob@inversepath.com>]
49
+
50
+ * Work around a quirk in SQLite's error reporting by calling sqlite3_reset
51
+ to produce a more informative error code upon a failure from
52
+ sqlite3_step. [Rob Holland <rob@inversepath.com>]
53
+
54
+ * Various documentation, test, and style tweaks [Rob Holland <rob@inversepath.com>]
55
+
56
+ * Be more granular with time/data translation [Rob Holland <rob@inversepath.com>]
57
+
58
+ * Use Date directly for parsing rather than going via Time [Rob Holland <rob@inversepath.com>]
59
+
60
+ * Check for the rt library and fdatasync so we link against that when
61
+ needed [Rob Holland <rob@inversepath.com>]
62
+
63
+ * Rename data structures to avoid collision on win32. based on patch
64
+ by: Luis Lavena [Rob Holland <rob@inversepath.com>]
65
+
66
+ * Add test for defaults [Daniel Rodríguez Troitiño]
67
+
68
+ * Correctly unquote double-quoted pragma defaults [Łukasz Dargiewicz <lukasz.dargiewicz@gmail.com>]
data/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2004, Jamis Buck (jamis@jamisbuck.org)
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+
14
+ * The names of its contributors may not be used to endorse or promote
15
+ products derived from this software without specific prior written
16
+ permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,41 @@
1
+ ChangeLog.cvs
2
+ History.txt
3
+ LICENSE
4
+ Manifest.txt
5
+ README.txt
6
+ Rakefile
7
+ ext/sqlite3_api/extconf.rb
8
+ ext/sqlite3_api/sqlite3_api.i
9
+ ext/sqlite3_api/sqlite3_api_wrap.c
10
+ faq/faq.rb
11
+ faq/faq.yml
12
+ lib/sqlite3.rb
13
+ lib/sqlite3/constants.rb
14
+ lib/sqlite3/database.rb
15
+ lib/sqlite3/driver/dl/api.rb
16
+ lib/sqlite3/driver/dl/driver.rb
17
+ lib/sqlite3/driver/native/driver.rb
18
+ lib/sqlite3/errors.rb
19
+ lib/sqlite3/pragmas.rb
20
+ lib/sqlite3/resultset.rb
21
+ lib/sqlite3/statement.rb
22
+ lib/sqlite3/translator.rb
23
+ lib/sqlite3/value.rb
24
+ lib/sqlite3/version.rb
25
+ setup.rb
26
+ tasks/benchmark.rake
27
+ tasks/faq.rake
28
+ tasks/gem.rake
29
+ tasks/native.rake
30
+ tasks/vendor_sqlite3.rake
31
+ test/bm.rb
32
+ test/driver/dl/tc_driver.rb
33
+ test/helper.rb
34
+ test/native-vs-dl.rb
35
+ test/test_database.rb
36
+ test/test_errors.rb
37
+ test/test_integration.rb
38
+ test/test_integration_open_close.rb
39
+ test/test_integration_pending.rb
40
+ test/test_integration_resultset.rb
41
+ test/test_integration_statement.rb
@@ -0,0 +1,56 @@
1
+ = SQLite3/Ruby Interface
2
+
3
+ * http://sqlite3-ruby.rubyforge.org
4
+ * http://rubyforge.org/projects/sqlite3-ruby
5
+ * http://github.com/jamis/sqlite3-ruby
6
+
7
+ == DESCRIPTION
8
+
9
+ This module allows Ruby programs to interface with the SQLite3
10
+ database engine (http://www.sqlite.org). You must have the
11
+ SQLite engine installed in order to build this module.
12
+
13
+ Note that this module is NOT compatible with SQLite 2.x.
14
+
15
+ == Compilation and Installation
16
+
17
+ Simply do the following, after installing SQLite3:
18
+
19
+ ruby setup.rb config
20
+ ruby setup.rb setup
21
+ ruby setup.rb install
22
+
23
+ Alternatively, you can download and install the RubyGem package for
24
+ SQLite3/Ruby (you must have RubyGems and SQLite3 installed, first):
25
+
26
+ gem install sqlite3-ruby
27
+
28
+ If you have sqlite3 installed in a non-standard location, you can specify the location of the include and lib files by doing:
29
+
30
+ gem install sqlite3-ruby -- --with-sqlite3-include=/opt/local/include \
31
+ --with-sqlite3-lib=/opt/local/lib
32
+
33
+ Also, the gem ships with the C source-code pre-built, so (as of version 1.1.1)
34
+ you no longer need to have SWIG installed. However, if you have SWIG installed
35
+ and you want to generate the C file yourself, you can specify the
36
+ <code>--with-swig</code> option.
37
+
38
+ == Usage
39
+
40
+ For help figuring out the SQLite3/Ruby interface, check out the
41
+ FAQ[http://sqlite-ruby.rubyforge.org/sqlite3/faq.html]. It includes examples of
42
+ usage. If you have any questions that you feel should be address in the
43
+ FAQ, please send them to jamis@37signals.com
44
+
45
+ == Source Code
46
+
47
+ The source repository is accessible via git:
48
+
49
+ git clone git://github.com/jamis/sqlite3-ruby.git
50
+
51
+ == Contact Information
52
+
53
+ The project page is http://rubyforge.org/projects/sqlite-ruby. There, you can
54
+ find links to mailing lists and forums that you can use to discuss this
55
+ library. Additionally, there are trackers for submitting bugs and feature
56
+ requests. Feel free to use them!
@@ -0,0 +1,5 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ # load rakefile extensions (tasks)
5
+ Dir['tasks/*.rake'].each { |f| import f }
@@ -0,0 +1,10 @@
1
+ require 'mkmf'
2
+
3
+ dir_config( "sqlite3" )
4
+
5
+ have_library( "rt", "fdatasync" )
6
+
7
+ if have_header( "sqlite3.h" ) && have_library( "sqlite3", "sqlite3_open" ) then
8
+ $CFLAGS << " -fno-strict-aliasing" unless RUBY_PLATFORM =~ /mswin/
9
+ create_makefile( "sqlite3_api" )
10
+ end
@@ -0,0 +1,362 @@
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
+ #ifndef STR2CSTR
16
+ #define STR2CSTR StringValueCStr
17
+ #endif
18
+
19
+ #define Init_API Init_sqlite3_api
20
+
21
+ struct CallbackData {
22
+ VALUE proc;
23
+ VALUE proc2;
24
+ VALUE data;
25
+ };
26
+
27
+ typedef struct CallbackData CallbackData;
28
+ typedef void RUBY_BLOB;
29
+ typedef void RUBY_VALBLOB;
30
+
31
+ int Sqlite3_ruby_busy_handler(void* data,int value) {
32
+ VALUE result;
33
+ CallbackData *cb = (CallbackData*)data;
34
+ result = rb_funcall(
35
+ cb->proc, rb_intern("call"), 2, cb->data, INT2FIX(value) );
36
+ return FIX2INT(result);
37
+ }
38
+
39
+ static void mark_CallbackData(void* ptr) {
40
+ CallbackData* cb = (CallbackData*)ptr;
41
+ if (cb->proc != Qnil)
42
+ rb_gc_mark(cb->proc);
43
+ if (cb->proc2 != Qnil)
44
+ rb_gc_mark(cb->proc2);
45
+ if (cb->data != Qnil)
46
+ rb_gc_mark(cb->data);
47
+ }
48
+
49
+ int Sqlite3_ruby_authorizer(void* data,int type,
50
+ const char* a,const char* b,const char* c,const char* d)
51
+ {
52
+ VALUE result;
53
+ CallbackData *cb = (CallbackData*)data;
54
+ result = rb_funcall(
55
+ cb->proc, rb_intern("call"), 6, cb->data, INT2FIX(type),
56
+ ( a ? rb_str_new2(a) : Qnil ), ( b ? rb_str_new2(b) : Qnil ),
57
+ ( c ? rb_str_new2(c) : Qnil ), ( d ? rb_str_new2(d) : Qnil ) );
58
+ return FIX2INT(result);
59
+ }
60
+
61
+ void Sqlite3_ruby_trace(void* data, const char *sql) {
62
+ CallbackData *cb = (CallbackData*)data;
63
+ rb_funcall( cb->proc, rb_intern("call"), 2, cb->data,
64
+ sql ? rb_str_new2(sql) : Qnil );
65
+ }
66
+
67
+ void Sqlite3_ruby_function_step(sqlite3_context* ctx,int n,
68
+ sqlite3_value** args)
69
+ {
70
+ CallbackData *data;
71
+ VALUE rb_args;
72
+ VALUE *rb_context;
73
+ int idx;
74
+
75
+ data = (CallbackData*)sqlite3_user_data(ctx);
76
+
77
+ if( data->proc2 != Qnil ) {
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
+
85
+ rb_args = rb_ary_new2(n+1);
86
+ rb_ary_push( rb_args, SWIG_NewPointerObj(ctx,SWIGTYPE_p_sqlite3_context,0) );
87
+ for( idx = 0; idx < n; idx++ ) {
88
+ rb_ary_push( rb_args, SWIG_NewPointerObj(args[idx],
89
+ SWIGTYPE_p_sqlite3_value,0) );
90
+ }
91
+
92
+ rb_apply( data->proc, rb_intern("call"), rb_args );
93
+ }
94
+
95
+ void Sqlite3_ruby_function_final(sqlite3_context *ctx) {
96
+ VALUE *rb_context;
97
+ CallbackData *data;
98
+
99
+ rb_context = (VALUE*)sqlite3_aggregate_context(ctx,sizeof(VALUE));
100
+ if( *rb_context == 0 ) {
101
+ *rb_context = rb_hash_new();
102
+ rb_gc_register_address( rb_context );
103
+ }
104
+
105
+ data = (CallbackData*)sqlite3_user_data(ctx);
106
+
107
+ rb_funcall( data->proc2, rb_intern("call"), 1,
108
+ SWIG_NewPointerObj(ctx,SWIGTYPE_p_sqlite3_context,0) );
109
+
110
+ rb_gc_unregister_address( rb_context );
111
+ }
112
+ %}
113
+
114
+ %markfunc CallbackData "mark_CallbackData";
115
+
116
+ struct CallbackData {
117
+ VALUE proc;
118
+ VALUE proc2;
119
+ VALUE data;
120
+ };
121
+
122
+ %typemap(in) const void *str {
123
+ $1 = (void*)RSTRING_PTR($input);
124
+ }
125
+
126
+ %typemap(in) (const char *filename, sqlite3**) {
127
+ $1 = STR2CSTR($input);
128
+ $2 = (sqlite3**)malloc( sizeof( sqlite3* ) );
129
+ }
130
+
131
+ %typemap(argout) (const char *filename, sqlite3**) {
132
+ VALUE ary;
133
+ ary = rb_ary_new2(2);
134
+ rb_ary_push( ary, $result );
135
+ rb_ary_push( ary, SWIG_NewPointerObj( *$2, SWIGTYPE_p_sqlite3, 0 ) );
136
+ free( $2 );
137
+ $result = ary;
138
+ }
139
+
140
+ %typemap(in) (const void *filename, sqlite3**) {
141
+ $1 = (void*)RSTRING_PTR($input);
142
+ $2 = (sqlite3**)malloc( sizeof( sqlite3* ) );
143
+ }
144
+
145
+ %typemap(argout) (const void *filename, sqlite3**) {
146
+ VALUE ary;
147
+ ary = rb_ary_new2(2);
148
+ rb_ary_push( ary, $result );
149
+ rb_ary_push( ary, SWIG_NewPointerObj( *$2, SWIGTYPE_p_sqlite3, 0 ) );
150
+ free( $2 );
151
+ $result = ary;
152
+ }
153
+
154
+ typedef void RUBY_BLOB;
155
+ %typemap(out) const RUBY_BLOB * {
156
+ $result = $1 ?
157
+ rb_str_new( (char*)$1, sqlite3_column_bytes( arg1, arg2 ) ) : Qnil;
158
+ }
159
+
160
+ typedef void RUBY_VALBLOB;
161
+ %typemap(out) const RUBY_VALBLOB * {
162
+ $result = $1 ? rb_str_new( (char*)$1, sqlite3_value_bytes( arg1 ) ) : Qnil;
163
+ }
164
+
165
+ %typemap(out) const void * {
166
+ int i;
167
+ if( $1 ) {
168
+ for( i = 0; ((char*)$1)[i]; i += 2 );
169
+ $result = rb_str_new( (char*)$1, i );
170
+ } else $result = Qnil;
171
+ }
172
+
173
+ %typemap(in) (const char * sql,int,sqlite3_stmt**,const char**) (sqlite3_stmt *stmt, char *errmsg) {
174
+ $1 = RSTRING_PTR($input);
175
+ $2 = RSTRING_LEN($input);
176
+ $3 = &stmt2;
177
+ $4 = &errmsg2;
178
+ }
179
+
180
+ %typemap(argout) (const char* sql,int,sqlite3_stmt**,const char**) {
181
+ VALUE ary;
182
+ ary = rb_ary_new2(3);
183
+ rb_ary_push( ary, $result );
184
+ rb_ary_push( ary, SWIG_NewPointerObj( stmt2, SWIGTYPE_p_sqlite3_stmt, 0 ) );
185
+ rb_ary_push( ary, errmsg2 ? rb_str_new2( errmsg2 ) : Qnil );
186
+ $result = ary;
187
+ }
188
+
189
+ %typemap(in) (const void* sql,int,sqlite3_stmt**,const void**) (sqlite3_stmt *stmt, void *errmsg) {
190
+ $1 = RSTRING_PTR($input);
191
+ $2 = RSTRING_LEN($input);
192
+ $3 = &stmt2;
193
+ $4 = &errmsg2;
194
+ }
195
+
196
+ %typemap(argout) (const void* sql,int,sqlite3_stmt**,const void**) {
197
+ VALUE ary;
198
+ int i;
199
+
200
+ for( i = 0; ((char*)errmsg2)[i]; i += 2 );
201
+
202
+ ary = rb_ary_new2(3);
203
+ rb_ary_push( ary, $result );
204
+ rb_ary_push( ary, SWIG_NewPointerObj( stmt2, SWIGTYPE_p_sqlite3_stmt, 0 ) );
205
+ rb_ary_push( ary, errmsg2 ? rb_str_new( (char*)errmsg2, i ) : Qnil );
206
+ $result = ary;
207
+ }
208
+
209
+ %typemap(in) (const void *blob,int) {
210
+ $1 = (void*)RSTRING_PTR($input);
211
+ $2 = RSTRING_LEN($input);
212
+ }
213
+
214
+ %typemap(in) (const void *blob,int,void(*free)(void*)) {
215
+ $1 = (void*)RSTRING_PTR($input);
216
+ $2 = RSTRING_LEN($input);
217
+ $3 = SQLITE_TRANSIENT;
218
+ }
219
+
220
+ %typemap(in) (const char *text,int) {
221
+ $1 = RSTRING_PTR($input);
222
+ $2 = RSTRING_LEN($input);
223
+ }
224
+
225
+ %typemap(in) (const char *text,int,void(*free)(void*)) {
226
+ $1 = RSTRING_PTR($input);
227
+ $2 = RSTRING_LEN($input);
228
+ $3 = SQLITE_TRANSIENT;
229
+ }
230
+
231
+ %typemap(in) (const void *utf16,int) {
232
+ $1 = (void*)RSTRING_PTR($input);
233
+ $2 = RSTRING_LEN($input);
234
+ }
235
+
236
+ %typemap(in) (const void *utf16,int,void(*free)(void*)) {
237
+ $1 = (void*)RSTRING_PTR($input);
238
+ $2 = RSTRING_LEN($input);
239
+ $3 = SQLITE_TRANSIENT;
240
+ }
241
+
242
+ %typemap(out) sqlite_int64 {
243
+ $result = rb_ll2inum( $1 );
244
+ }
245
+
246
+ %typemap(out) const char * {
247
+ $result = $1 ? rb_str_new2($1) : Qnil;
248
+ }
249
+
250
+ %typemap(in) sqlite_int64 {
251
+ $1 = rb_num2ll( $input );
252
+ }
253
+
254
+ %typemap(in) (sqlite3_context*,int data_size) {
255
+ SWIG_ConvertPtr($input,(void**)&$1, SWIGTYPE_p_sqlite3_context, 1);
256
+ $2 = 4;
257
+ }
258
+
259
+ %typemap(out) VALUE* {
260
+ $result = *(VALUE*)$1;
261
+ }
262
+
263
+ %constant int Sqlite3_ruby_busy_handler(void*,int);
264
+ %constant int Sqlite3_ruby_authorizer(void*,int,const char*,const char*,const char*,const char*);
265
+ %constant void Sqlite3_ruby_trace(void*,const char*);
266
+ %constant void Sqlite3_ruby_function_step(sqlite3_context* ctx,int n,
267
+ sqlite3_value** args);
268
+ %constant void Sqlite3_ruby_function_final(sqlite3_context* ctx);
269
+
270
+ const char *sqlite3_libversion(void);
271
+ int sqlite3_close(sqlite3*);
272
+
273
+ sqlite_int64 sqlite3_last_insert_rowid(sqlite3*);
274
+
275
+ int sqlite3_changes(sqlite3*);
276
+ int sqlite3_total_changes(sqlite3*);
277
+ void sqlite3_interrupt(sqlite3*);
278
+
279
+ int sqlite3_complete(const char*);
280
+ int sqlite3_complete16(const void *str);
281
+
282
+ int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
283
+ int sqlite3_busy_timeout(sqlite3*,int);
284
+ int sqlite3_set_authorizer(sqlite3*, int(*)(void*,int,const char*,const char*,const char*,const char*), void*);
285
+ int sqlite3_trace(sqlite3*, void(*)(void*,const char*), void*);
286
+
287
+ int sqlite3_open(const char *filename, sqlite3 **);
288
+ int sqlite3_open16(const void *filename, sqlite3 **);
289
+
290
+ int sqlite3_errcode(sqlite3*);
291
+ const char *sqlite3_errmsg(sqlite3*);
292
+ const void *sqlite3_errmsg16(sqlite3*);
293
+
294
+ int sqlite3_prepare(sqlite3*,const char* sql,int,sqlite3_stmt**,const char**);
295
+ int sqlite3_prepare16(sqlite3*,const void* sql,int,sqlite3_stmt**,const void**);
296
+
297
+ int sqlite3_bind_blob(sqlite3_stmt*,int,const void *blob,int,void(*free)(void*));
298
+ int sqlite3_bind_double(sqlite3_stmt*,int,double);
299
+ int sqlite3_bind_int(sqlite3_stmt*,int,int);
300
+ int sqlite3_bind_int64(sqlite3_stmt*,int,sqlite_int64);
301
+ int sqlite3_bind_null(sqlite3_stmt*,int);
302
+ int sqlite3_bind_text(sqlite3_stmt*,int,const char*text,int,void(*free)(void*));
303
+ int sqlite3_bind_text16(sqlite3_stmt*,int,const void*utf16,int,void(*free)(void*));
304
+
305
+ int sqlite3_bind_parameter_count(sqlite3_stmt*);
306
+ const char *sqlite3_bind_parameter_name(sqlite3_stmt*,int);
307
+ int sqlite3_bind_parameter_index(sqlite3_stmt*,const char*);
308
+
309
+ int sqlite3_column_count(sqlite3_stmt*);
310
+ const char *sqlite3_column_name(sqlite3_stmt*,int);
311
+ const void *sqlite3_column_name16(sqlite3_stmt*,int);
312
+ const char *sqlite3_column_decltype(sqlite3_stmt*,int);
313
+ const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
314
+
315
+ int sqlite3_step(sqlite3_stmt*);
316
+
317
+ int sqlite3_data_count(sqlite3_stmt*);
318
+
319
+ const RUBY_BLOB *sqlite3_column_blob(sqlite3_stmt*,int);
320
+ int sqlite3_column_bytes(sqlite3_stmt*,int);
321
+ int sqlite3_column_bytes16(sqlite3_stmt*,int);
322
+ double sqlite3_column_double(sqlite3_stmt*,int);
323
+ double sqlite3_column_int(sqlite3_stmt*,int);
324
+ sqlite_int64 sqlite3_column_int64(sqlite3_stmt*,int);
325
+ const char *sqlite3_column_text(sqlite3_stmt*,int);
326
+ const void *sqlite3_column_text16(sqlite3_stmt*,int);
327
+ int sqlite3_column_type(sqlite3_stmt*,int);
328
+
329
+ int sqlite3_finalize(sqlite3_stmt*);
330
+ int sqlite3_reset(sqlite3_stmt*);
331
+
332
+ 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*));
333
+
334
+ 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*));
335
+
336
+ int sqlite3_aggregate_count(sqlite3_context*);
337
+
338
+ const RUBY_VALBLOB *sqlite3_value_blob(sqlite3_value*);
339
+ int sqlite3_value_bytes(sqlite3_value*);
340
+ int sqlite3_value_bytes16(sqlite3_value*);
341
+ double sqlite3_value_double(sqlite3_value*);
342
+ int sqlite3_value_int(sqlite3_value*);
343
+ sqlite_int64 sqlite3_value_int64(sqlite3_value*);
344
+ const char *sqlite3_value_text(sqlite3_value*);
345
+ const void *sqlite3_value_text16(sqlite3_value*);
346
+ const void *sqlite3_value_text16le(sqlite3_value*);
347
+ const void *sqlite3_value_text16be(sqlite3_value*);
348
+ int sqlite3_value_type(sqlite3_value*);
349
+
350
+ void sqlite3_result_blob(sqlite3_context*,const void *blob,int,void(*free)(void*));
351
+ void sqlite3_result_double(sqlite3_context*,double);
352
+ void sqlite3_result_error(sqlite3_context*,const char *text,int);
353
+ void sqlite3_result_error16(sqlite3_context*,const void *blob,int);
354
+ void sqlite3_result_int(sqlite3_context*,int);
355
+ void sqlite3_result_int64(sqlite3_context*,sqlite_int64);
356
+ void sqlite3_result_text(sqlite3_context*,const char* text,int,void(*free)(void*));
357
+ void sqlite3_result_text16(sqlite3_context*,const void* utf16,int,void(*free)(void*));
358
+ void sqlite3_result_text16le(sqlite3_context*,const void* utf16,int,void(*free)(void*));
359
+ void sqlite3_result_text16be(sqlite3_context*,const void* utf16,int,void(*free)(void*));
360
+ void sqlite3_result_value(sqlite3_context*,sqlite3_value*);
361
+
362
+ VALUE *sqlite3_aggregate_context(sqlite3_context*,int data_size);