rhodes-framework 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/.gitignore +2 -0
  2. data/History.txt +37 -0
  3. data/Manifest.txt +66 -0
  4. data/README.rdoc +2 -0
  5. data/Rakefile +50 -0
  6. data/lib/ServeME.rb +7 -0
  7. data/lib/TestServe.rb +9 -0
  8. data/lib/bsearch.rb +120 -0
  9. data/lib/builtinME.rb +626 -0
  10. data/lib/date/format.rb +1339 -0
  11. data/lib/date.rb +1792 -0
  12. data/lib/dateME.rb +24 -0
  13. data/lib/erb.rb +896 -0
  14. data/lib/find.rb +81 -0
  15. data/lib/rational.rb +19 -0
  16. data/lib/rationalME.rb +530 -0
  17. data/lib/rho/render.rb +51 -0
  18. data/lib/rho/rho.rb +255 -0
  19. data/lib/rho/rhoapplication.rb +36 -0
  20. data/lib/rho/rhocontact.rb +110 -0
  21. data/lib/rho/rhocontroller.rb +35 -0
  22. data/lib/rho/rhofsconnector.rb +32 -0
  23. data/lib/rho/rhosupport.rb +146 -0
  24. data/lib/rho/rhoviewhelpers.rb +130 -0
  25. data/lib/rho.rb +1 -0
  26. data/lib/rhodes-framework.rb +2 -0
  27. data/lib/rhodes.rb +9 -0
  28. data/lib/rhoframework.rb +38 -0
  29. data/lib/rhofsconnector.rb +1 -0
  30. data/lib/rhom/rhom.rb +58 -0
  31. data/lib/rhom/rhom_db_adapter.rb +185 -0
  32. data/lib/rhom/rhom_db_adapterME.rb +93 -0
  33. data/lib/rhom/rhom_object.rb +69 -0
  34. data/lib/rhom/rhom_object_factory.rb +309 -0
  35. data/lib/rhom/rhom_source.rb +60 -0
  36. data/lib/rhom.rb +1 -0
  37. data/lib/singleton.rb +137 -0
  38. data/lib/time.rb +489 -0
  39. data/lib/version.rb +8 -0
  40. data/res/sqlite3/constants.rb +49 -0
  41. data/res/sqlite3/database.rb +715 -0
  42. data/res/sqlite3/driver/dl/api.rb +154 -0
  43. data/res/sqlite3/driver/dl/driver.rb +307 -0
  44. data/res/sqlite3/driver/native/driver.rb +257 -0
  45. data/res/sqlite3/errors.rb +68 -0
  46. data/res/sqlite3/pragmas.rb +271 -0
  47. data/res/sqlite3/resultset.rb +176 -0
  48. data/res/sqlite3/sqlite3_api.rb +0 -0
  49. data/res/sqlite3/statement.rb +230 -0
  50. data/res/sqlite3/translator.rb +109 -0
  51. data/res/sqlite3/value.rb +57 -0
  52. data/res/sqlite3/version.rb +14 -0
  53. data/rhodes-framework.gemspec +18 -0
  54. data/rhodes.gemspec +18 -0
  55. data/spec/app_manifest.txt +4 -0
  56. data/spec/configs/account.rb +3 -0
  57. data/spec/configs/case.rb +3 -0
  58. data/spec/configs/employee.rb +3 -0
  59. data/spec/rho_controller_spec.rb +144 -0
  60. data/spec/rho_spec.rb +75 -0
  61. data/spec/rhom_object_factory_spec.rb +372 -0
  62. data/spec/rhom_spec.rb +45 -0
  63. data/spec/spec.opts +1 -0
  64. data/spec/spec_helper.rb +49 -0
  65. data/spec/stubs.rb +39 -0
  66. data/spec/syncdbtest.sqlite +0 -0
  67. metadata +202 -0
