amalgalite 0.4.2-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. data/HISTORY +81 -0
  2. data/LICENSE +29 -0
  3. data/README +40 -0
  4. data/bin/amalgalite-pack-into-db +155 -0
  5. data/examples/a.rb +9 -0
  6. data/examples/blob.rb +105 -0
  7. data/examples/bootstrap.rb +36 -0
  8. data/examples/gem-db.rb +94 -0
  9. data/examples/requires.rb +54 -0
  10. data/examples/schema-info.rb +34 -0
  11. data/ext/amalgalite3.c +201 -0
  12. data/ext/amalgalite3.h +121 -0
  13. data/ext/amalgalite3_blob.c +241 -0
  14. data/ext/amalgalite3_constants.c +221 -0
  15. data/ext/amalgalite3_database.c +550 -0
  16. data/ext/amalgalite3_requires_bootstrap.c +210 -0
  17. data/ext/amalgalite3_statement.c +628 -0
  18. data/ext/extconf.rb +19 -0
  19. data/ext/gen_constants.rb +130 -0
  20. data/ext/rbconfig-mingw.rb +178 -0
  21. data/ext/sqlite3.c +97092 -0
  22. data/ext/sqlite3.h +6364 -0
  23. data/ext/sqlite3_options.h +4 -0
  24. data/ext/sqlite3ext.h +372 -0
  25. data/gemspec.rb +55 -0
  26. data/lib/amalgalite.rb +33 -0
  27. data/lib/amalgalite/blob.rb +186 -0
  28. data/lib/amalgalite/boolean.rb +42 -0
  29. data/lib/amalgalite/column.rb +86 -0
  30. data/lib/amalgalite/core_ext/kernel/require.rb +14 -0
  31. data/lib/amalgalite/database.rb +514 -0
  32. data/lib/amalgalite/index.rb +43 -0
  33. data/lib/amalgalite/paths.rb +70 -0
  34. data/lib/amalgalite/profile_tap.rb +130 -0
  35. data/lib/amalgalite/requires.rb +112 -0
  36. data/lib/amalgalite/schema.rb +115 -0
  37. data/lib/amalgalite/sqlite3.rb +6 -0
  38. data/lib/amalgalite/sqlite3/constants.rb +82 -0
  39. data/lib/amalgalite/sqlite3/database/status.rb +69 -0
  40. data/lib/amalgalite/sqlite3/status.rb +61 -0
  41. data/lib/amalgalite/sqlite3/version.rb +38 -0
  42. data/lib/amalgalite/statement.rb +394 -0
  43. data/lib/amalgalite/table.rb +36 -0
  44. data/lib/amalgalite/taps.rb +2 -0
  45. data/lib/amalgalite/taps/console.rb +27 -0
  46. data/lib/amalgalite/taps/io.rb +71 -0
  47. data/lib/amalgalite/trace_tap.rb +35 -0
  48. data/lib/amalgalite/type_map.rb +63 -0
  49. data/lib/amalgalite/type_maps/default_map.rb +167 -0
  50. data/lib/amalgalite/type_maps/storage_map.rb +41 -0
  51. data/lib/amalgalite/type_maps/text_map.rb +23 -0
  52. data/lib/amalgalite/version.rb +37 -0
  53. data/lib/amalgalite/view.rb +26 -0
  54. data/lib/amalgalite3.so +0 -0
  55. data/spec/amalgalite_spec.rb +4 -0
  56. data/spec/blob_spec.rb +81 -0
  57. data/spec/boolean_spec.rb +23 -0
  58. data/spec/database_spec.rb +238 -0
  59. data/spec/default_map_spec.rb +87 -0
  60. data/spec/integeration_spec.rb +111 -0
  61. data/spec/paths_spec.rb +28 -0
  62. data/spec/schema_spec.rb +60 -0
  63. data/spec/spec_helper.rb +25 -0
  64. data/spec/sqlite3/constants_spec.rb +65 -0
  65. data/spec/sqlite3/database_status_spec.rb +36 -0
  66. data/spec/sqlite3/status_spec.rb +18 -0
  67. data/spec/sqlite3/version_spec.rb +14 -0
  68. data/spec/sqlite3_spec.rb +23 -0
  69. data/spec/statement_spec.rb +134 -0
  70. data/spec/storage_map_spec.rb +41 -0
  71. data/spec/tap_spec.rb +59 -0
  72. data/spec/text_map_spec.rb +23 -0
  73. data/spec/type_map_spec.rb +17 -0
  74. data/spec/version_spec.rb +9 -0
  75. data/tasks/announce.rake +39 -0
  76. data/tasks/config.rb +110 -0
  77. data/tasks/distribution.rake +53 -0
  78. data/tasks/documentation.rake +33 -0
  79. data/tasks/extension.rake +100 -0
  80. data/tasks/rspec.rake +32 -0
  81. data/tasks/rubyforge.rake +59 -0
  82. data/tasks/utils.rb +80 -0
  83. metadata +192 -0
