amalgalite 1.5.0-x86-mingw32 → 1.6.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,14 +8,18 @@ $ruby = ARGV.shift if ARGV[0]
8
8
  # make available table and column meta data api
9
9
  $CFLAGS += " -DSQLITE_ENABLE_COLUMN_METADATA=1"
10
10
  $CFLAGS += " -DSQLITE_ENABLE_DBSTAT_VTAB=1"
11
+ $CFLAGS += " -DSQLITE_ENABLE_DBPAGE_VTAB=1"
11
12
  $CFLAGS += " -DSQLITE_ENABLE_FTS3=1"
12
13
  $CFLAGS += " -DSQLITE_ENABLE_FTS3_PARENTHESIS=1"
13
14
  $CFLAGS += " -DSQLITE_ENABLE_FTS4=1"
14
15
  $CFLAGS += " -DSQLITE_ENABLE_FTS5=1"
15
16
  $CFLAGS += " -DSQLITE_ENABLE_JSON1=1"
17
+ $CFLAGS += " -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1"
18
+ $CFLAGS += " -DSQLITE_ENABLE_PREUPDATE_HOOK=1"
16
19
  $CFLAGS += " -DSQLITE_ENABLE_RBU=1"
17
20
  $CFLAGS += " -DSQLITE_ENABLE_RTREE=1"
18
- $CFLAGS += " -DSQLITE_ENABLE_SQLLOG=1"
21
+ $CFLAGS += " -DSQLITE_ENABLE_SESSION=1"
22
+ $CFLAGS += " -DSQLITE_ENABLE_STMTVTAB=1"
19
23
  $CFLAGS += " -DSQLITE_ENABLE_STAT4=1"
20
24
  $CFLAGS += " -DSQLITE_ENABLE_UNLOCK_NOTIFY=1"
21
25
 