data/lib/time.rb ADDED
@@ -0,0 +1,489 @@
1
+
2
+ #
3
+ # == Introduction
4
+ #
5
+ # This library extends the Time class:
6
+ # * conversion between date string and time object.
7
+ # * date-time defined by RFC 2822
8
+ # * HTTP-date defined by RFC 2616
9
+ # * dateTime defined by XML Schema Part 2: Datatypes (ISO 8601)
10
+ # * various formats handled by Date._parse (string to time only)
11
+ #
12
+ # == Design Issues
13
+ #
14
+ # === Specialized interface
15
+ #
16
+ # This library provides methods dedicated to special purposes:
17
+ # * RFC 2822, RFC 2616 and XML Schema.
18
+ # * They makes usual life easier.
19
+ #
20
+ # === Doesn't depend on strftime
21
+ #
22
+ # This library doesn't use +strftime+. Especially #rfc2822 doesn't depend
23
+ # on +strftime+ because:
24
+ #
25
+ # * %a and %b are locale sensitive
26
+ #
27
+ # Since they are locale sensitive, they may be replaced to
28
+ # invalid weekday/month name in some locales.
29
+ # Since ruby-1.6 doesn't invoke setlocale by default,
30
+ # the problem doesn't arise until some external library invokes setlocale.
31
+ # Ruby/GTK is the example of such library.
32
+ #
33
+ # * %z is not portable
34
+ #
35
+ # %z is required to generate zone in date-time of RFC 2822
36
+ # but it is not portable.
37
+ #
38
+ # == Revision Information
39
+ #
40
+ # $Id$
41
+ #
42
+
43
+ require 'date/format'
44
+ if defined? RHO_ME
45
+ require 'dateME'
46
+ end
47
+
48
+ #
49
+ # Implements the extensions to the Time class that are described in the
50
+ # documentation for the time.rb library.
51
+ #
52
+ class Time
53
+ class << Time
54
+
55
+ ZoneOffset = {
56
+ 'UTC' => 0,
57
+ # ISO 8601
58
+ 'Z' => 0,
59
+ # RFC 822
60
+ 'UT' => 0, 'GMT' => 0,
61
+ 'EST' => -5, 'EDT' => -4,
62
+ 'CST' => -6, 'CDT' => -5,
63
+ 'MST' => -7, 'MDT' => -6,
64
+ 'PST' => -8, 'PDT' => -7,
65
+ # Following definition of military zones is original one.
66
+ # See RFC 1123 and RFC 2822 for the error in RFC 822.
67
+ 'A' => +1, 'B' => +2, 'C' => +3, 'D' => +4, 'E' => +5, 'F' => +6,
68
+ 'G' => +7, 'H' => +8, 'I' => +9, 'K' => +10, 'L' => +11, 'M' => +12,
69
+ 'N' => -1, 'O' => -2, 'P' => -3, 'Q' => -4, 'R' => -5, 'S' => -6,
70
+ 'T' => -7, 'U' => -8, 'V' => -9, 'W' => -10, 'X' => -11, 'Y' => -12,
71
+ }
72
+ def zone_offset(zone, year=self.now.year)
73
+ off = nil
74
+ zone = zone.upcase
75
+ if /\A([+-])(\d\d):?(\d\d)\z/ =~ zone
76
+ off = ($1 == '-' ? -1 : 1) * ($2.to_i * 60 + $3.to_i) * 60
77
+ elsif /\A[+-]\d\d\z/ =~ zone
78
+ off = zone.to_i * 3600
79
+ elsif ZoneOffset.include?(zone)
80
+ off = ZoneOffset[zone] * 3600
81
+ elsif ((t = self.local(year, 1, 1)).zone.upcase == zone rescue false)
82
+ off = t.utc_offset
83
+ elsif ((t = self.local(year, 7, 1)).zone.upcase == zone rescue false)
84
+ off = t.utc_offset
85
+ end
86
+ off
87
+ end
88
+
89
+ def zone_utc?(zone)
90
+ # * +0000 means localtime. [RFC 2822]
91
+ # * GMT is a localtime abbreviation in Europe/London, etc.
92
+ if /\A(?:-00:00|-0000|-00|UTC|Z|UT)\z/i =~ zone
93
+ true
94
+ else
95
+ false
96
+ end
97
+ end
98
+ private :zone_utc?
99
+
100
+ LeapYearMonthDays = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
101
+ CommonYearMonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
102
+ def month_days(y, m)
103
+ if ((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)
104
+ LeapYearMonthDays[m-1]
105
+ else
106
+ CommonYearMonthDays[m-1]
107
+ end
108
+ end
109
+ private :month_days
110
+
111
+ def apply_offset(year, mon, day, hour, min, sec, off)
112
+ if off < 0
113
+ off = -off
114
+ off, o = off.divmod(60)
115
+ if o != 0 then sec += o; o, sec = sec.divmod(60); off += o end
116
+ off, o = off.divmod(60)
117
+ if o != 0 then min += o; o, min = min.divmod(60); off += o end
118
+ off, o = off.divmod(24)
119
+ if o != 0 then hour += o; o, hour = hour.divmod(24); off += o end
120
+ if off != 0
121
+ day += off
122
+ if month_days(year, mon) < day
123
+ mon += 1
124
+ if 12 < mon
125
+ mon = 1
126
+ year += 1
127
+ end
128
+ day = 1
129
+ end
130
+ end
131
+ elsif 0 < off
132
+ off, o = off.divmod(60)
133
+ if o != 0 then sec -= o; o, sec = sec.divmod(60); off -= o end
134
+ off, o = off.divmod(60)
135
+ if o != 0 then min -= o; o, min = min.divmod(60); off -= o end
136
+ off, o = off.divmod(24)
137
+ if o != 0 then hour -= o; o, hour = hour.divmod(24); off -= o end
138
+ if off != 0 then
139
+ day -= off
140
+ if day < 1
141
+ mon -= 1
142
+ if mon < 1
143
+ year -= 1
144
+ mon = 12
145
+ end
146
+ day = month_days(year, mon)
147
+ end
148
+ end
149
+ end
150
+ return year, mon, day, hour, min, sec
151
+ end
152
+ private :apply_offset
153
+
154
+ def make_time(year, mon, day, hour, min, sec, sec_fraction, zone, now)
155
+ usec = nil
156
+ usec = sec_fraction * 1000000 if sec_fraction
157
+ if now
158
+ begin
159
+ break if year; year = now.year
160
+ break if mon; mon = now.mon
161
+ break if day; day = now.day
162
+ break if hour; hour = now.hour
163
+ break if min; min = now.min
164
+ break if sec; sec = now.sec
165
+ break if sec_fraction; usec = now.tv_usec
166
+ end until true
167
+ end
168
+
169
+ year ||= 1970
170
+ mon ||= 1
171
+ day ||= 1
172
+ hour ||= 0
173
+ min ||= 0
174
+ sec ||= 0
175
+ usec ||= 0
176
+
177
+ off = nil
178
+ off = zone_offset(zone, year) if zone
179
+
180
+ if off
181
+ year, mon, day, hour, min, sec =
182
+ apply_offset(year, mon, day, hour, min, sec, off)
183
+ t = self.utc(year, mon, day, hour, min, sec, usec)
184
+ t.localtime if !zone_utc?(zone)
185
+ t
186
+ else
187
+ self.local(year, mon, day, hour, min, sec, usec)
188
+ end
189
+ end
190
+ private :make_time
191
+
192
+ #
193
+ # Parses +date+ using Date._parse and converts it to a Time object.
194
+ #
195
+ # If a block is given, the year described in +date+ is converted by the
196
+ # block. For example:
197
+ #
198
+ # Time.parse(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}
199
+ #
200
+ # If the upper components of the given time are broken or missing, they are
201
+ # supplied with those of +now+. For the lower components, the minimum
202
+ # values (1 or 0) are assumed if broken or missing. For example:
203
+ #
204
+ # # Suppose it is "Thu Nov 29 14:33:20 GMT 2001" now and
205
+ # # your timezone is GMT:
206
+ # Time.parse("16:30") #=> Thu Nov 29 16:30:00 GMT 2001
207
+ # Time.parse("7/23") #=> Mon Jul 23 00:00:00 GMT 2001
208
+ # Time.parse("Aug 31") #=> Fri Aug 31 00:00:00 GMT 2001
209
+ #
210
+ # Since there are numerous conflicts among locally defined timezone
211
+ # abbreviations all over the world, this method is not made to
212
+ # understand all of them. For example, the abbreviation "CST" is
213
+ # used variously as:
214
+ #
215
+ # -06:00 in America/Chicago,
216
+ # -05:00 in America/Havana,
217
+ # +08:00 in Asia/Harbin,
218
+ # +09:30 in Australia/Darwin,
219
+ # +10:30 in Australia/Adelaide,
220
+ # etc.
221
+ #
222
+ # Based on the fact, this method only understands the timezone
223
+ # abbreviations described in RFC 822 and the system timezone, in the
224
+ # order named. (i.e. a definition in RFC 822 overrides the system
225
+ # timezone definition.) The system timezone is taken from
226
+ # <tt>Time.local(year, 1, 1).zone</tt> and
227
+ # <tt>Time.local(year, 7, 1).zone</tt>.
228
+ # If the extracted timezone abbreviation does not match any of them,
229
+ # it is ignored and the given time is regarded as a local time.
230
+ #
231
+ # ArgumentError is raised if Date._parse cannot extract information from
232
+ # +date+ or Time class cannot represent specified date.
233
+ #
234
+ # This method can be used as fail-safe for other parsing methods as:
235
+ #
236
+ # Time.rfc2822(date) rescue Time.parse(date)
237
+ # Time.httpdate(date) rescue Time.parse(date)
238
+ # Time.xmlschema(date) rescue Time.parse(date)
239
+ #
240
+ # A failure for Time.parse should be checked, though.
241
+ #
242
+ def parse(date, now=self.now)
243
+ d = Date._parse(date, false)
244
+ year = d[:year]
245
+ year = yield(year) if year && block_given?
246
+ make_time(year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], now)
247
+ end
248
+
249
+ #
250
+ # Parses +date+ using Date._strptime and converts it to a Time object.
251
+ #
252
+ # If a block is given, the year described in +date+ is converted by the
253
+ # block. For example:
254
+ #
255
+ # Time.strptime(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}
256
+ def strptime(date, format, now=self.now)
257
+ d = Date._strptime(date, format)
258
+ raise ArgumentError, "invalid strptime format - `#{format}'" unless d
259
+ year = d[:year]
260
+ year = yield(year) if year && block_given?
261
+ make_time(year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], now)
262
+ end
263
+
264
+ MonthValue = {
265
+ 'JAN' => 1, 'FEB' => 2, 'MAR' => 3, 'APR' => 4, 'MAY' => 5, 'JUN' => 6,
266
+ 'JUL' => 7, 'AUG' => 8, 'SEP' => 9, 'OCT' =>10, 'NOV' =>11, 'DEC' =>12
267
+ }
268
+
269
+ #
270
+ # Parses +date+ as date-time defined by RFC 2822 and converts it to a Time
271
+ # object. The format is identical to the date format defined by RFC 822 and
272
+ # updated by RFC 1123.
273
+ #
274
+ # ArgumentError is raised if +date+ is not compliant with RFC 2822
275
+ # or Time class cannot represent specified date.
276
+ #
277
+ # See #rfc2822 for more information on this format.
278
+ #
279
+ def rfc2822(date)
280
+ if /\A\s*
281
+ (?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s*,\s*)?
282
+ (\d{1,2})\s+
283
+ (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+
284
+ (\d{2,})\s+
285
+ (\d{2})\s*
286
+ :\s*(\d{2})\s*
287
+ (?::\s*(\d{2}))?\s+
288
+ ([+-]\d{4}|
289
+ UT|GMT|EST|EDT|CST|CDT|MST|MDT|PST|PDT|[A-IK-Z])/ix =~ date
290
+ # Since RFC 2822 permit comments, the regexp has no right anchor.
291
+ day = $1.to_i
292
+ mon = MonthValue[$2.upcase]
293
+ year = $3.to_i
294
+ hour = $4.to_i
295
+ min = $5.to_i
296
+ sec = $6 ? $6.to_i : 0
297
+ zone = $7
298
+
299
+ # following year completion is compliant with RFC 2822.
300
+ year = if year < 50
301
+ 2000 + year
302
+ elsif year < 1000
303
+ 1900 + year
304
+ else
305
+ year
306
+ end
307
+
308
+ year, mon, day, hour, min, sec =
309
+ apply_offset(year, mon, day, hour, min, sec, zone_offset(zone))
310
+ t = self.utc(year, mon, day, hour, min, sec)
311
+ t.localtime if !zone_utc?(zone)
312
+ t
313
+ else
314
+ raise ArgumentError.new("not RFC 2822 compliant date: #{date.inspect}")
315
+ end
316
+ end
317
+ alias rfc822 rfc2822
318
+
319
+ #
320
+ # Parses +date+ as HTTP-date defined by RFC 2616 and converts it to a Time
321
+ # object.
322
+ #
323
+ # ArgumentError is raised if +date+ is not compliant with RFC 2616 or Time
324
+ # class cannot represent specified date.
325
+ #
326
+ # See #httpdate for more information on this format.
327
+ #
328
+ def httpdate(date)
329
+ if /\A\s*
330
+ (?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\x20
331
+ (\d{2})\x20
332
+ (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\x20
333
+ (\d{4})\x20
334
+ (\d{2}):(\d{2}):(\d{2})\x20
335
+ GMT
336
+ \s*\z/ix =~ date
337
+ self.rfc2822(date)
338
+ elsif /\A\s*
339
+ (?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday),\x20
340
+ (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d)\x20
341
+ (\d\d):(\d\d):(\d\d)\x20
342
+ GMT
343
+ \s*\z/ix =~ date
344
+ year = $3.to_i
345
+ if year < 50
346
+ year += 2000
347
+ else
348
+ year += 1900
349
+ end
350
+ self.utc(year(), $2, $1.to_i, $4.to_i, $5.to_i, $6.to_i)
351
+ elsif /\A\s*
352
+ (?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)\x20
353
+ (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\x20
354
+ (\d\d|\x20\d)\x20
355
+ (\d\d):(\d\d):(\d\d)\x20
356
+ (\d{4})
357
+ \s*\z/ix =~ date
358
+ self.utc($6.to_i, MonthValue[$1.upcase], $2.to_i,
359
+ $3.to_i, $4.to_i, $5.to_i)
360
+ else
361
+ raise ArgumentError.new("not RFC 2616 compliant date: #{date.inspect}")
362
+ end
363
+ end
364
+
365
+ #
366
+ # Parses +date+ as dateTime defined by XML Schema and converts it to a Time
367
+ # object. The format is restricted version of the format defined by ISO
368
+ # 8601.
369
+ #
370
+ # ArgumentError is raised if +date+ is not compliant with the format or Time
371
+ # class cannot represent specified date.
372
+ #
373
+ # See #xmlschema for more information on this format.
374
+ #
375
+ def xmlschema(date)
376
+ if /\A\s*
377
+ (-?\d+)-(\d\d)-(\d\d)
378
+ T
379
+ (\d\d):(\d\d):(\d\d)
380
+ (\.\d+)?
381
+ (Z|[+-]\d\d:\d\d)?
382
+ \s*\z/ix =~ date
383
+ year = $1.to_i
384
+ mon = $2.to_i
385
+ day = $3.to_i
386
+ hour = $4.to_i
387
+ min = $5.to_i
388
+ sec = $6.to_i
389
+ usec = 0
390
+ if $7
391
+ usec = Rational($7) * 1000000
392
+ end
393
+ if $8
394
+ zone = $8
395
+ year, mon, day, hour, min, sec =
396
+ apply_offset(year, mon, day, hour, min, sec, zone_offset(zone))
397
+ self.utc(year, mon, day, hour, min, sec, usec)
398
+ else
399
+ self.local(year, mon, day, hour, min, sec, usec)
400
+ end
401
+ else
402
+ raise ArgumentError.new("invalid date: #{date.inspect}")
403
+ end
404
+ end
405
+ alias iso8601 xmlschema
406
+ end # class << self
407
+
408
+ #
409
+ # Returns a string which represents the time as date-time defined by RFC 2822:
410
+ #
411
+ # day-of-week, DD month-name CCYY hh:mm:ss zone
412
+ #
413
+ # where zone is [+-]hhmm.
414
+ #
415
+ # If +self+ is a UTC time, -0000 is used as zone.
416
+ #
417
+ def rfc2822
418
+ sprintf('%s, %02d %s %d %02d:%02d:%02d ',
419
+ RFC2822_DAY_NAME[wday()],
420
+ day(), RFC2822_MONTH_NAME[mon()-1], year(),
421
+ hour(), min(), sec() ) +
422
+ if utc?
423
+ '-0000'
424
+ else
425
+ off = utc_offset
426
+ sign = off < 0 ? '-' : '+'
427
+ sprintf('%s%02d%02d', sign, *(off.abs / 60).divmod(60))
428
+ end
429
+ end
430
+ alias rfc822 rfc2822
431
+
432
+ RFC2822_DAY_NAME = [
433
+ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'
434
+ ]
435
+ RFC2822_MONTH_NAME = [
436
+ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
437
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
438
+ ]
439
+
440
+ #
441
+ # Returns a string which represents the time as rfc1123-date of HTTP-date
442
+ # defined by RFC 2616:
443
+ #
444
+ # day-of-week, DD month-name CCYY hh:mm:ss GMT
445
+ #
446
+ # Note that the result is always UTC (GMT).
447
+ #
448
+ def httpdate
449
+ t = dup.utc
450
+ sprintf('%s, %02d %s %d %02d:%02d:%02d GMT',
451
+ RFC2822_DAY_NAME[t.wday],
452
+ t.day, RFC2822_MONTH_NAME[t.mon-1], t.year,
453
+ t.hour, t.min, t.sec)
454
+ end
455
+
456
+ #
457
+ # Returns a string which represents the time as dateTime defined by XML
458
+ # Schema:
459
+ #
460
+ # CCYY-MM-DDThh:mm:ssTZD
461
+ # CCYY-MM-DDThh:mm:ss.sssTZD
462
+ #
463
+ # where TZD is Z or [+-]hh:mm.
464
+ #
465
+ # If self is a UTC time, Z is used as TZD. [+-]hh:mm is used otherwise.
466
+ #
467
+ # +fractional_seconds+ specifies a number of digits of fractional seconds.
468
+ # Its default value is 0.
469
+ #
470
+ def xmlschema(fraction_digits=0)
471
+ sprintf('%d-%02d-%02dT%02d:%02d:%02d',
472
+ year, mon, day, hour, min, sec) +
473
+ if fraction_digits == 0
474
+ ''
475
+ elsif fraction_digits <= 9
476
+ '.' + sprintf('%09d', nsec)[0, fraction_digits]
477
+ else
478
+ '.' + sprintf('%09d', nsec) + '0' * (fraction_digits - 9)
479
+ end +
480
+ if utc?
481
+ 'Z'
482
+ else
483
+ off = utc_offset
484
+ sign = off < 0 ? '-' : '+'
485
+ sprintf('%s%02d:%02d', sign, *(off.abs / 60).divmod(60))
486
+ end
487
+ end
488
+ alias iso8601 xmlschema
489
+ end
data/lib/version.rb ADDED
@@ -0,0 +1,8 @@
1
+ module RhodesFramework
2
+ unless defined? RhodesFramework::VERSION
3
+ VERSION = '1.0.0'
4
+ end
5
+ unless defined? RhodesFramework::DBVERSION
6
+ DBVERSION = '1.0.0'
7
+ end
8
+ end
@@ -0,0 +1,49 @@
1
+ module SQLite3 ; module Constants
2
+
3
+ module TextRep
4
+ UTF8 = 1
5
+ UTF16LE = 2
6
+ UTF16BE = 3
7
+ UTF16 = 4
8
+ ANY = 5
9
+ end
10
+
11
+ module ColumnType
12
+ INTEGER = 1
13
+ FLOAT = 2
14
+ TEXT = 3
15
+ BLOB = 4
16
+ NULL = 5
17
+ end
18
+
19
+ module ErrorCode
20
+ OK = 0 # Successful result
21
+ ERROR = 1 # SQL error or missing database
22
+ INTERNAL = 2 # An internal logic error in SQLite
23
+ PERM = 3 # Access permission denied
24
+ ABORT = 4 # Callback routine requested an abort
25
+ BUSY = 5 # The database file is locked
26
+ LOCKED = 6 # A table in the database is locked
27
+ NOMEM = 7 # A malloc() failed
28
+ READONLY = 8 # Attempt to write a readonly database
29
+ INTERRUPT = 9 # Operation terminated by sqlite_interrupt()
30
+ IOERR = 10 # Some kind of disk I/O error occurred
31
+ CORRUPT = 11 # The database disk image is malformed
32
+ NOTFOUND = 12 # (Internal Only) Table or record not found
33
+ FULL = 13 # Insertion failed because database is full
34
+ CANTOPEN = 14 # Unable to open the database file
35
+ PROTOCOL = 15 # Database lock protocol error
36
+ EMPTY = 16 # (Internal Only) Database table is empty
37
+ SCHEMA = 17 # The database schema changed
38
+ TOOBIG = 18 # Too much data for one row of a table
39
+ CONSTRAINT = 19 # Abort due to contraint violation
40
+ MISMATCH = 20 # Data type mismatch
41
+ MISUSE = 21 # Library used incorrectly
42
+ NOLFS = 22 # Uses OS features not supported on host
43
+ AUTH = 23 # Authorization denied
44
+
45
+ ROW = 100 # sqlite_step() has another row ready
46
+ DONE = 101 # sqlite_step() has finished executing
47
+ end
48
+
49
+ end ; end