@@ -0,0 +1,241 @@
1
+ #include "amalgalite3.h"
2
+ /**
3
+ * Copyright (c) 2008 Jeremy Hinegardner
4
+ * All rights reserved. See LICENSE and/or COPYING for details.
5
+ *
6
+ * vim: shiftwidth=4
7
+ */
8
+
9
+ /* class Amalgliate::SQLite3::Blob */
10
+ VALUE cAS_Blob;
11
+
12
+ /**
13
+ * call-seq:
14
+ * Blob.new( database, table_name, column_name, row_id, flag ) -> Blob
15
+ *
16
+ * Create a new Blob object and associate it with the approriate, database,
17
+ * table, column and row. +flag+ indicates if the Blob is to be opened for
18
+ * writing "w" or reading "r".
19
+ *
20
+ */
21
+ VALUE am_sqlite3_blob_initialize( VALUE self, VALUE db, VALUE db_name, VALUE table_name, VALUE column_name, VALUE rowid, VALUE flag)
22
+ {
23
+ am_sqlite3_blob *am_blob;
24
+ int rc;
25
+ am_sqlite3 *am_db;
26
+ char *zDb = StringValuePtr( db_name );
27
+ char *zTable = StringValuePtr( table_name );
28
+ char *zColumn = StringValuePtr( column_name );
29
+ sqlite3_int64 iRow = NUM2SQLINT64( rowid ) ;
30
+ VALUE flag_str = StringValue( flag );
31
+ int flags = 0;
32
+
33
+ /* extract the blob struct */
34
+ Data_Get_Struct(self, am_sqlite3_blob, am_blob);
35
+
36
+ /* extract the sqlite3 db struct */
37
+ Data_Get_Struct(db, am_sqlite3, am_db);
38
+
39
+ /* make sure that the flags are valid, only 'r' or 'w' are allowed */
40
+ if ( ( RSTRING( flag_str )->len != 1) ||
41
+ ( ( 'r' != RSTRING( flag_str )->ptr[0] ) &&
42
+ ( 'w' != RSTRING( flag_str )->ptr[0] ))) {
43
+ rb_raise( eAS_Error, "Error opening Blob in db = %s, table = %s, column = %s, rowid = %lu. Invalid flag '%s'. Must be either 'w' or 'r'\n",
44
+ zDb, zTable, zColumn, (unsigned long)iRow, RSTRING( flag_str )->ptr);
45
+ }
46
+
47
+ /* switch to write mode */
48
+ if ( 'w' == RSTRING( flag_str )->ptr[0] ) {
49
+ flags = 1;
50
+ }
51
+
52
+ /* open the blob and associate the db to it */
53
+ rc = sqlite3_blob_open( am_db->db, zDb, zTable, zColumn, iRow, flags, &( am_blob->blob ) );
54
+ if ( SQLITE_OK != rc ) {
55
+ rb_raise( eAS_Error, "Error opening Blob in db = %s, table = %s, column = %s, rowid = %lu : [SQLITE_ERROR %d] %s\n", zDb, zTable, zColumn, (unsigned long)iRow, rc, sqlite3_errmsg( am_db->db) );
56
+ }
57
+ am_blob->length = sqlite3_blob_bytes( am_blob->blob );
58
+ am_blob->db = am_db->db;
59
+
60
+ /* if a block is given then yield self and close the blob when done */
61
+ if ( rb_block_given_p() ) {
62
+ rb_yield( self );
63
+ am_sqlite3_blob_close( self );
64
+ return Qnil;
65
+ } else {
66
+ return self;
67
+ }
68
+ }
69
+
70
+ /**
71
+ * call-seq:
72
+ * blob.close -> nil
73
+ *
74
+ * Closes the blob.
75
+ */
76
+ VALUE am_sqlite3_blob_close( VALUE self )
77
+ {
78
+ am_sqlite3_blob *am_blob;
79
+ int rc;
80
+
81
+ Data_Get_Struct(self, am_sqlite3_blob, am_blob);
82
+ rc = sqlite3_blob_close( am_blob->blob );
83
+ if ( SQLITE_OK != rc ) {
84
+ rb_raise(eAS_Error, "Error closing blob: [SQLITE_ERROR %d] %s\n",
85
+ rc, sqlite3_errmsg( am_blob->db ));
86
+ }
87
+
88
+
89
+ return Qnil;
90
+ }
91
+
92
+
93
+ /**
94
+ * call-seq:
95
+ * blob.length -> length in bytes of the blob
96
+ *
97
+ * Returns the number of bytes in the blob.
98
+ */
99
+ VALUE am_sqlite3_blob_length( VALUE self )
100
+ {
101
+ am_sqlite3_blob *am_blob;
102
+ int n;
103
+
104
+ Data_Get_Struct(self, am_sqlite3_blob, am_blob);
105
+
106
+ return INT2FIX( am_blob->length );
107
+ }
108
+
109
+ /**
110
+ * call-seq:
111
+ * blob.read( int ) -> String containting int number of bytes or nil if eof.
112
+ *
113
+ * returns int number of bytes as a String from the database
114
+ */
115
+ VALUE am_sqlite3_blob_read( VALUE self, VALUE length )
116
+ {
117
+ am_sqlite3_blob *am_blob;
118
+ int rc;
119
+ int n = NUM2INT( length );
120
+ void *buf = NULL;
121
+ VALUE result;
122
+
123
+ Data_Get_Struct(self, am_sqlite3_blob, am_blob);
124
+
125
+ /* we have to be exact on the number of bytes to read. n + current_offset
126
+ * cannot be larger than the blob's length
127
+ */
128
+ if ( (n + am_blob->current_offset > am_blob->length)) {
129
+ n = am_blob->length - am_blob->current_offset;
130
+ }
131
+
132
+ if ( am_blob->current_offset == am_blob->length ) {
133
+ return Qnil;
134
+ }
135
+
136
+ buf = (void *)malloc( n );
137
+ rc = sqlite3_blob_read( am_blob->blob, buf, n, am_blob->current_offset);
138
+
139
+ if ( rc != SQLITE_OK ) {
140
+ rb_raise(eAS_Error, "Error reading %d bytes blob at offset %d: [SQLITE_ERROR %d] %s\n",
141
+ n, am_blob->current_offset, rc, sqlite3_errmsg( am_blob->db ));
142
+ }
143
+
144
+ am_blob->current_offset += n;
145
+
146
+ result = rb_str_new( (char*)buf, n );
147
+ free( buf );
148
+ return result;
149
+
150
+ }
151
+
152
+ /**
153
+ * call-seq:
154
+ * blob.write( buf ) -> int
155
+ *
156
+ * writes the contents of the string buffer to the blob and returns the number
157
+ * of bytes written.
158
+ *
159
+ */
160
+ VALUE am_sqlite3_blob_write( VALUE self, VALUE buf )
161
+ {
162
+ am_sqlite3_blob *am_blob;
163
+ int rc;
164
+ VALUE str = StringValue( buf );
165
+ int n = RSTRING( str )->len;
166
+ char *chk_buf = NULL;
167
+
168
+ Data_Get_Struct(self, am_sqlite3_blob, am_blob);
169
+
170
+ rc = sqlite3_blob_write( am_blob->blob, RSTRING(str)->ptr, n, am_blob->current_offset);
171
+
172
+ if ( rc != SQLITE_OK ) {
173
+ rb_raise(eAS_Error, "Error writing %d bytes blob at offset %d: [SQLITE_ERROR %d] %s\n",
174
+ n, am_blob->current_offset, rc, sqlite3_errmsg( am_blob->db ));
175
+ }
176
+
177
+ chk_buf = (char *) malloc( n + 1);
178
+ chk_buf[n] = '\0';
179
+ sqlite3_blob_read( am_blob->blob, chk_buf, n, 0);
180
+
181
+ am_blob->current_offset += n;
182
+
183
+ return INT2FIX( n );
184
+
185
+ }
186
+
187
+
188
+ /***********************************************************************
189
+ * Ruby life cycle methods
190
+ ***********************************************************************/
191
+
192
+ /*
193
+ * garbage collector free method for the am_sqlite3_blob structure
194
+ */
195
+ void am_sqlite3_blob_free(am_sqlite3_blob* wrapper)
196
+ {
197
+ free(wrapper);
198
+ return;
199
+ }
200
+
201
+ /*
202
+ * allocate the am_blob structure
203
+ */
204
+ VALUE am_sqlite3_blob_alloc(VALUE klass)
205
+ {
206
+ am_sqlite3_blob *wrapper = ALLOC( am_sqlite3_blob );
207
+ VALUE obj ;
208
+
209
+ wrapper->current_offset = 0;
210
+ wrapper->db = NULL;
211
+ obj = Data_Wrap_Struct(klass, NULL, am_sqlite3_blob_free, wrapper);
212
+ return obj;
213
+ }
214
+
215
+
216
+ /**
217
+ * Document-class: Amalgalite::SQLite3::Blob
218
+ *
219
+ * The Blob class enables incremental IO on blob items. If you do not need
220
+ * incremental IO on a binary object, then you do not need to use Blob.
221
+ */
222
+
223
+ void Init_amalgalite3_blob( )
224
+ {
225
+
226
+ VALUE ma = rb_define_module("Amalgalite");
227
+ VALUE mas = rb_define_module_under(ma, "SQLite3");
228
+
229
+ /*
230
+ * Encapsulate the SQLite3 Statement handle in a class
231
+ */
232
+ cAS_Blob = rb_define_class_under( mas, "Blob", rb_cObject );
233
+ rb_define_alloc_func(cAS_Blob, am_sqlite3_blob_alloc);
234
+ rb_define_method(cAS_Blob, "initialize", am_sqlite3_blob_initialize, 6);
235
+ rb_define_method(cAS_Blob, "close", am_sqlite3_blob_close, 0);
236
+ rb_define_method(cAS_Blob, "read", am_sqlite3_blob_read, 1);
237
+ rb_define_method(cAS_Blob, "write", am_sqlite3_blob_write, 1);
238
+ rb_define_method(cAS_Blob, "length", am_sqlite3_blob_length, 0);
239
+ }
240
+
241
+
@@ -0,0 +1,221 @@
1
+ /* Generated by gen_constants.rb -- do not edit */
2
+
3
+ #include "amalgalite3.h"
4
+ /**
5
+ * Document-class: Amalgalite::SQLite3::Constants
6
+ *
7
+ * class holding constants in the sqlite extension
8
+ */
9
+ void Init_amalgalite3_constants( )
10
+ {
11
+
12
+ VALUE ma = rb_define_module("Amalgalite");
13
+ VALUE mas = rb_define_module_under(ma, "SQLite3");
14
+
15
+ /*
16
+ * module encapsulating all the SQLite C extension constants
17
+ */
18
+ VALUE mC = rb_define_module_under( mas, "Constants");
19
+ /**
20
+ * module encapsulating the SQLite3 C extension constants for DBStatus
21
+ */
22
+ VALUE mC_DBStatus = rb_define_module_under(mC, "DBStatus");
23
+
24
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
25
+ rb_define_const(mC_DBStatus, "LOOKASIDE_USED", INT2FIX(SQLITE_DBSTATUS_LOOKASIDE_USED));
26
+
27
+ /**
28
+ * module encapsulating the SQLite3 C extension constants for DataType
29
+ */
30
+ VALUE mC_DataType = rb_define_module_under(mC, "DataType");
31
+
32
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
33
+ rb_define_const(mC_DataType, "BLOB", INT2FIX(SQLITE_BLOB));
34
+
35
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
36
+ rb_define_const(mC_DataType, "FLOAT", INT2FIX(SQLITE_FLOAT));
37
+
38
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
39
+ rb_define_const(mC_DataType, "INTEGER", INT2FIX(SQLITE_INTEGER));
40
+
41
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
42
+ rb_define_const(mC_DataType, "NULL", INT2FIX(SQLITE_NULL));
43
+
44
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
45
+ rb_define_const(mC_DataType, "TEXT", INT2FIX(SQLITE_TEXT));
46
+
47
+ /**
48
+ * module encapsulating the SQLite3 C extension constants for Open
49
+ */
50
+ VALUE mC_Open = rb_define_module_under(mC, "Open");
51
+
52
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
53
+ rb_define_const(mC_Open, "CREATE", INT2FIX(SQLITE_OPEN_CREATE));
54
+
55
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
56
+ rb_define_const(mC_Open, "READONLY", INT2FIX(SQLITE_OPEN_READONLY));
57
+
58
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
59
+ rb_define_const(mC_Open, "READWRITE", INT2FIX(SQLITE_OPEN_READWRITE));
60
+
61
+ /**
62
+ * module encapsulating the SQLite3 C extension constants for ResultCode
63
+ */
64
+ VALUE mC_ResultCode = rb_define_module_under(mC, "ResultCode");
65
+
66
+ /* 4 -- Callback routine requested an abort */
67
+ rb_define_const(mC_ResultCode, "ABORT", INT2FIX(SQLITE_ABORT));
68
+
69
+ /* 23 -- Authorization denied */
70
+ rb_define_const(mC_ResultCode, "AUTH", INT2FIX(SQLITE_AUTH));
71
+
72
+ /* 5 -- The database file is locked */
73
+ rb_define_const(mC_ResultCode, "BUSY", INT2FIX(SQLITE_BUSY));
74
+
75
+ /* 14 -- Unable to open the database file */
76
+ rb_define_const(mC_ResultCode, "CANTOPEN", INT2FIX(SQLITE_CANTOPEN));
77
+
78
+ /* 19 -- Abort due to constraint violation */
79
+ rb_define_const(mC_ResultCode, "CONSTRAINT", INT2FIX(SQLITE_CONSTRAINT));
80
+
81
+ /* 11 -- The database disk image is malformed */
82
+ rb_define_const(mC_ResultCode, "CORRUPT", INT2FIX(SQLITE_CORRUPT));
83
+
84
+ /* 101 -- sqlite3_step() has finished executing */
85
+ rb_define_const(mC_ResultCode, "DONE", INT2FIX(SQLITE_DONE));
86
+
87
+ /* 16 -- Database is empty */
88
+ rb_define_const(mC_ResultCode, "EMPTY", INT2FIX(SQLITE_EMPTY));
89
+
90
+ /* 1 -- SQL error or missing database */
91
+ rb_define_const(mC_ResultCode, "ERROR", INT2FIX(SQLITE_ERROR));
92
+
93
+ /* 24 -- Auxiliary database format error */
94
+ rb_define_const(mC_ResultCode, "FORMAT", INT2FIX(SQLITE_FORMAT));
95
+
96
+ /* 13 -- Insertion failed because database is full */
97
+ rb_define_const(mC_ResultCode, "FULL", INT2FIX(SQLITE_FULL));
98
+
99
+ /* 2 -- Internal logic error in SQLite */
100
+ rb_define_const(mC_ResultCode, "INTERNAL", INT2FIX(SQLITE_INTERNAL));
101
+
102
+ /* 9 -- Operation terminated by sqlite3_interrupt() */
103
+ rb_define_const(mC_ResultCode, "INTERRUPT", INT2FIX(SQLITE_INTERRUPT));
104
+
105
+ /* 10 -- Some kind of disk I/O error occurred */
106
+ rb_define_const(mC_ResultCode, "IOERR", INT2FIX(SQLITE_IOERR));
107
+
108
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
109
+ rb_define_const(mC_ResultCode, "IOERR_BLOCKED", INT2FIX(SQLITE_IOERR_BLOCKED));
110
+
111
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
112
+ rb_define_const(mC_ResultCode, "IOERR_DELETE", INT2FIX(SQLITE_IOERR_DELETE));
113
+
114
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
115
+ rb_define_const(mC_ResultCode, "IOERR_DIR_FSYNC", INT2FIX(SQLITE_IOERR_DIR_FSYNC));
116
+
117
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
118
+ rb_define_const(mC_ResultCode, "IOERR_FSTAT", INT2FIX(SQLITE_IOERR_FSTAT));
119
+
120
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
121
+ rb_define_const(mC_ResultCode, "IOERR_FSYNC", INT2FIX(SQLITE_IOERR_FSYNC));
122
+
123
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
124
+ rb_define_const(mC_ResultCode, "IOERR_NOMEM", INT2FIX(SQLITE_IOERR_NOMEM));
125
+
126
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
127
+ rb_define_const(mC_ResultCode, "IOERR_RDLOCK", INT2FIX(SQLITE_IOERR_RDLOCK));
128
+
129
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
130
+ rb_define_const(mC_ResultCode, "IOERR_READ", INT2FIX(SQLITE_IOERR_READ));
131
+
132
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
133
+ rb_define_const(mC_ResultCode, "IOERR_SHORT_READ", INT2FIX(SQLITE_IOERR_SHORT_READ));
134
+
135
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
136
+ rb_define_const(mC_ResultCode, "IOERR_TRUNCATE", INT2FIX(SQLITE_IOERR_TRUNCATE));
137
+
138
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
139
+ rb_define_const(mC_ResultCode, "IOERR_UNLOCK", INT2FIX(SQLITE_IOERR_UNLOCK));
140
+
141
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
142
+ rb_define_const(mC_ResultCode, "IOERR_WRITE", INT2FIX(SQLITE_IOERR_WRITE));
143
+
144
+ /* 6 -- A table in the database is locked */
145
+ rb_define_const(mC_ResultCode, "LOCKED", INT2FIX(SQLITE_LOCKED));
146
+
147
+ /* 20 -- Data type mismatch */
148
+ rb_define_const(mC_ResultCode, "MISMATCH", INT2FIX(SQLITE_MISMATCH));
149
+
150
+ /* 21 -- Library used incorrectly */
151
+ rb_define_const(mC_ResultCode, "MISUSE", INT2FIX(SQLITE_MISUSE));
152
+
153
+ /* 22 -- Uses OS features not supported on host */
154
+ rb_define_const(mC_ResultCode, "NOLFS", INT2FIX(SQLITE_NOLFS));
155
+
156
+ /* 7 -- A malloc() failed */
157
+ rb_define_const(mC_ResultCode, "NOMEM", INT2FIX(SQLITE_NOMEM));
158
+
159
+ /* 26 -- File opened that is not a database file */
160
+ rb_define_const(mC_ResultCode, "NOTADB", INT2FIX(SQLITE_NOTADB));
161
+
162
+ /* 12 -- NOT USED. Table or record not found */
163
+ rb_define_const(mC_ResultCode, "NOTFOUND", INT2FIX(SQLITE_NOTFOUND));
164
+
165
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
166
+ rb_define_const(mC_ResultCode, "OK", INT2FIX(SQLITE_OK));
167
+
168
+ /* 3 -- Access permission denied */
169
+ rb_define_const(mC_ResultCode, "PERM", INT2FIX(SQLITE_PERM));
170
+
171
+ /* 15 -- NOT USED. Database lock protocol error */
172
+ rb_define_const(mC_ResultCode, "PROTOCOL", INT2FIX(SQLITE_PROTOCOL));
173
+
174
+ /* 25 -- 2nd parameter to sqlite3_bind out of range */
175
+ rb_define_const(mC_ResultCode, "RANGE", INT2FIX(SQLITE_RANGE));
176
+
177
+ /* 8 -- Attempt to write a readonly database */
178
+ rb_define_const(mC_ResultCode, "READONLY", INT2FIX(SQLITE_READONLY));
179
+
180
+ /* 100 -- sqlite3_step() has another row ready */
181
+ rb_define_const(mC_ResultCode, "ROW", INT2FIX(SQLITE_ROW));
182
+
183
+ /* 17 -- The database schema changed */
184
+ rb_define_const(mC_ResultCode, "SCHEMA", INT2FIX(SQLITE_SCHEMA));
185
+
186
+ /* 18 -- String or BLOB exceeds size limit */
187
+ rb_define_const(mC_ResultCode, "TOOBIG", INT2FIX(SQLITE_TOOBIG));
188
+
189
+ /**
190
+ * module encapsulating the SQLite3 C extension constants for Status
191
+ */
192
+ VALUE mC_Status = rb_define_module_under(mC, "Status");
193
+
194
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
195
+ rb_define_const(mC_Status, "MALLOC_SIZE", INT2FIX(SQLITE_STATUS_MALLOC_SIZE));
196
+
197
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
198
+ rb_define_const(mC_Status, "MEMORY_USED", INT2FIX(SQLITE_STATUS_MEMORY_USED));
199
+
200
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
201
+ rb_define_const(mC_Status, "PAGECACHE_OVERFLOW", INT2FIX(SQLITE_STATUS_PAGECACHE_OVERFLOW));
202
+
203
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
204
+ rb_define_const(mC_Status, "PAGECACHE_SIZE", INT2FIX(SQLITE_STATUS_PAGECACHE_SIZE));
205
+
206
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
207
+ rb_define_const(mC_Status, "PAGECACHE_USED", INT2FIX(SQLITE_STATUS_PAGECACHE_USED));
208
+
209
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
210
+ rb_define_const(mC_Status, "PARSER_STACK", INT2FIX(SQLITE_STATUS_PARSER_STACK));
211
+
212
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
213
+ rb_define_const(mC_Status, "SCRATCH_OVERFLOW", INT2FIX(SQLITE_STATUS_SCRATCH_OVERFLOW));
214
+
215
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
216
+ rb_define_const(mC_Status, "SCRATCH_SIZE", INT2FIX(SQLITE_STATUS_SCRATCH_SIZE));
217
+
218
+ /* no meaningful autogenerated documentation -- constant is self explanatory ?*/
219
+ rb_define_const(mC_Status, "SCRATCH_USED", INT2FIX(SQLITE_STATUS_SCRATCH_USED));
220
+
221
+ }