amalgalite 0.15.0-x86-mswin32 → 1.0.0-x86-mswin32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. data/{HISTORY → HISTORY.rdoc} +15 -1
  2. data/{README → README.rdoc} +2 -1
  3. data/examples/filestore.db +0 -0
  4. data/examples/gems.db +0 -0
  5. data/ext/amalgalite/amalgalite3.c +1 -1
  6. data/ext/amalgalite/amalgalite3_blob.c +1 -1
  7. data/ext/amalgalite/amalgalite3_constants.c +157 -0
  8. data/ext/amalgalite/amalgalite3_database.c +7 -7
  9. data/ext/amalgalite/amalgalite3_requires_bootstrap.c +11 -12
  10. data/ext/amalgalite/amalgalite3_statement.c +3 -3
  11. data/ext/amalgalite/extconf.rb +17 -20
  12. data/ext/amalgalite/gen_constants.rb +84 -25
  13. data/ext/amalgalite/sqlite3.c +3379 -1146
  14. data/ext/amalgalite/sqlite3.h +87 -12
  15. data/ext/amalgalite/sqlite3ext.h +42 -0
  16. data/gemspec.rb +9 -9
  17. data/lib/amalgalite/1.8/amalgalite3.so +0 -0
  18. data/lib/amalgalite/1.9/amalgalite3.so +0 -0
  19. data/lib/amalgalite/csv_table_importer.rb +7 -2
  20. data/lib/amalgalite/database.rb +1 -1
  21. data/lib/amalgalite/paths.rb +10 -0
  22. data/lib/amalgalite/sqlite3/constants.rb +20 -5
  23. data/lib/amalgalite/version.rb +2 -2
  24. data/spec/database_spec.rb +0 -2
  25. data/spec/default_map_spec.rb +0 -3
  26. data/spec/requires_spec.rb +0 -3
  27. data/spec/rtree_spec.rb +1 -3
  28. data/spec/schema_spec.rb +1 -4
  29. data/spec/spec_helper.rb +7 -5
  30. data/spec/sqlite3/constants_spec.rb +52 -9
  31. data/spec/sqlite3/database_status_spec.rb +1 -1
  32. data/spec/sqlite3/version_spec.rb +5 -5
  33. data/spec/storage_map_spec.rb +1 -4
  34. data/spec/tap_spec.rb +1 -3
  35. data/spec/text_map_spec.rb +1 -4
  36. data/spec/type_map_spec.rb +1 -4
  37. data/tasks/announce.rake +9 -9
  38. data/tasks/config.rb +18 -18
  39. data/tasks/extension.rake +37 -20
  40. data/tasks/rspec.rake +7 -10
  41. metadata +40 -42
  42. data/tasks/rubyforge.rake +0 -59
@@ -1,4 +1,18 @@
1
1
  = Amalgalite Changelog
