sqlite3-ruby 1.2.1 → 1.2.2

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.

@@ -39,13 +39,9 @@ FAQ, please send them to jamis@37signals.com
39
39
 
40
40
  == Source Code
41
41
 
42
- The source repository is accessible via subversion:
42
+ The source repository is accessible via git:
43
43
 
44
- svn co http://svn.jamisbuck.org/sqlite3-ruby/trunk
45
-
46
- Individual releases are tagged in the tags directory:
47
-
48
- svn co http://svn.jamisbuck.org/sqlite3-ruby/tags
44
+ git clone git://github.com/jamis/sqlite3-ruby.git
49
45
 
50
46
  == Contact Information
51
47
 
data/doc/faq/faq.html CHANGED
@@ -62,25 +62,25 @@
62
62
  <ul>
63
63
  <li>How do I do a database query?
64
64
  <ul>
65
- <li><a href='#37380'>I just want an array of the rows&#8230;</a></li>
66
- <li><a href='#36440'>I&#8217;d like to use a block to iterate through the rows&#8230;</a></li>
67
- <li><a href='#32250'>I need to get the column names as well as the rows&#8230;</a></li>
68
- <li><a href='#31680'>I just want the first row of the result set&#8230;</a></li>
69
- <li><a href='#31240'>I just want the first value of the first row of the result set&#8230;</a></li>
65
+ <li><a href='#3128110'>I just want an array of the rows&#8230;</a></li>
66
+ <li><a href='#3127990'>I&#8217;d like to use a block to iterate through the rows&#8230;</a></li>
67
+ <li><a href='#3127870'>I need to get the column names as well as the rows&#8230;</a></li>
68
+ <li><a href='#3127750'>I just want the first row of the result set&#8230;</a></li>
69
+ <li><a href='#3127650'>I just want the first value of the first row of the result set&#8230;</a></li>
70
70
  </ul>
71
71
  </li>
72
- <li><a href='#30080'>How do I prepare a statement for repeated execution?</a></li>
73
- <li><a href='#27350'>How do I use placeholders in an <span class="caps">SQL</span> statement?</a></li>
74
- <li><a href='#26510'>How do I discover metadata about a query?</a></li>
75
- <li><a href='#26320'>I&#8217;d like the rows to be indexible by column name.</a></li>
76
- <li><a href='#26050'>I&#8217;d like the values from a query to be the correct types, instead of String.</a></li>
77
- <li><a href='#25850'>How do insert binary data into the database?</a></li>
78
- <li><a href='#25740'>How do I do a <span class="caps">DDL</span> (insert, update, delete) statement?</a></li>
79
- <li><a href='#23610'>How do I execute multiple statements in a single string?</a></li>
80
- <li><a href='#22110'>How do I begin/end a transaction?</a></li>
72
+ <li><a href='#3127470'>How do I prepare a statement for repeated execution?</a></li>
73
+ <li><a href='#3127360'>How do I use placeholders in an <span class="caps">SQL</span> statement?</a></li>
74
+ <li><a href='#3127240'>How do I discover metadata about a query?</a></li>
75
+ <li><a href='#3127090'>I&#8217;d like the rows to be indexible by column name.</a></li>
76
+ <li><a href='#3126930'>I&#8217;d like the values from a query to be the correct types, instead of String.</a></li>
77
+ <li><a href='#3126780'>How do insert binary data into the database?</a></li>
78
+ <li><a href='#3126610'>How do I do a <span class="caps">DDL</span> (insert, update, delete) statement?</a></li>
79
+ <li><a href='#3126460'>How do I execute multiple statements in a single string?</a></li>
80
+ <li><a href='#3126340'>How do I begin/end a transaction?</a></li>
81
81
  </ul>
82
82
  </div>
83
- <a name='37380'></a>
83
+ <a name='3128110'></a>
84
84
  <div class='faq-title'>How do I do a database query? I just want an array of the rows&#8230;</div>
85
85
  <div class='faq-answer'><p>Use the <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#execute</a> method. If you don&#8217;t give it a block, it will return an array of all the rows:</p>
86
86
 
@@ -91,7 +91,7 @@
91
91
  db = SQLite3::<a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database</a>.new( "test.db" )
92
92
  rows = db.execute( "select * from test" )
93
93
  </pre></div>