@@ -1,141 +1,288 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- CONSTANTS = {
4
- "ResultCode" => {
5
- "OK" => "SQLITE_OK",
6
- "ERROR" => "SQLITE_ERROR",
7
- "INTERNAL" => "SQLITE_INTERNAL",
8
- "PERM" => "SQLITE_PERM",
9
- "ABORT" => "SQLITE_ABORT",
10
- "BUSY" => "SQLITE_BUSY",
11
- "LOCKED" => "SQLITE_LOCKED",
12
- "NOMEM" => "SQLITE_NOMEM",
13
- "READONLY" => "SQLITE_READONLY",
14
- "INTERRUPT" => "SQLITE_INTERRUPT",
15
- "IOERR" => "SQLITE_IOERR",
16
- "CORRUPT" => "SQLITE_CORRUPT",
17
- "NOTFOUND" => "SQLITE_NOTFOUND",
18
- "FULL" => "SQLITE_FULL",
19
- "CANTOPEN" => "SQLITE_CANTOPEN",
20
- "PROTOCOL" => "SQLITE_PROTOCOL",
21
- "EMPTY" => "SQLITE_EMPTY",
22
- "SCHEMA" => "SQLITE_SCHEMA",
23
- "TOOBIG" => "SQLITE_TOOBIG",
24
- "CONSTRAINT" => "SQLITE_CONSTRAINT",
25
- "MISMATCH" => "SQLITE_MISMATCH",
26
- "MISUSE" => "SQLITE_MISUSE",
27
- "NOLFS" => "SQLITE_NOLFS",
28
- "AUTH" => "SQLITE_AUTH",
29
- "FORMAT" => "SQLITE_FORMAT",
30
- "RANGE" => "SQLITE_RANGE",
31
- "NOTADB" => "SQLITE_NOTADB",
32
- "ROW" => "SQLITE_ROW",
33
- "DONE" => "SQLITE_DONE",
34
-
35
- "IOERR_READ" => "SQLITE_IOERR_READ",
36
- "IOERR_SHORT_READ" => "SQLITE_IOERR_SHORT_READ",
37
- "IOERR_WRITE" => "SQLITE_IOERR_WRITE",
38
- "IOERR_FSYNC" => "SQLITE_IOERR_FSYNC",
39
- "IOERR_DIR_FSYNC" => "SQLITE_IOERR_DIR_FSYNC",
40
- "IOERR_TRUNCATE" => "SQLITE_IOERR_TRUNCATE",
41
- "IOERR_FSTAT" => "SQLITE_IOERR_FSTAT",
42
- "IOERR_UNLOCK" => "SQLITE_IOERR_UNLOCK",
43
- "IOERR_RDLOCK" => "SQLITE_IOERR_RDLOCK",
44
- "IOERR_DELETE" => "SQLITE_IOERR_DELETE",
45
- "IOERR_BLOCKED" => "SQLITE_IOERR_BLOCKED",
46
- "IOERR_NOMEM" => "SQLITE_IOERR_NOMEM",
47
- "IOERR_ACCESS" => "SQLITE_IOERR_ACCESS",
48
- "IOERR_CHECKRESERVEDLOCK" => "SQLITE_IOERR_CHECKRESERVEDLOCK",
49
- "IOERR_LOCK" => "SQLITE_IOERR_LOCK",
50
- "IOERR_CLOSE" => "SQLITE_IOERR_CLOSE",
51
- "IOERR_DIR_CLOSE" => "SQLITE_IOERR_DIR_CLOSE",
52
- "IOERR_SHMOPEN" => "SQLITE_IOERR_SHMOPEN",
53
- "IOERR_SHMSIZE" => "SQLITE_IOERR_SHMSIZE",
54
- "IOERR_SHMLOCK" => "SQLITE_IOERR_SHMLOCK",
55
-
56
- "LOCKED_SHAREDCACHE" => "SQLITE_LOCKED_SHAREDCACHE",
57
- "BUSY_RECOVERY" => "SQLITE_BUSY_RECOVERY",
58
- "CANTOPEN_NOTEMPDIR" => "SQLITE_CANTOPEN_NOTEMPDIR",
59
- },
60
-
61
-
62
- "DataType" => {
63
- "INTEGER" => "SQLITE_INTEGER",
64
- "FLOAT" => "SQLITE_FLOAT",
65
- "BLOB" => "SQLITE_BLOB",
66
- "NULL" => "SQLITE_NULL",
67
- "TEXT" => "SQLITE_TEXT",
68
- },
69
-
70
- "Config" => {
71
- "SINGLETHREAD" => "SQLITE_CONFIG_SINGLETHREAD",
72
- "MULTITHREAD" => "SQLITE_CONFIG_MULTITHREAD",
73
- "SERIALIZED" => "SQLITE_CONFIG_SERIALIZED",
74
- "MALLOC" => "SQLITE_CONFIG_MALLOC",
75
- "GETMALLOC" => "SQLITE_CONFIG_GETMALLOC",
76
- "SCRATCH" => "SQLITE_CONFIG_SCRATCH",
77
- "PAGECACHE" => "SQLITE_CONFIG_PAGECACHE",
78
- "HEAP" => "SQLITE_CONFIG_HEAP",
79
- "MEMSTATUS" => "SQLITE_CONFIG_MEMSTATUS",
80
- "MUTEX" => "SQLITE_CONFIG_MUTEX",
81
- "GETMUTEX" => "SQLITE_CONFIG_GETMUTEX",
82
- "LOOKASIDE" => "SQLITE_CONFIG_LOOKASIDE",
83
- "PCACHE" => "SQLITE_CONFIG_PCACHE",
84
- "GETPCACHE" => "SQLITE_CONFIG_GETPCACHE",
85
- "LOG" => "SQLITE_CONFIG_LOG",
86
- },
87
-
88
- "Open" => {
89
- "READONLY" => "SQLITE_OPEN_READONLY",
90
- "READWRITE" => "SQLITE_OPEN_READWRITE",
91
- "CREATE" => "SQLITE_OPEN_CREATE",
92
- "DELETEONCLOSE" => "SQLITE_OPEN_DELETEONCLOSE",
93
- "EXCLUSIVE" => "SQLITE_OPEN_EXCLUSIVE",
94
- "AUTOPROXY" => "SQLITE_OPEN_AUTOPROXY",
95
- "MAIN_DB" => "SQLITE_OPEN_MAIN_DB",
96
- "TEMP_DB" => "SQLITE_OPEN_TEMP_DB",
97
- "TRANSIENT_DB" => "SQLITE_OPEN_TRANSIENT_DB",
98
- "MAIN_JOURNAL" => "SQLITE_OPEN_MAIN_JOURNAL",
99
- "TEMP_JOURNAL" => "SQLITE_OPEN_TEMP_JOURNAL",
100
- "SUBJOURNAL" => "SQLITE_OPEN_SUBJOURNAL",
101
- "MASTER_JOURNAL" => "SQLITE_OPEN_MASTER_JOURNAL",
102
- "NOMUTEX" => "SQLITE_OPEN_NOMUTEX",
103
- "FULLMUTEX" => "SQLITE_OPEN_FULLMUTEX",
104
- "SHAREDCACHE" => "SQLITE_OPEN_SHAREDCACHE",
105
- "PRIVATECACHE" => "SQLITE_OPEN_PRIVATECACHE",
106
- "WAL" => "SQLITE_OPEN_WAL",
107
- },
108
-
109
- "Status" => {
110
- "MEMORY_USED" => "SQLITE_STATUS_MEMORY_USED",
111
- "PAGECACHE_USED" => "SQLITE_STATUS_PAGECACHE_USED",
112
- "PAGECACHE_OVERFLOW" => "SQLITE_STATUS_PAGECACHE_OVERFLOW",
113
- "SCRATCH_USED" => "SQLITE_STATUS_SCRATCH_USED",
114
- "SCRATCH_OVERFLOW" => "SQLITE_STATUS_SCRATCH_OVERFLOW",
115
- "MALLOC_SIZE" => "SQLITE_STATUS_MALLOC_SIZE",
116
- "PARSER_STACK" => "SQLITE_STATUS_PARSER_STACK",
117
- "PAGECACHE_SIZE" => "SQLITE_STATUS_PAGECACHE_SIZE",
118
- "SCRATCH_SIZE" => "SQLITE_STATUS_SCRATCH_SIZE",
119
- "MALLOC_COUNT" => "SQLITE_STATUS_MALLOC_COUNT",
120
- },
121
-
122
- "DBStatus" => {
123
- "LOOKASIDE_USED" => "SQLITE_DBSTATUS_LOOKASIDE_USED",
124
- "CACHE_USED" => "SQLITE_DBSTATUS_CACHE_USED",
125
- "SCHEMA_USED" => "SQLITE_DBSTATUS_SCHEMA_USED",
126
- "STMT_USED" => "SQLITE_DBSTATUS_STMT_USED",
127
- "MAX" => "SQLITE_DBSTATUS_MAX",
128
- },
129
-
130
- "StatementStatus" => {
131
- "FULLSCAN_STEP" => "SQLITE_STMTSTATUS_FULLSCAN_STEP",
132
- "SORT" => "SQLITE_STMTSTATUS_SORT",
133
- "AUTOINDEX" => "SQLITE_STMTSTATUS_AUTOINDEX",
134
- }
3
+ require 'pp'
4
+
5
+ # readin in the sqlite3.h file and parse out all the #define lines
6
+ sqlite3_h_fname = File.expand_path(File.join(File.dirname(__FILE__), "sqlite3.h"))
7
+
8
+ # special handling for those that are function result codes
9
+ result_codes = %w[
10
+ SQLITE_OK
11
+ SQLITE_ERROR
12
+ SQLITE_INTERNAL
13
+ SQLITE_PERM
14
+ SQLITE_ABORT
15
+ SQLITE_BUSY
16
+ SQLITE_LOCKED
17
+ SQLITE_NOMEM
18
+ SQLITE_READONLY
19
+ SQLITE_INTERRUPT
20
+ SQLITE_IOERR
21
+ SQLITE_CORRUPT
22
+ SQLITE_NOTFOUND
23
+ SQLITE_FULL
24
+ SQLITE_CANTOPEN
25
+ SQLITE_PROTOCOL
26
+ SQLITE_EMPTY
27
+ SQLITE_SCHEMA
28
+ SQLITE_TOOBIG
29
+ SQLITE_CONSTRAINT
30
+ SQLITE_MISMATCH
31
+ SQLITE_MISUSE
32
+ SQLITE_NOLFS
33
+ SQLITE_AUTH
34
+ SQLITE_FORMAT
35
+ SQLITE_RANGE
36
+ SQLITE_NOTADB
37
+ SQLITE_NOTICE
38
+ SQLITE_WARNING
39
+ SQLITE_ROW
40
+ SQLITE_DONE
41
+ SQLITE_IOERR_READ
42
+ SQLITE_IOERR_SHORT_READ
43
+ SQLITE_IOERR_WRITE
44
+ SQLITE_IOERR_FSYNC
45
+ SQLITE_IOERR_DIR_FSYNC
46
+ SQLITE_IOERR_TRUNCATE
47
+ SQLITE_IOERR_FSTAT
48
+ SQLITE_IOERR_UNLOCK
49
+ SQLITE_IOERR_RDLOCK
50
+ SQLITE_IOERR_DELETE
51
+ SQLITE_IOERR_BLOCKED
52
+ SQLITE_IOERR_NOMEM
53
+ SQLITE_IOERR_ACCESS
54
+ SQLITE_IOERR_CHECKRESERVEDLOCK
55
+ SQLITE_IOERR_LOCK
56
+ SQLITE_IOERR_CLOSE
57
+ SQLITE_IOERR_DIR_CLOSE
58
+ SQLITE_IOERR_SHMOPEN
59
+ SQLITE_IOERR_SHMSIZE
60
+ SQLITE_IOERR_SHMLOCK
61
+ SQLITE_IOERR_SHMMAP
62
+ SQLITE_IOERR_SEEK
63
+ SQLITE_IOERR_DELETE_NOENT
64
+ SQLITE_IOERR_MMAP
65
+ SQLITE_IOERR_GETTEMPPATH
66
+ SQLITE_IOERR_CONVPATH
67
+ SQLITE_IOERR_VNODE
68
+ SQLITE_IOERR_AUTH
69
+ SQLITE_IOERR_BEGIN_ATOMIC
70
+ SQLITE_IOERR_COMMIT_ATOMIC
71
+ SQLITE_IOERR_ROLLBACK_ATOMIC
72
+ SQLITE_LOCKED_SHAREDCACHE
73
+ SQLITE_BUSY_RECOVERY
74
+ SQLITE_BUSY_SNAPSHOT
75
+ SQLITE_CANTOPEN_NOTEMPDIR
76
+ SQLITE_CANTOPEN_ISDIR
77
+ SQLITE_CANTOPEN_FULLPATH
78
+ SQLITE_CANTOPEN_CONVPATH
79
+ SQLITE_CORRUPT_VTAB
80
+ SQLITE_READONLY_RECOVERY
81
+ SQLITE_READONLY_CANTLOCK
82
+ SQLITE_READONLY_ROLLBACK
83
+ SQLITE_READONLY_DBMOVED
84
+ SQLITE_ABORT_ROLLBACK
85
+ SQLITE_CONSTRAINT_CHECK
86
+ SQLITE_CONSTRAINT_COMMITHOOK
87
+ SQLITE_CONSTRAINT_FOREIGNKEY
88
+ SQLITE_CONSTRAINT_FUNCTION
89
+ SQLITE_CONSTRAINT_NOTNULL
90
+ SQLITE_CONSTRAINT_PRIMARYKEY
91
+ SQLITE_CONSTRAINT_TRIGGER
92
+ SQLITE_CONSTRAINT_UNIQUE
93
+ SQLITE_CONSTRAINT_VTAB
94
+ SQLITE_CONSTRAINT_ROWID
95
+ SQLITE_NOTICE_RECOVER_WAL
96
+ SQLITE_NOTICE_RECOVER_ROLLBACK
97
+ SQLITE_WARNING_AUTOINDEX
98
+ SQLITE_AUTH_USER
99
+ SQLITE_OK_LOAD_PERMANENTLY
100
+ ]
101
+
102
+ deprecated_codes = %w[ SQLITE_GET_LOCKPROXYFILE SQLITE_SET_LOCKPROXYFILE SQLITE_LAST_ERRNO ]
103
+ version_codes = %w[ SQLITE_VERSION SQLITE_VERSION_NUMBER SQLITE_SOURCE_ID ]
104
+ rtree_codes = %w[ NOT_WITHIN PARTLY_WITHIN FULLY_WITHIN ]
105
+
106
+ authorizer_codes = %w[
107
+ SQLITE_DENY
108
+ SQLITE_IGNORE
109
+ SQLITE_CREATE_INDEX
110
+ SQLITE_CREATE_TABLE
111
+ SQLITE_CREATE_TEMP_INDEX
112
+ SQLITE_CREATE_TEMP_TABLE
113
+ SQLITE_CREATE_TEMP_TRIGGER
114
+ SQLITE_CREATE_TEMP_VIEW
115
+ SQLITE_CREATE_TRIGGER
116
+ SQLITE_CREATE_VIEW
117
+ SQLITE_DELETE
118
+ SQLITE_DROP_INDEX
119
+ SQLITE_DROP_TABLE
120
+ SQLITE_DROP_TEMP_INDEX
121
+ SQLITE_DROP_TEMP_TABLE
122
+ SQLITE_DROP_TEMP_TRIGGER
123
+ SQLITE_DROP_TEMP_VIEW
124
+ SQLITE_DROP_TRIGGER
125
+ SQLITE_DROP_VIEW
126
+ SQLITE_INSERT
127
+ SQLITE_PRAGMA
128
+ SQLITE_READ
129
+ SQLITE_SELECT
130
+ SQLITE_TRANSACTION
131
+ SQLITE_UPDATE
132
+ SQLITE_ATTACH
133
+ SQLITE_DETACH
134
+ SQLITE_ALTER_TABLE
135
+ SQLITE_REINDEX
136
+ SQLITE_ANALYZE
137
+ SQLITE_CREATE_VTABLE
138
+ SQLITE_DROP_VTABLE
139
+ SQLITE_FUNCTION
140
+ SQLITE_SAVEPOINT
141
+ SQLITE_COPY
142
+ SQLITE_RECURSIVE
143
+ ]
144
+
145
+ text_encoding_codes = %w[
146
+ SQLITE_UTF8
147
+ SQLITE_UTF16LE
148
+ SQLITE_UTF16BE
149
+ SQLITE_UTF16
150
+ SQLITE_ANY
151
+ SQLITE_UTF16_ALIGNED
152
+ SQLITE_DETERMINISTIC
153
+ ]
154
+
155
+ data_type_codes = %w[
156
+ SQLITE_INTEGER
157
+ SQLITE_FLOAT
158
+ SQLITE_BLOB
159
+ SQLITE_NULL
160
+ SQLITE3_TEXT
161
+ ]
162
+
163
+ fts5_codes = %w[
164
+ FTS5_TOKENIZE_QUERY
165
+ FTS5_TOKENIZE_PREFIX
166
+ FTS5_TOKENIZE_DOCUMENT
167
+ FTS5_TOKENIZE_AUX
168
+ FTS5_TOKEN_COLOCATED
169
+ ]
170
+
171
+ ignore_codes = [
172
+ # vtab related
173
+ "SQLITE_ROLLBACK",
174
+ "SQLITE_FAIL",
175
+ "SQLITE_REPLACE",
176
+ "SQLITE_VTAB_CONSTRAINT_SUPPORT",
177
+
178
+ # sqlite destructor callback codes
179
+ "SQLITE_STATIC",
180
+ "SQLITE_TRANSIENT",
181
+ ]
182
+
183
+ # oddball name
184
+ module_name_mapping = {
135
185
 
186
+ "DBCONFIG" => "DBConfig",
187
+ "DBSTATUS" => "DBStatus",
188
+ "IOCAP" => "IOCap",
189
+ "SHM" => "SHM",
190
+ "SCANSTAT" => "ScanStat",
191
+ "STMTSTATUS" => "StatementStatus",
136
192
  }
137
193
 
194
+ defines = []
195
+ IO.readlines(sqlite3_h_fname).each do |l|
196
+ result = {
197
+ "c_define" => nil,
198
+ "c_value" => nil,
199
+ "docstring" => nil,
200
+
201
+ "is_error_code" => false,
202
+
203
+ "r_module" => nil,
204
+ "r_constant" => nil,
205
+ }
206
+
207
+ if l =~ /beginning-of-error-codes/ .. l =~ /end-of-error-codes/ then
208
+ result["is_error_code"] = true
209
+ end
210
+
211
+ l.strip!
212
+ md = l.match(/\A#define\s+(\w+)\s+([^\/]+)\s*(\/\*(.*)\*\/)?\Z/)
213
+ next unless md
214
+
215
+ # Name munging
216
+ c_define = md[1]
217
+
218
+ c_parts = c_define.gsub(/^SQLITE_/,'').split("_")
219
+ r_module = c_parts.shift
220
+ r_constant = c_parts.join("_")
221
+
222
+
223
+ # custom module naming so they are human readable
224
+ r_module = module_name_mapping.fetch(r_module) { |m| r_module.capitalize }
225
+
226
+ case c_define
227
+ when *version_codes
228
+ next
229
+
230
+ when *deprecated_codes
231
+ next
232
+
233
+ when *rtree_codes
234
+ r_module = "RTree"
235
+ r_constant = c_define
236
+
237
+ when *result_codes
238
+ r_module = "ResultCode"
239
+ r_constant = c_define.gsub(/^SQLITE_/,'')
240
+
241
+ when *authorizer_codes
242
+ r_module = "Authorizer"
243
+ r_constant = c_define.gsub(/^SQLITE_/,'')
244
+
245
+ when *text_encoding_codes
246
+ r_module = "TextEncoding"
247
+ r_constant = c_define.gsub(/^SQLITE_/,'')
248
+
249
+ when *data_type_codes
250
+ r_module = "DataType"
251
+ r_constant = c_define.gsub(/^SQLITE(3)?_/,'')
252
+
253
+ when *fts5_codes
254
+ r_module = "FTS5"
255
+ r_constant = c_define.gsub(/^FTS5_/,'')
256
+
257
+ when *ignore_codes
258
+ next
259
+
260
+ when /TESTCTRL/ # sqlite3 codes used in testing
261
+ next
262
+
263
+ when /^__/ # sqlite3 internal items
264
+ next
265
+ end
266
+
267
+ result["c_define"] = c_define
268
+ result["c_value"] = md[2].strip
269
+ if !md[4].nil? && (md[4].strip.length > 0) then
270
+ result["docstring"] = md[4].strip
271
+ end
272
+ result["r_module"] = r_module
273
+ result["r_constant"] = r_constant
274
+
275
+ defines << result
276
+ end
277
+
278
+ #
279
+ # rework defines into constants
280
+ #
281
+ CONSTANTS = defines.group_by{ |d| d["r_module"] }
282
+
138
283
  fname = File.expand_path(File.join(File.dirname(__FILE__), "amalgalite_constants.c"))
284
+
285
+
139
286
  File.open(fname, "w+") do |f|
140
287
  f.puts "/* Generated by gen_constants.rb -- do not edit */"
141
288
  f.puts
@@ -157,35 +304,25 @@ File.open(fname, "w+") do |f|
157
304
  f.puts ' VALUE mC = rb_define_module_under( mas, "Constants");'
158
305
 
159
306
 
160
- error_code_lines = {}
161
- IO.readlines("sqlite3.h").each do |l|
162
- if l =~ /beginning-of-error-codes/ .. l =~ /end-of-error-codes/ then
163
- next if l =~ /of-error-codes/
164
- l.strip!
165
- md = l.match(/\A#define\s+(\w+)\s+(\d+)\s+\/\*(.*)\*\/\Z/)
166
- error_code_lines[md[1]] = { 'value' => md[2].strip, 'meaning' => md[3].strip }
167
- end
168
- end
169
-
170
- CONSTANTS.keys.sort.each do |klass|
171
- const_set = CONSTANTS[klass]
307
+ CONSTANTS.keys.sort.each do |mod|
172
308
  f.puts " /**"
173
- f.puts " * module encapsulating the SQLite3 C extension constants for #{klass}"
309
+ f.puts " * module encapsulating the SQLite3 C extension constants for #{mod}"
174
310
  f.puts " */"
175
- f.puts " VALUE mC_#{klass} = rb_define_module_under(mC, \"#{klass}\");"
311
+ f.puts " VALUE mC_#{mod} = rb_define_module_under(mC, \"#{mod}\");"
176
312
  f.puts
177
313
  end
178
314
 
179
- CONSTANTS.keys.sort.each do |klass|
180
- const_set = CONSTANTS[klass]
181
- const_set.keys.sort.each do |k|
182
- sql_const = const_set[k]
315
+ CONSTANTS.keys.sort.each do |mod|
316
+ const_set = CONSTANTS[mod]
317
+ const_set.sort_by { |c| c["c_define"] }.each do |result|
318
+ sql_const = result["c_define"]
183
319
  const_doc = " /* no meaningful autogenerated documentation -- constant is self explanatory ?*/"
184
- if ecl = error_code_lines[sql_const] then
185
- const_doc = " /* #{ecl['value']} -- #{ecl['meaning']} */"
320
+ if !result["docstring"].nil? then
321
+ const_doc = " /* #{result['c_value']} -- #{result['docstring']} */"
186
322
  end
323
+ ruby_constant = result['r_constant']
187
324
  f.puts const_doc
188
- f.puts " rb_define_const(mC_#{klass}, \"#{k}\", INT2FIX(#{sql_const}));"
325
+ f.puts " rb_define_const(mC_#{mod}, \"#{ruby_constant}\", INT2FIX(#{sql_const}));"
189
326
  f.puts
190
327
  end
191
328
  end