2
+ == Version 1.0.0 - 2011-01-16
3
+
4
+ === Enhancements
5
+
6
+ * Update to 1.0.0
7
+ * Update to SQLite 3.7.4
8
+ * Update all runtime and development dependencies to the latest version
9
+
10
+ === Bug Fixes
11
+
12
+ * Fix FasterCSV/CSV compatibility issues with ruby 1.8/1.9 [github issue #4]
13
+ * Fix building issues for Ruby 1.9 [gitHub issue #5]
14
+ * Fix cross compilation problems when using rvm
15
+
2
16
  == Version 0.15.0 - 2010-10-30
3
17
 
4
18
  === Enhancements
@@ -9,7 +23,7 @@
9
23
 
10
24
  === Bug Fixes
11
25
 
12
- * Unable to run specs from gem [GH-3]
26
+ * Unable to run specs from gem [GH Issue #3]
13
27
 
14
28
  == Version 0.12.1 - 2010-02-17
15
29
 
@@ -4,6 +4,7 @@
4
4
  * {Rubyforge Project}[http://rubyforge.org/projects/copiousfreetime/]
5
5
  * email jeremy at copiousfreetime dot org
6
6
  * git clone url git://github.com/copiousfreetime/amalgalite.git
7
+ * {Github}[http://github.com/copiousfreetime/amalgalite/]
7
8
 
8
9
  == Articles
9
10
 
@@ -40,7 +41,7 @@ Amalgalite adds in the following additional non-default SQLite extension(s):
40
41
 
41
42
  == CHANGES
42
43
 
43
- Read the HISTORY file.
44
+ Read the HISTORY.rdoc file.
44
45
 
45
46
  == LICENSE
46
47
 
Binary file
data/examples/gems.db CHANGED
Binary file
@@ -81,7 +81,7 @@ VALUE am_sqlite3_set_temp_directory( VALUE self, VALUE new_dir )
81
81
  return Qnil;
82
82
  }
83
83
 
84
- VALUE amalgalite_format_string( char* pattern, VALUE string )
84
+ VALUE amalgalite_format_string( const char* pattern, VALUE string )
85
85
  {
86
86
  VALUE to_s= rb_funcall( string, rb_intern("to_s"), 0 );
87
87
  VALUE str = StringValue( to_s );
@@ -161,7 +161,7 @@ VALUE am_sqlite3_blob_write( VALUE self, VALUE buf )
161
161
  am_sqlite3_blob *am_blob;
162
162
  int rc;
163
163
  VALUE str = StringValue( buf );
164
- int n = RSTRING_LEN( str );
164
+ int n = (int)RSTRING_LEN( str );
165
165
  char *chk_buf = NULL;
166
166
 
167
167
  Data_Get_Struct(self, am_sqlite3_blob, am_blob);
@@ -16,14 +16,76 @@ void Init_amalgalite3_constants( )
16
16
  * module encapsulating all the SQLite C extension constants
17
17
  */
18
18
  VALUE mC = rb_define_module_under( mas, "Constants");
19
+ /**
20
+ * module encapsulating the SQLite3 C extension constants for Config
21
+ */
22
+ VALUE mC_Config = rb_define_module_under(mC, "Config");
23
+
24
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
25
+ rb_define_const(mC_Config, "GETMALLOC", INT2FIX(SQLITE_CONFIG_GETMALLOC));
26
+
27
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
28
+ rb_define_const(mC_Config, "GETMUTEX", INT2FIX(SQLITE_CONFIG_GETMUTEX));
29
+
30
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
31
+ rb_define_const(mC_Config, "GETPCACHE", INT2FIX(SQLITE_CONFIG_GETPCACHE));
32
+
33
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
34
+ rb_define_const(mC_Config, "HEAP", INT2FIX(SQLITE_CONFIG_HEAP));
35
+
36
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
37
+ rb_define_const(mC_Config, "LOG", INT2FIX(SQLITE_CONFIG_LOG));
38
+
39
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
40
+ rb_define_const(mC_Config, "LOOKASIDE", INT2FIX(SQLITE_CONFIG_LOOKASIDE));
41
+
42
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
43
+ rb_define_const(mC_Config, "MALLOC", INT2FIX(SQLITE_CONFIG_MALLOC));
44
+
45
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
46
+ rb_define_const(mC_Config, "MEMSTATUS", INT2FIX(SQLITE_CONFIG_MEMSTATUS));
47
+
48
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
49
+ rb_define_const(mC_Config, "MULTITHREAD", INT2FIX(SQLITE_CONFIG_MULTITHREAD));
50
+
51
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
52
+ rb_define_const(mC_Config, "MUTEX", INT2FIX(SQLITE_CONFIG_MUTEX));
53
+
54
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
55
+ rb_define_const(mC_Config, "PAGECACHE", INT2FIX(SQLITE_CONFIG_PAGECACHE));
56
+
57
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
58
+ rb_define_const(mC_Config, "PCACHE", INT2FIX(SQLITE_CONFIG_PCACHE));
59
+
60
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
61
+ rb_define_const(mC_Config, "SCRATCH", INT2FIX(SQLITE_CONFIG_SCRATCH));
62
+
63
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
64
+ rb_define_const(mC_Config, "SERIALIZED", INT2FIX(SQLITE_CONFIG_SERIALIZED));
65
+
66
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
67
+ rb_define_const(mC_Config, "SINGLETHREAD", INT2FIX(SQLITE_CONFIG_SINGLETHREAD));
68
+
19
69
  /**
20
70
  * module encapsulating the SQLite3 C extension constants for DBStatus
21
71
  */
22
72
  VALUE mC_DBStatus = rb_define_module_under(mC, "DBStatus");
23
73
 
74
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
75
+ rb_define_const(mC_DBStatus, "CACHE_USED", INT2FIX(SQLITE_DBSTATUS_CACHE_USED));
76
+
24
77
  /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
25
78
  rb_define_const(mC_DBStatus, "LOOKASIDE_USED", INT2FIX(SQLITE_DBSTATUS_LOOKASIDE_USED));
26
79
 
80
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
81
+ rb_define_const(mC_DBStatus, "MAX", INT2FIX(SQLITE_DBSTATUS_MAX));
82
+
83
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
84
+ rb_define_const(mC_DBStatus, "SCHEMA_USED", INT2FIX(SQLITE_DBSTATUS_SCHEMA_USED));
85
+
86
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
87
+ rb_define_const(mC_DBStatus, "STMT_USED", INT2FIX(SQLITE_DBSTATUS_STMT_USED));
88
+
27
89
  /**
28
90
  * module encapsulating the SQLite3 C extension constants for DataType
29
91
  */
@@ -49,15 +111,60 @@ void Init_amalgalite3_constants( )
49
111
  */
50
112
  VALUE mC_Open = rb_define_module_under(mC, "Open");
51
113
 
114
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
115
+ rb_define_const(mC_Open, "AUTOPROXY", INT2FIX(SQLITE_OPEN_AUTOPROXY));
116
+
52
117
  /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
53
118
  rb_define_const(mC_Open, "CREATE", INT2FIX(SQLITE_OPEN_CREATE));
54
119
 
120
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
121
+ rb_define_const(mC_Open, "DELETEONCLOSE", INT2FIX(SQLITE_OPEN_DELETEONCLOSE));
122
+
123
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
124
+ rb_define_const(mC_Open, "EXCLUSIVE", INT2FIX(SQLITE_OPEN_EXCLUSIVE));
125
+
126
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
127
+ rb_define_const(mC_Open, "FULLMUTEX", INT2FIX(SQLITE_OPEN_FULLMUTEX));
128
+
129
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
130
+ rb_define_const(mC_Open, "MAIN_DB", INT2FIX(SQLITE_OPEN_MAIN_DB));
131
+
132
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
133
+ rb_define_const(mC_Open, "MAIN_JOURNAL", INT2FIX(SQLITE_OPEN_MAIN_JOURNAL));
134
+
135
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
136
+ rb_define_const(mC_Open, "MASTER_JOURNAL", INT2FIX(SQLITE_OPEN_MASTER_JOURNAL));
137
+
138
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
139
+ rb_define_const(mC_Open, "NOMUTEX", INT2FIX(SQLITE_OPEN_NOMUTEX));
140
+
141
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
142
+ rb_define_const(mC_Open, "PRIVATECACHE", INT2FIX(SQLITE_OPEN_PRIVATECACHE));
143
+
55
144
  /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
56
145
  rb_define_const(mC_Open, "READONLY", INT2FIX(SQLITE_OPEN_READONLY));
57
146
 
58
147
  /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
59
148
  rb_define_const(mC_Open, "READWRITE", INT2FIX(SQLITE_OPEN_READWRITE));
60
149
 
150
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
151
+ rb_define_const(mC_Open, "SHAREDCACHE", INT2FIX(SQLITE_OPEN_SHAREDCACHE));
152
+
153
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
154
+ rb_define_const(mC_Open, "SUBJOURNAL", INT2FIX(SQLITE_OPEN_SUBJOURNAL));
155
+
156
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
157
+ rb_define_const(mC_Open, "TEMP_DB", INT2FIX(SQLITE_OPEN_TEMP_DB));
158
+
159
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
160
+ rb_define_const(mC_Open, "TEMP_JOURNAL", INT2FIX(SQLITE_OPEN_TEMP_JOURNAL));
161
+
162
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
163
+ rb_define_const(mC_Open, "TRANSIENT_DB", INT2FIX(SQLITE_OPEN_TRANSIENT_DB));
164
+
165
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
166
+ rb_define_const(mC_Open, "WAL", INT2FIX(SQLITE_OPEN_WAL));
167
+
61
168
  /**
62
169
  * module encapsulating the SQLite3 C extension constants for ResultCode
63
170
  */
@@ -72,9 +179,15 @@ void Init_amalgalite3_constants( )
72
179
  /* 5 -- The database file is locked */
73
180
  rb_define_const(mC_ResultCode, "BUSY", INT2FIX(SQLITE_BUSY));
74
181
 
182
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
183
+ rb_define_const(mC_ResultCode, "BUSY_RECOVERY", INT2FIX(SQLITE_BUSY_RECOVERY));
184
+
75
185
  /* 14 -- Unable to open the database file */
76
186
  rb_define_const(mC_ResultCode, "CANTOPEN", INT2FIX(SQLITE_CANTOPEN));
77
187
 
188
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
189
+ rb_define_const(mC_ResultCode, "CANTOPEN_NOTEMPDIR", INT2FIX(SQLITE_CANTOPEN_NOTEMPDIR));
190
+
78
191
  /* 19 -- Abort due to constraint violation */
79
192
  rb_define_const(mC_ResultCode, "CONSTRAINT", INT2FIX(SQLITE_CONSTRAINT));
80
193
 
@@ -105,12 +218,24 @@ void Init_amalgalite3_constants( )
105
218
  /* 10 -- Some kind of disk I/O error occurred */
106
219
  rb_define_const(mC_ResultCode, "IOERR", INT2FIX(SQLITE_IOERR));
107
220
 
221
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
222
+ rb_define_const(mC_ResultCode, "IOERR_ACCESS", INT2FIX(SQLITE_IOERR_ACCESS));
223
+
108
224
  /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
109
225
  rb_define_const(mC_ResultCode, "IOERR_BLOCKED", INT2FIX(SQLITE_IOERR_BLOCKED));
110
226
 
227
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
228
+ rb_define_const(mC_ResultCode, "IOERR_CHECKRESERVEDLOCK", INT2FIX(SQLITE_IOERR_CHECKRESERVEDLOCK));
229
+
230
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
231
+ rb_define_const(mC_ResultCode, "IOERR_CLOSE", INT2FIX(SQLITE_IOERR_CLOSE));
232
+
111
233
  /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
112
234
  rb_define_const(mC_ResultCode, "IOERR_DELETE", INT2FIX(SQLITE_IOERR_DELETE));
113
235
 
236
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
237
+ rb_define_const(mC_ResultCode, "IOERR_DIR_CLOSE", INT2FIX(SQLITE_IOERR_DIR_CLOSE));
238
+
114
239
  /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
115
240
  rb_define_const(mC_ResultCode, "IOERR_DIR_FSYNC", INT2FIX(SQLITE_IOERR_DIR_FSYNC));
116
241
 
@@ -120,6 +245,9 @@ void Init_amalgalite3_constants( )
120
245
  /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
121
246
  rb_define_const(mC_ResultCode, "IOERR_FSYNC", INT2FIX(SQLITE_IOERR_FSYNC));
122
247
 
248
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
249
+ rb_define_const(mC_ResultCode, "IOERR_LOCK", INT2FIX(SQLITE_IOERR_LOCK));
250
+
123
251
  /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
124
252
  rb_define_const(mC_ResultCode, "IOERR_NOMEM", INT2FIX(SQLITE_IOERR_NOMEM));
125
253
 
@@ -129,6 +257,15 @@ void Init_amalgalite3_constants( )
129
257
  /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
130
258
  rb_define_const(mC_ResultCode, "IOERR_READ", INT2FIX(SQLITE_IOERR_READ));
131
259
 
260
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
261
+ rb_define_const(mC_ResultCode, "IOERR_SHMLOCK", INT2FIX(SQLITE_IOERR_SHMLOCK));
262
+
263
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
264
+ rb_define_const(mC_ResultCode, "IOERR_SHMOPEN", INT2FIX(SQLITE_IOERR_SHMOPEN));
265
+
266
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
267
+ rb_define_const(mC_ResultCode, "IOERR_SHMSIZE", INT2FIX(SQLITE_IOERR_SHMSIZE));
268
+
132
269
  /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
133
270
  rb_define_const(mC_ResultCode, "IOERR_SHORT_READ", INT2FIX(SQLITE_IOERR_SHORT_READ));
134
271
 
@@ -144,6 +281,9 @@ void Init_amalgalite3_constants( )
144
281
  /* 6 -- A table in the database is locked */
145
282
  rb_define_const(mC_ResultCode, "LOCKED", INT2FIX(SQLITE_LOCKED));
146
283
 
284
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
285
+ rb_define_const(mC_ResultCode, "LOCKED_SHAREDCACHE", INT2FIX(SQLITE_LOCKED_SHAREDCACHE));
286
+
147
287
  /* 20 -- Data type mismatch */
148
288
  rb_define_const(mC_ResultCode, "MISMATCH", INT2FIX(SQLITE_MISMATCH));
149
289
 
@@ -186,11 +326,28 @@ void Init_amalgalite3_constants( )
186
326
  /* 18 -- String or BLOB exceeds size limit */
187
327
  rb_define_const(mC_ResultCode, "TOOBIG", INT2FIX(SQLITE_TOOBIG));
188
328
 
329
+ /**
330
+ * module encapsulating the SQLite3 C extension constants for StatementStatus
331
+ */
332
+ VALUE mC_StatementStatus = rb_define_module_under(mC, "StatementStatus");
333
+
334
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
335
+ rb_define_const(mC_StatementStatus, "AUTOINDEX", INT2FIX(SQLITE_STMTSTATUS_AUTOINDEX));
336
+
337
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
338
+ rb_define_const(mC_StatementStatus, "FULLSCAN_STEP", INT2FIX(SQLITE_STMTSTATUS_FULLSCAN_STEP));
339
+
340
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
341
+ rb_define_const(mC_StatementStatus, "SORT", INT2FIX(SQLITE_STMTSTATUS_SORT));
342
+
189
343
  /**
190
344
  * module encapsulating the SQLite3 C extension constants for Status
191
345
  */
192
346
  VALUE mC_Status = rb_define_module_under(mC, "Status");
193
347
 
348
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
349
+ rb_define_const(mC_Status, "MALLOC_COUNT", INT2FIX(SQLITE_STATUS_MALLOC_COUNT));
350
+
194
351
  /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
195
352
  rb_define_const(mC_Status, "MALLOC_SIZE", INT2FIX(SQLITE_STATUS_MALLOC_SIZE));
196
353
 
@@ -282,7 +282,7 @@ VALUE am_sqlite3_database_prepare(VALUE self, VALUE rSQL)
282
282
  Data_Get_Struct(self, am_sqlite3, am_db);
283
283
 
284
284
  Data_Get_Struct(stmt, am_sqlite3_stmt, am_stmt);
285
- rc = sqlite3_prepare_v2( am_db->db, RSTRING_PTR(sql), RSTRING_LEN(sql),
285
+ rc = sqlite3_prepare_v2( am_db->db, RSTRING_PTR(sql), (int)RSTRING_LEN(sql),
286
286
  &(am_stmt->stmt), &tail);
287
287
  if ( SQLITE_OK != rc) {
288
288
  rb_raise(eAS_Error, "Failure to prepare statement %s : [SQLITE_ERROR %d] : %s\n",
@@ -445,7 +445,7 @@ void amalgalite_set_context_result( sqlite3_context* context, VALUE result )
445
445
  sqlite3_result_int64( context, 0);
446
446
  break;
447
447
  case T_STRING:
448
- sqlite3_result_text( context, RSTRING_PTR(result), RSTRING_LEN(result), NULL);
448
+ sqlite3_result_text( context, RSTRING_PTR(result), (int)RSTRING_LEN(result), NULL);
449
449
  break;
450
450
  default:
451
451
  sqlite3_result_error( context, "Unable to convert ruby object to an SQL function result", -1 );
@@ -652,7 +652,7 @@ void amalgalite_xFunc( sqlite3_context* context, int argc, sqlite3_value** argv
652
652
  /* check the results */
653
653
  if ( state ) {
654
654
  VALUE msg = ERROR_INFO_MESSAGE();
655
- sqlite3_result_error( context, RSTRING_PTR(msg), RSTRING_LEN(msg) );
655
+ sqlite3_result_error( context, RSTRING_PTR(msg), (int)RSTRING_LEN(msg) );
656
656
  } else {
657
657
  amalgalite_set_context_result( context, result );
658
658
  }
@@ -771,7 +771,7 @@ void amalgalite_xStep( sqlite3_context* context, int argc, sqlite3_value** argv
771
771
  rb_gc_register_address( aggregate_context );
772
772
  if ( state ) {
773
773
  VALUE msg = ERROR_INFO_MESSAGE();
774
- sqlite3_result_error( context, RSTRING_PTR(msg), RSTRING_LEN(msg));
774
+ sqlite3_result_error( context, RSTRING_PTR(msg), (int)RSTRING_LEN(msg));
775
775
  rb_iv_set( *aggregate_context, "@_exception", rb_gv_get("$!" ));
776
776
  return;
777
777
  } else {
@@ -797,7 +797,7 @@ void amalgalite_xStep( sqlite3_context* context, int argc, sqlite3_value** argv
797
797
  /* check the results, if there is an error, set the @exception ivar */
798
798
  if ( state ) {
799
799
  VALUE msg = ERROR_INFO_MESSAGE();
800
- sqlite3_result_error( context, RSTRING_PTR(msg), RSTRING_LEN(msg));
800
+ sqlite3_result_error( context, RSTRING_PTR(msg), (int)RSTRING_LEN(msg));
801
801
  rb_iv_set( *aggregate_context, "@_exception", rb_gv_get("$!" ));
802
802
  }
803
803
 
@@ -832,13 +832,13 @@ void amalgalite_xFinal( sqlite3_context* context )
832
832
  /* check the results */
833
833
  if ( state ) {
834
834
  VALUE msg = ERROR_INFO_MESSAGE();
835
- sqlite3_result_error( context, RSTRING_PTR(msg), RSTRING_LEN(msg) );
835
+ sqlite3_result_error( context, RSTRING_PTR(msg), (int)RSTRING_LEN(msg) );
836
836
  } else {
837
837
  amalgalite_set_context_result( context, result );
838
838
  }
839
839
  } else {
840
840
  VALUE msg = rb_obj_as_string( exception );
841
- sqlite3_result_error( context, RSTRING_PTR(msg), RSTRING_LEN(msg) );
841
+ sqlite3_result_error( context, RSTRING_PTR(msg), (int)RSTRING_LEN(msg) );
842
842
  }
843
843
 
844
844
 
@@ -14,18 +14,17 @@ VALUE eARB_Error;
14
14
 
15
15
  /*
16
16
  * cleanup the datatbase and statment values if they are currently open and then
17
- * raise the message. It converts the error message to a String so that the C
18
- * string can be free'd and then raise with a ruby object in the hopes that
19
- * there is no memory leak from the C allocation.
17
+ * raise the message. It is assumed that the *msg pointer passed in is NOT
18
+ * allocated via malloc() or the like. It should be a local static buffer
19
+ * that we do not have to worry about freeing.
20
20
  */
21
- void am_bootstrap_cleanup_and_raise( char* msg, sqlite3* db, sqlite3_stmt* stmt )
21
+ void am_bootstrap_cleanup_and_raise( const char* msg, sqlite3* db, sqlite3_stmt* stmt )
22
22
  {
23
23
 
24
24
  if ( NULL != stmt ) { sqlite3_finalize( stmt ); stmt = NULL; }
25
25
  if ( NULL != db ) { sqlite3_close( db ); }
26
26
 
27
- free( msg );
28
- rb_raise(eARB_Error, msg );
27
+ rb_raise(eARB_Error, "%s", msg );
29
28
  }
30
29
 
31
30
 
@@ -68,13 +67,13 @@ VALUE am_bootstrap_lift( VALUE self, VALUE args )
68
67
  int last_row_good;
69
68
  char raise_msg[BUFSIZ];
70
69
 
71
- VALUE am_db_c = rb_const_get( cARB, rb_intern("DEFAULT_DB") );
72
- VALUE am_tbl_c = rb_const_get( cARB, rb_intern("DEFAULT_BOOTSTRAP_TABLE") );
73
- VALUE am_pk_c = rb_const_get( cARB, rb_intern("DEFAULT_ROWID_COLUMN") );
74
- VALUE am_fname_c = rb_const_get( cARB, rb_intern("DEFAULT_FILENAME_COLUMN") );
75
- VALUE am_content_c = rb_const_get( cARB, rb_intern("DEFAULT_CONTENTS_COLUMN") );
70
+ VALUE am_db_c = rb_const_get( cARB, rb_intern("DEFAULT_DB") );
71
+ VALUE am_tbl_c = rb_const_get( cARB, rb_intern("DEFAULT_BOOTSTRAP_TABLE") );
72
+ VALUE am_pk_c = rb_const_get( cARB, rb_intern("DEFAULT_ROWID_COLUMN") );
73
+ VALUE am_fname_c = rb_const_get( cARB, rb_intern("DEFAULT_FILENAME_COLUMN") );
74
+ VALUE am_content_c = rb_const_get( cARB, rb_intern("DEFAULT_CONTENTS_COLUMN") );
76
75
 
77
- char* dbfile = NULL;
76
+ char* dbfile = NULL;
78
77
  char* tbl_name = NULL;
79
78
  char* pk_col = NULL;
80
79
  char* fname_col = NULL;
@@ -43,7 +43,7 @@ VALUE am_sqlite3_statement_bind_zeroblob( VALUE self, VALUE position, VALUE leng
43
43
  {
44
44
  am_sqlite3_stmt *am_stmt;
45
45
  int pos = FIX2INT( position );
46
- int n = FIX2INT( length );
46
+ int n = (int)FIX2INT( length );
47
47
  int rc;
48
48
 
49
49
  Data_Get_Struct(self, am_sqlite3_stmt, am_stmt);
@@ -73,7 +73,7 @@ VALUE am_sqlite3_statement_bind_blob( VALUE self, VALUE position, VALUE blob )
73
73
  int rc;
74
74
 
75
75
  Data_Get_Struct(self, am_sqlite3_stmt, am_stmt);
76
- rc = sqlite3_bind_blob( am_stmt->stmt, pos, RSTRING_PTR( str ), RSTRING_LEN( str ), SQLITE_TRANSIENT);
76
+ rc = sqlite3_bind_blob( am_stmt->stmt, pos, RSTRING_PTR( str ), (int)RSTRING_LEN( str ), SQLITE_TRANSIENT);
77
77
  if ( SQLITE_OK != rc ) {
78
78
  rb_raise(eAS_Error, "Error binding blob at position %d in statement: [SQLITE_ERROR %d] : %s\n",
79
79
  pos,
@@ -173,7 +173,7 @@ VALUE am_sqlite3_statement_bind_text(VALUE self, VALUE position, VALUE value)
173
173
  int rc;
174
174
 
175
175
  Data_Get_Struct(self, am_sqlite3_stmt, am_stmt);
176
- rc = sqlite3_bind_text( am_stmt->stmt, pos, RSTRING_PTR(str), RSTRING_LEN(str), SQLITE_TRANSIENT);
176
+ rc = sqlite3_bind_text( am_stmt->stmt, pos, RSTRING_PTR(str), (int)RSTRING_LEN(str), SQLITE_TRANSIENT);
177
177
  if ( SQLITE_OK != rc ) {
178
178
  rb_raise(eAS_Error, "Error binding [%s] to text at position %d in statement: [SQLITE_ERROR %d] : %s\n",
179
179
  RSTRING_PTR(str), pos,
@@ -1,36 +1,33 @@
1
1
  require 'mkmf'
2
2
  require 'rbconfig'
3
3
 
4
+ # used by the ext:build_win-1.x.x tasks, really no one else but jeremy should be
5
+ # using this hack
6
+ $ruby = ARGV.shift if ARGV[0]
7
+
4
8
  # make available table and column meta data api
5
9
  $CFLAGS += " -DSQLITE_ENABLE_COLUMN_METADATA=1"
6
10
  $CFLAGS += " -DSQLITE_ENABLE_RTREE=1"
7
11
 
8
12
  # we compile sqlite the same way that the installation of ruby is compiled.
9
- if Config::CONFIG['configure_args'].include?( "--enable-pthread" ) then
13
+ if RbConfig::MAKEFILE_CONFIG['configure_args'].include?( "--enable-pthread" ) then
10
14
  $CFLAGS += " -DSQLITE_THREADSAFE=1"
11
15
  else
12
16
  $CFLAGS += " -DSQLITE_THREADSAFE=0"
13
17
  end
14
18
 
15
- # remove the -g if it exists
16
- $CFLAGS = $CFLAGS.gsub(/-g/,'')
17
-
18
- # remove -Wall if it exists
19
- $CFLAGS = $CFLAGS.gsub(/-Wall/,'')
20
- #$CFLAGS += " -Wall"
21
-
22
- # there are issues with the mingw compiler and compiling sqlite with debugging
23
- # on. You will get lots of warnings of the sort
24
- #
25
- # Warning: .stabs: description field '16274' too big, try a different debug format
26
- #
27
- # it appears to be a known issue and has no affect on the normal usage of sqlite
28
- #
29
- # warnflags and debugflags appear to be 1.9 constructs
30
- #
31
- if CONFIG['arch'] =~ /(mswin|mingw)/i then
32
- CONFIG['debugflags'] = CONFIG['debugflags'].gsub(/-g/,'') if CONFIG['debugflags']
33
- CONFIG['warnflags'] = CONFIG['warnflags'].gsub(/-Wall/,'') if CONFIG['warnflags']
19
+ # remove the -g flags if it exists
20
+ %w[ -ggdb -g ].each do |debug|
21
+ $CFLAGS = $CFLAGS.gsub(/#{debug}/,'')
22
+ RbConfig::MAKEFILE_CONFIG['debugflags'] = Config::MAKEFILE_CONFIG['debugflags'].gsub(/#{debug}/,'') if Config::MAKEFILE_CONFIG['debugflags']
23
+ end
24
+
25
+ %w[ shorten-64-to-32 write-strings ].each do |warning|
26
+ $CFLAGS = $CFLAGS.gsub(/-W#{warning}/,'')
27
+ Config::MAKEFILE_CONFIG['warnflags'] = Config::MAKEFILE_CONFIG['warnflags'].gsub(/-W#{warning}/,'') if Config::MAKEFILE_CONFIG['warnflags']
34
28
  end
29
+
30
+
31
+
35
32
  subdir = RUBY_VERSION.sub(/\.\d$/,'')
36
33
  create_makefile("amalgalite/#{subdir}/amalgalite3")