94
- <a name='36440'></a>
94
+ <a name='3127990'></a>
95
95
  <div class='faq-title'>How do I do a database query? I&#8217;d like to use a block to iterate through the rows&#8230;</div>
96
96
  <div class='faq-answer'><p>Use the <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#execute</a> method. If you give it a block, each row of the result will be yielded to the block:</p>
97
97
 
@@ -104,7 +104,7 @@
104
104
  ...
105
105
  end
106
106
  </pre></div>
107
- <a name='32250'></a>
107
+ <a name='3127870'></a>
108
108
  <div class='faq-title'>How do I do a database query? I need to get the column names as well as the rows&#8230;</div>
109
109
  <div class='faq-answer'><p>Use the <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#execute2</a> method. This works just like <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#execute</a>; if you don&#8217;t give it a block, it returns an array of rows; otherwise, it will yield each row to the block. <em>However</em>, the first row returned is always an array of the column names from the query:</p>
110
110
 
@@ -126,7 +126,7 @@
126
126
  end
127
127
  end
128
128
  </pre></div>
129
- <a name='31680'></a>
129
+ <a name='3127750'></a>
130
130
  <div class='faq-title'>How do I do a database query? I just want the first row of the result set&#8230;</div>
131
131
  <div class='faq-answer'><p>Easy. Just call <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#get_first_row</a>:</p>
132
132
 
@@ -136,7 +136,7 @@
136
136
  </pre>
137
137
 
138
138
  <p>This also supports bind variables, just like <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#execute</a> and friends.</p></div>
139
- <a name='31240'></a>
139
+ <a name='3127650'></a>
140
140
  <div class='faq-title'>How do I do a database query? I just want the first value of the first row of the result set&#8230;</div>
141
141
  <div class='faq-answer'><p>Also easy. Just call <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#get_first_value</a>:</p>
142
142
 
@@ -146,7 +146,7 @@
146
146
  </pre>
147
147
 
148
148
  <p>This also supports bind variables, just like <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#execute</a> and friends.</p></div>
149
- <a name='30080'></a>
149
+ <a name='3127470'></a>
150
150
  <div class='faq-title'>How do I prepare a statement for repeated execution?</div>
151
151
  <div class='faq-answer'><p>If the same statement is going to be executed repeatedly, you can speed things up a bit by <em>preparing</em> the statement. You do this via the <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#prepare</a> method. It returns a <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Statement.html'>Statement</a> object, and you can then invoke #execute on that to get the <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/ResultSet.html'>ResultSet</a>:</p>
152
152
 
@@ -174,7 +174,7 @@
174
174
  </pre>
175
175
 
176
176
  <p>This is made more useful by the ability to bind variables to placeholders via the <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Statement.html'>Statement#bind_param</a> and <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Statement.html'>Statement#bind_params</a> methods. (See the next <span class="caps">FAQ</span> for details.)</p></div>
177
- <a name='27350'></a>
177
+ <a name='3127360'></a>
178
178
  <div class='faq-title'>How do I use placeholders in an <span class="caps">SQL</span> statement?</div>
179
179
  <div class='faq-answer'><p>Placeholders in an <span class="caps">SQL</span> statement take any of the following formats:</p>
180
180
 
@@ -249,7 +249,7 @@
249
249
 
250
250
  stmt.bind_params( "value", "name" =&gt; "bob" )
251
251
  </pre></div>
252
- <a name='26510'></a>
252
+ <a name='3127240'></a>
253
253
  <div class='faq-title'>How do I discover metadata about a query?</div>
254
254
  <div class='faq-answer'><p>If you ever want to know the names or types of the columns in a result set, you can do it in several ways.</p>
255
255
 
@@ -282,7 +282,7 @@
282
282
  p stmt.columns
283
283
  p stmt.types
284
284
  </pre></div>
285
- <a name='26320'></a>
285
+ <a name='3127090'></a>
286
286
  <div class='faq-title'>I&#8217;d like the rows to be indexible by column name.</div>
287
287
  <div class='faq-answer'><p>By default, each row from a query is returned as an Array of values. This means that you can only obtain values by their index. Sometimes, however, you would like to obtain values by their column name.</p>
288
288
 
@@ -310,7 +310,7 @@
310
310
  p row[1] == row['column2']
311
311
  end
312
312
  </pre></div>
313
- <a name='26050'></a>
313
+ <a name='3126930'></a>
314
314
  <div class='faq-title'>I&#8217;d like the values from a query to be the correct types, instead of String.</div>
315
315
  <div class='faq-answer'><p>You can turn on &#8220;type translation&#8221; by setting <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#type_translation</a> to true:</p>
316
316
 
@@ -348,7 +348,7 @@
348
348
  obj = db.get_first_value( "select thing from objects where name='bob'" )
349
349
  p obj == h
350
350
  </pre></div>
351
- <a name='25850'></a>
351
+ <a name='3126780'></a>
352
352
  <div class='faq-title'>How do insert binary data into the database?</div>
353
353
  <div class='faq-answer'><p>Use blobs. Blobs are new features of SQLite3. You have to use bind variables to make it work:</p>
354
354
 
@@ -360,7 +360,7 @@
360
360
  </pre>
361
361
 
362
362
  <p>The blob values must be indicated explicitly by binding each parameter to a value of type SQLite3::Blob.</p></div>
363
- <a name='25740'></a>
363
+ <a name='3126610'></a>
364
364
  <div class='faq-title'>How do I do a <span class="caps">DDL</span> (insert, update, delete) statement?</div>
365
365
  <div class='faq-answer'><p>You can actually do inserts, updates, and deletes in exactly the same way as selects, but in general the <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#execute</a> method will be most convenient:</p>
366
366
 
@@ -368,7 +368,7 @@
368
368
  <pre>
369
369
  db.execute( "insert into table values ( ?, ? )", *bind_vars )
370
370
  </pre></div>
371
- <a name='23610'></a>
371
+ <a name='3126460'></a>
372
372
  <div class='faq-title'>How do I execute multiple statements in a single string?</div>
373
373
  <div class='faq-answer'><p>The standard query methods (<a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#execute</a>, <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#execute2</a>, <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#query</a>, and <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Statement.html'>Statement#execute</a>) will only execute the first statement in the string that is given to them. Thus, if you have a string with multiple <span class="caps">SQL</span> statements, each separated by a string, you can&#8217;t use those methods to execute them all at once.</p>
374
374
 
@@ -392,7 +392,7 @@
392
392
  </pre>
393
393
 
394
394
  <p>Unlike the other query methods, <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#execute_batch</a> accepts no block. It will also only ever return <ins>nil</ins>. Thus, it is really only suitable for batch processing of <span class="caps">DDL</span> statements.</p></div>
395
- <a name='22110'></a>
395
+ <a name='3126340'></a>
396
396
  <div class='faq-title'>How do I begin/end a transaction?</div>
397
397
  <div class='faq-answer'><p>Use <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#transaction</a> to start a transaction. If you give it a block, the block will be automatically committed at the end of the block, unless an exception was raised, in which case the transaction will be rolled back. (Never explicitly call <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#commit</a> or <a href='http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html'>Database#rollback</a> inside of a transaction block&#8212;you&#8217;ll get errors when the block terminates!)</p>
398
398
 
data/doc/faq/faq.rb CHANGED
@@ -1,35 +1,3 @@
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
1
  require 'yaml'
34
2
  require 'redcloth'
35
3
 
@@ -93,7 +61,7 @@ def add_api_links( text )
93
61
  disp_obj = obj = $1
94
62
 
95
63
  case obj
96
- when "Pragmas": disp_obj = "Database"
64
+ when "Pragmas"; disp_obj = "Database"
97
65
  end
98
66
 
99
67
  method = $3
@@ -4,10 +4,13 @@ SWIG_WRAP = "sqlite3_api_wrap.c"
4
4
 
5
5
  dir_config( "sqlite3", "/usr/local" )
6
6
 
7
+ have_library( "rt", "fdatasync" )
8
+
7
9
  if have_header( "sqlite3.h" ) && have_library( "sqlite3", "sqlite3_open" )
8
10
  if !File.exists?( SWIG_WRAP ) || with_config( "swig", false )
9
11
  puts "creating #{SWIG_WRAP}"
10
12
  system "swig -ruby sqlite3_api.i" or raise "could not build wrapper via swig (perhaps swig is not installed?)"
11
13
  end
14
+
12
15
  create_makefile( "sqlite3_api" )
13
16
  end
@@ -3,7 +3,6 @@
3
3
  %{
4
4
  #include <sqlite3.h>
5
5
  #include "ruby.h"
6
- #include "intern.h"
7
6
 
8
7
  #define Init_API Init_sqlite3_api
9
8
 
@@ -14,8 +13,8 @@ struct CallbackData {
14
13
  };
15
14
 
16
15
  typedef struct CallbackData CallbackData;
17
- typedef void BLOB;
18
- typedef void VALBLOB;
16
+ typedef void RUBY_BLOB;
17
+ typedef void RUBY_VALBLOB;
19
18
 
20
19
  int Sqlite3_ruby_busy_handler(void* data,int value) {
21
20
  VALUE result;
@@ -109,7 +108,7 @@ struct CallbackData {
109
108
  };
110
109
 
111
110
  %typemap(in) const void *str {
112
- $1 = (void*)RSTRING($input)->ptr;
111
+ $1 = (void*)RSTRING_PTR($input);
113
112
  }
114
113
 
115
114
  %typemap(in) (const char *filename, sqlite3**) {
@@ -127,7 +126,7 @@ struct CallbackData {
127
126
  }
128
127
 
129
128
  %typemap(in) (const void *filename, sqlite3**) {
130
- $1 = (void*)RSTRING($input)->ptr;
129
+ $1 = (void*)RSTRING_PTR($input);
131
130
  $2 = (sqlite3**)malloc( sizeof( sqlite3* ) );
132
131
  }
133
132
 
@@ -140,14 +139,14 @@ struct CallbackData {
140
139
  $result = ary;
141
140
  }
142
141
 
143
- typedef void BLOB;
144
- %typemap(out) const BLOB * {
142
+ typedef void RUBY_BLOB;
143
+ %typemap(out) const RUBY_BLOB * {
145
144
  $result = $1 ?
146
145
  rb_str_new( (char*)$1, sqlite3_column_bytes( arg1, arg2 ) ) : Qnil;
147
146
  }
148
147
 
149
- typedef void VALBLOB;
150
- %typemap(out) const VALBLOB * {
148
+ typedef void RUBY_VALBLOB;
149
+ %typemap(out) const RUBY_VALBLOB * {
151
150
  $result = $1 ? rb_str_new( (char*)$1, sqlite3_value_bytes( arg1 ) ) : Qnil;
152
151
  }
153
152
 
@@ -160,8 +159,8 @@ typedef void VALBLOB;
160
159
  }
161
160
 
162
161
  %typemap(in) (const char * sql,int,sqlite3_stmt**,const char**) (sqlite3_stmt *stmt, char *errmsg) {
163
- $1 = RSTRING($input)->ptr;
164
- $2 = RSTRING($input)->len;
162
+ $1 = RSTRING_PTR($input);
163
+ $2 = RSTRING_LEN($input);
165
164
  $3 = &stmt2;
166
165
  $4 = &errmsg2;
167
166
  }
@@ -176,8 +175,8 @@ typedef void VALBLOB;
176
175
  }
177
176
 
178
177
  %typemap(in) (const void* sql,int,sqlite3_stmt**,const void**) (sqlite3_stmt *stmt, void *errmsg) {
179
- $1 = RSTRING($input)->ptr;
180
- $2 = RSTRING($input)->len;
178
+ $1 = RSTRING_PTR($input);
179
+ $2 = RSTRING_LEN($input);
181
180
  $3 = &stmt2;
182
181
  $4 = &errmsg2;
183
182
  }
@@ -196,35 +195,35 @@ typedef void VALBLOB;
196
195
  }
197
196
 
198
197
  %typemap(in) (const void *blob,int) {
199
- $1 = (void*)RSTRING($input)->ptr;
200
- $2 = RSTRING($input)->len;
198
+ $1 = (void*)RSTRING_PTR($input);
199
+ $2 = RSTRING_LEN($input);
201
200
  }
202
201
 
203
202
  %typemap(in) (const void *blob,int,void(*free)(void*)) {
204
- $1 = (void*)RSTRING($input)->ptr;
205
- $2 = RSTRING($input)->len;
203
+ $1 = (void*)RSTRING_PTR($input);
204
+ $2 = RSTRING_LEN($input);
206
205
  $3 = SQLITE_TRANSIENT;
207
206
  }
208
207
 
209
208
  %typemap(in) (const char *text,int) {
210
- $1 = RSTRING($input)->ptr;
211
- $2 = RSTRING($input)->len;
209
+ $1 = RSTRING_PTR($input);
210
+ $2 = RSTRING_LEN($input);
212
211
  }
213
212
 
214
213
  %typemap(in) (const char *text,int,void(*free)(void*)) {
215
- $1 = RSTRING($input)->ptr;
216
- $2 = RSTRING($input)->len;
214
+ $1 = RSTRING_PTR($input);
215
+ $2 = RSTRING_LEN($input);
217
216
  $3 = SQLITE_TRANSIENT;
218
217
  }
219
218
 
220
219
  %typemap(in) (const void *utf16,int) {
221
- $1 = (void*)RSTRING($input)->ptr;
222
- $2 = RSTRING($input)->len;
220
+ $1 = (void*)RSTRING_PTR($input);
221
+ $2 = RSTRING_LEN($input);
223
222
  }
224
223
 
225
224
  %typemap(in) (const void *utf16,int,void(*free)(void*)) {
226
- $1 = (void*)RSTRING($input)->ptr;
227
- $2 = RSTRING($input)->len;
225
+ $1 = (void*)RSTRING_PTR($input);
226
+ $2 = RSTRING_LEN($input);
228
227
  $3 = SQLITE_TRANSIENT;
229
228
  }
230
229
 
@@ -237,7 +236,7 @@ typedef void VALBLOB;
237
236
  }
238
237
 
239
238
  %typemap(in) sqlite_int64 {
240
- $1 = rb_big2ll( $input );
239
+ $1 = rb_num2ll( $input );
241
240
  }
242
241
 
243
242
  %typemap(in) (sqlite3_context*,int data_size) {
@@ -305,7 +304,7 @@ int sqlite3_step(sqlite3_stmt*);
305
304
 
306
305
  int sqlite3_data_count(sqlite3_stmt*);
307
306
 
308
- const BLOB *sqlite3_column_blob(sqlite3_stmt*,int);
307
+ const RUBY_BLOB *sqlite3_column_blob(sqlite3_stmt*,int);
309
308
  int sqlite3_column_bytes(sqlite3_stmt*,int);
310
309
  int sqlite3_column_bytes16(sqlite3_stmt*,int);
311
310
  double sqlite3_column_double(sqlite3_stmt*,int);
@@ -324,7 +323,7 @@ int sqlite3_create_function16(sqlite3*,const void*str,int,int,void*,void(*func)(
324
323
 
325
324
  int sqlite3_aggregate_count(sqlite3_context*);
326
325
 
327
- const VALBLOB *sqlite3_value_blob(sqlite3_value*);
326
+ const RUBY_VALBLOB *sqlite3_value_blob(sqlite3_value*);
328
327
  int sqlite3_value_bytes(sqlite3_value*);
329
328
  int sqlite3_value_bytes16(sqlite3_value*);
330
329
  double sqlite3_value_double(sqlite3_value*);
@@ -1063,7 +1063,6 @@ extern "C" {
1063
1063
 
1064
1064
  #include <sqlite3.h>
1065
1065
  #include "ruby.h"
1066
- #include "intern.h"
1067
1066
 
1068
1067
  #define Init_API Init_sqlite3_api
1069
1068
 
@@ -1074,8 +1073,8 @@ struct CallbackData {
1074
1073
  };
1075
1074
 
1076
1075
  typedef struct CallbackData CallbackData;
1077
- typedef void BLOB;
1078
- typedef void VALBLOB;
1076
+ typedef void RUBY_BLOB;
1077
+ typedef void RUBY_VALBLOB;
1079
1078
 
1080
1079
  int Sqlite3_ruby_busy_handler(void* data,int value) {
1081
1080
  VALUE result;
@@ -1409,7 +1408,7 @@ _wrap_sqlite3_complete16(int argc, VALUE *argv, VALUE self) {
1409
1408
  if ((argc < 1) || (argc > 1))
1410
1409
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1411
1410
  {
1412
- arg1 = (void*)RSTRING(argv[0])->ptr;
1411
+ arg1 = (void*)RSTRING_PTR(argv[0]);
1413
1412
  }
1414
1413
  result = (int)sqlite3_complete16((void const *)arg1);
1415
1414
 
@@ -1534,7 +1533,7 @@ _wrap_sqlite3_open16(int argc, VALUE *argv, VALUE self) {
1534
1533
  if ((argc < 1) || (argc > 1))
1535
1534
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1536
1535
  {
1537
- arg1 = (void*)RSTRING(argv[0])->ptr;
1536
+ arg1 = (void*)RSTRING_PTR(argv[0]);
1538
1537
  arg2 = (sqlite3**)malloc( sizeof( sqlite3* ) );
1539
1538
  }
1540
1539
  result = (int)sqlite3_open16((void const *)arg1,arg2);
@@ -1624,8 +1623,8 @@ _wrap_sqlite3_prepare(int argc, VALUE *argv, VALUE self) {
1624
1623
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc);
1625
1624
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3, 0);
1626
1625
  {
1627
- arg2 = RSTRING(argv[1])->ptr;
1628
- arg3 = RSTRING(argv[1])->len;
1626
+ arg2 = RSTRING_PTR(argv[1]);
1627
+ arg3 = RSTRING_LEN(argv[1]);
1629
1628
  arg4 = &stmt2;
1630
1629
  arg5 = &errmsg2;
1631
1630
  }
@@ -1660,8 +1659,8 @@ _wrap_sqlite3_prepare16(int argc, VALUE *argv, VALUE self) {
1660
1659
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc);
1661
1660
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3, 0);
1662
1661
  {
1663
- arg2 = RSTRING(argv[1])->ptr;
1664
- arg3 = RSTRING(argv[1])->len;
1662
+ arg2 = RSTRING_PTR(argv[1]);
1663
+ arg3 = RSTRING_LEN(argv[1]);
1665
1664
  arg4 = &stmt2;
1666
1665
  arg5 = &errmsg2;
1667
1666
  }
@@ -1699,8 +1698,8 @@ _wrap_sqlite3_bind_blob(int argc, VALUE *argv, VALUE self) {
1699
1698
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3_stmt, 0);
1700
1699
  arg2 = NUM2INT(argv[1]);
1701
1700
  {
1702
- arg3 = (void*)RSTRING(argv[2])->ptr;
1703
- arg4 = RSTRING(argv[2])->len;
1701
+ arg3 = (void*)RSTRING_PTR(argv[2]);
1702
+ arg4 = RSTRING_LEN(argv[2]);
1704
1703
  arg5 = SQLITE_TRANSIENT;
1705
1704
  }
1706
1705
  result = (int)sqlite3_bind_blob(arg1,arg2,(void const *)arg3,arg4,arg5);
@@ -1763,7 +1762,7 @@ _wrap_sqlite3_bind_int64(int argc, VALUE *argv, VALUE self) {
1763
1762
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3_stmt, 0);
1764
1763
  arg2 = NUM2INT(argv[1]);
1765
1764
  {
1766
- arg3 = rb_big2ll( argv[2] );
1765
+ arg3 = rb_num2ll( argv[2] );
1767
1766
  }
1768
1767
  result = (int)sqlite3_bind_int64(arg1,arg2,arg3);
1769
1768
 
@@ -1805,8 +1804,8 @@ _wrap_sqlite3_bind_text(int argc, VALUE *argv, VALUE self) {
1805
1804
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3_stmt, 0);
1806
1805
  arg2 = NUM2INT(argv[1]);
1807
1806
  {
1808
- arg3 = RSTRING(argv[2])->ptr;
1809
- arg4 = RSTRING(argv[2])->len;
1807
+ arg3 = RSTRING_PTR(argv[2]);
1808
+ arg4 = RSTRING_LEN(argv[2]);
1810
1809
  arg5 = SQLITE_TRANSIENT;
1811
1810
  }
1812
1811
  result = (int)sqlite3_bind_text(arg1,arg2,(char const *)arg3,arg4,arg5);
@@ -1831,8 +1830,8 @@ _wrap_sqlite3_bind_text16(int argc, VALUE *argv, VALUE self) {
1831
1830
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3_stmt, 0);
1832
1831
  arg2 = NUM2INT(argv[1]);
1833
1832
  {
1834
- arg3 = (void*)RSTRING(argv[2])->ptr;
1835
- arg4 = RSTRING(argv[2])->len;
1833
+ arg3 = (void*)RSTRING_PTR(argv[2]);
1834
+ arg4 = RSTRING_LEN(argv[2]);
1836
1835
  arg5 = SQLITE_TRANSIENT;
1837
1836
  }
1838
1837
  result = (int)sqlite3_bind_text16(arg1,arg2,(void const *)arg3,arg4,arg5);
@@ -2036,14 +2035,14 @@ static VALUE
2036
2035
  _wrap_sqlite3_column_blob(int argc, VALUE *argv, VALUE self) {
2037
2036
  sqlite3_stmt *arg1 = (sqlite3_stmt *) 0 ;
2038
2037
  int arg2 ;
2039
- BLOB *result;
2038
+ RUBY_BLOB *result;
2040
2039
  VALUE vresult = Qnil;
2041
2040
 
2042
2041
  if ((argc < 2) || (argc > 2))
2043
2042
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc);
2044
2043
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3_stmt, 0);
2045
2044
  arg2 = NUM2INT(argv[1]);
2046
- result = (BLOB *)sqlite3_column_blob(arg1,arg2);
2045
+ result = (RUBY_BLOB *)sqlite3_column_blob(arg1,arg2);
2047
2046
 
2048
2047
  {
2049
2048
  vresult = result ?
@@ -2286,7 +2285,7 @@ _wrap_sqlite3_create_function16(int argc, VALUE *argv, VALUE self) {
2286
2285
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 8)",argc);
2287
2286
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3, 0);
2288
2287
  {
2289
- arg2 = (void*)RSTRING(argv[1])->ptr;
2288
+ arg2 = (void*)RSTRING_PTR(argv[1]);
2290
2289
  }
2291
2290
  arg3 = NUM2INT(argv[2]);
2292
2291
  arg4 = NUM2INT(argv[3]);
@@ -2320,13 +2319,13 @@ _wrap_sqlite3_aggregate_count(int argc, VALUE *argv, VALUE self) {
2320
2319
  static VALUE
2321
2320
  _wrap_sqlite3_value_blob(int argc, VALUE *argv, VALUE self) {
2322
2321
  sqlite3_value *arg1 = (sqlite3_value *) 0 ;
2323
- VALBLOB *result;
2322
+ RUBY_VALBLOB *result;
2324
2323
  VALUE vresult = Qnil;
2325
2324
 
2326
2325
  if ((argc < 1) || (argc > 1))
2327
2326
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
2328
2327
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3_value, 0);
2329
- result = (VALBLOB *)sqlite3_value_blob(arg1);
2328
+ result = (RUBY_VALBLOB *)sqlite3_value_blob(arg1);
2330
2329
 
2331
2330
  {
2332
2331
  vresult = result ? rb_str_new( (char*)result, sqlite3_value_bytes( arg1 ) ) : Qnil;
@@ -2528,8 +2527,8 @@ _wrap_sqlite3_result_blob(int argc, VALUE *argv, VALUE self) {
2528
2527
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc);
2529
2528
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3_context, 0);
2530
2529
  {
2531
- arg2 = (void*)RSTRING(argv[1])->ptr;
2532
- arg3 = RSTRING(argv[1])->len;
2530
+ arg2 = (void*)RSTRING_PTR(argv[1]);
2531
+ arg3 = RSTRING_LEN(argv[1]);
2533
2532
  arg4 = SQLITE_TRANSIENT;
2534
2533
  }
2535
2534
  sqlite3_result_blob(arg1,(void const *)arg2,arg3,arg4);
@@ -2563,8 +2562,8 @@ _wrap_sqlite3_result_error(int argc, VALUE *argv, VALUE self) {
2563
2562
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc);
2564
2563
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3_context, 0);
2565
2564
  {
2566
- arg2 = RSTRING(argv[1])->ptr;
2567
- arg3 = RSTRING(argv[1])->len;
2565
+ arg2 = RSTRING_PTR(argv[1]);
2566
+ arg3 = RSTRING_LEN(argv[1]);
2568
2567
  }
2569
2568
  sqlite3_result_error(arg1,(char const *)arg2,arg3);
2570
2569
 
@@ -2582,8 +2581,8 @@ _wrap_sqlite3_result_error16(int argc, VALUE *argv, VALUE self) {
2582
2581
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc);
2583
2582
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3_context, 0);
2584
2583
  {
2585
- arg2 = (void*)RSTRING(argv[1])->ptr;
2586
- arg3 = RSTRING(argv[1])->len;
2584
+ arg2 = (void*)RSTRING_PTR(argv[1]);
2585
+ arg3 = RSTRING_LEN(argv[1]);
2587
2586
  }
2588
2587
  sqlite3_result_error16(arg1,(void const *)arg2,arg3);
2589
2588
 
@@ -2615,7 +2614,7 @@ _wrap_sqlite3_result_int64(int argc, VALUE *argv, VALUE self) {
2615
2614
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc);
2616
2615
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3_context, 0);
2617
2616
  {
2618
- arg2 = rb_big2ll( argv[1] );
2617
+ arg2 = rb_num2ll( argv[1] );
2619
2618
  }
2620
2619
  sqlite3_result_int64(arg1,arg2);
2621
2620
 
@@ -2634,8 +2633,8 @@ _wrap_sqlite3_result_text(int argc, VALUE *argv, VALUE self) {
2634
2633
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc);
2635
2634
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3_context, 0);
2636
2635
  {
2637
- arg2 = RSTRING(argv[1])->ptr;
2638
- arg3 = RSTRING(argv[1])->len;
2636
+ arg2 = RSTRING_PTR(argv[1]);
2637
+ arg3 = RSTRING_LEN(argv[1]);
2639
2638
  arg4 = SQLITE_TRANSIENT;
2640
2639
  }
2641
2640
  sqlite3_result_text(arg1,(char const *)arg2,arg3,arg4);
@@ -2655,8 +2654,8 @@ _wrap_sqlite3_result_text16(int argc, VALUE *argv, VALUE self) {
2655
2654
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc);
2656
2655
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3_context, 0);
2657
2656
  {
2658
- arg2 = (void*)RSTRING(argv[1])->ptr;
2659
- arg3 = RSTRING(argv[1])->len;
2657
+ arg2 = (void*)RSTRING_PTR(argv[1]);
2658
+ arg3 = RSTRING_LEN(argv[1]);
2660
2659
  arg4 = SQLITE_TRANSIENT;
2661
2660
  }
2662
2661
  sqlite3_result_text16(arg1,(void const *)arg2,arg3,arg4);
@@ -2676,8 +2675,8 @@ _wrap_sqlite3_result_text16le(int argc, VALUE *argv, VALUE self) {
2676
2675
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc);
2677
2676
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3_context, 0);
2678
2677
  {
2679
- arg2 = (void*)RSTRING(argv[1])->ptr;
2680
- arg3 = RSTRING(argv[1])->len;
2678
+ arg2 = (void*)RSTRING_PTR(argv[1]);
2679
+ arg3 = RSTRING_LEN(argv[1]);
2681
2680
  arg4 = SQLITE_TRANSIENT;
2682
2681
  }
2683
2682
  sqlite3_result_text16le(arg1,(void const *)arg2,arg3,arg4);
@@ -2697,8 +2696,8 @@ _wrap_sqlite3_result_text16be(int argc, VALUE *argv, VALUE self) {
2697
2696
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc);
2698
2697
  SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_sqlite3_context, 0);
2699
2698
  {
2700
- arg2 = (void*)RSTRING(argv[1])->ptr;
2701
- arg3 = RSTRING(argv[1])->len;
2699
+ arg2 = (void*)RSTRING_PTR(argv[1]);
2700
+ arg3 = RSTRING_LEN(argv[1]);
2702
2701
  arg4 = SQLITE_TRANSIENT;
2703
2702
  }
2704
2703
  sqlite3_result_text16be(arg1,(void const *)arg2,arg3,arg4);
@@ -2764,7 +2763,7 @@ static swig_type_info _swigt__p_sqlite3_stmt = {"_p_sqlite3_stmt", "sqlite3_stmt
2764
2763
  static swig_type_info _swigt__p_sqlite3_value = {"_p_sqlite3_value", "sqlite3_value *", 0, 0, 0};
2765
2764
  static swig_type_info _swigt__p_sqlite_int64 = {"_p_sqlite_int64", "sqlite_int64 *", 0, 0, 0};
2766
2765
  static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "unsigned long *|VALUE *", 0, 0, 0};
2767
- static swig_type_info _swigt__p_void = {"_p_void", "void *|VALBLOB *", 0, 0, 0};
2766
+ static swig_type_info _swigt__p_void = {"_p_void", "void *|RUBY_VALBLOB *", 0, 0, 0};
2768
2767
 
2769
2768
  static swig_type_info *swig_type_initial[] = {
2770
2769
  &_swigt__p_CallbackData,