mockley_crew 1.1.9 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mockley_crew/version.rb +1 -1
  3. data/lib/mockley_crew.rb +2 -1
  4. metadata +1 -67
  5. data/vendor/gems/sqlite3/cache/sqlite3-1.3.13.gem +0 -0
  6. data/vendor/gems/sqlite3/extensions/x86_64-linux/2.5.0/sqlite3-1.3.13/gem.build_complete +0 -0
  7. data/vendor/gems/sqlite3/extensions/x86_64-linux/2.5.0/sqlite3-1.3.13/gem_make.out +0 -33
  8. data/vendor/gems/sqlite3/extensions/x86_64-linux/2.5.0/sqlite3-1.3.13/mkmf.log +0 -592
  9. data/vendor/gems/sqlite3/extensions/x86_64-linux/2.5.0/sqlite3-1.3.13/sqlite3/sqlite3_native.so +0 -0
  10. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/API_CHANGES.rdoc +0 -50
  11. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/CHANGELOG.rdoc +0 -292
  12. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ChangeLog.cvs +0 -88
  13. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/Gemfile +0 -15
  14. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/LICENSE +0 -27
  15. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/Manifest.txt +0 -52
  16. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/README.rdoc +0 -118
  17. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/Rakefile +0 -10
  18. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/Makefile +0 -263
  19. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/backup.c +0 -168
  20. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/backup.h +0 -15
  21. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/backup.o +0 -0
  22. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/database.c +0 -888
  23. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/database.h +0 -15
  24. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/database.o +0 -0
  25. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/exception.c +0 -94
  26. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/exception.h +0 -8
  27. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/exception.o +0 -0
  28. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/extconf.rb +0 -71
  29. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/sqlite3.c +0 -152
  30. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/sqlite3.o +0 -0
  31. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/sqlite3_native.so +0 -0
  32. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/sqlite3_ruby.h +0 -52
  33. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/statement.c +0 -447
  34. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/statement.h +0 -16
  35. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/ext/sqlite3/statement.o +0 -0
  36. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/faq/faq.rb +0 -145
  37. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/faq/faq.yml +0 -426
  38. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/constants.rb +0 -49
  39. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/database.rb +0 -591
  40. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/errors.rb +0 -44
  41. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/pragmas.rb +0 -588
  42. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/resultset.rb +0 -195
  43. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/sqlite3_native.so +0 -0
  44. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb +0 -144
  45. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/translator.rb +0 -118
  46. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/value.rb +0 -57
  47. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3/version.rb +0 -25
  48. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/lib/sqlite3.rb +0 -15
  49. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/setup.rb +0 -1333
  50. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/tasks/faq.rake +0 -9
  51. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/tasks/gem.rake +0 -38
  52. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/tasks/native.rake +0 -52
  53. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/tasks/vendor_sqlite3.rake +0 -97
  54. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/helper.rb +0 -18
  55. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_backup.rb +0 -33
  56. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_collation.rb +0 -82
  57. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_database.rb +0 -430
  58. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_database_readonly.rb +0 -36
  59. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_deprecated.rb +0 -44
  60. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_encoding.rb +0 -155
  61. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_integration.rb +0 -576
  62. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_integration_open_close.rb +0 -30
  63. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_integration_pending.rb +0 -115
  64. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_integration_resultset.rb +0 -159
  65. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_integration_statement.rb +0 -194
  66. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_result_set.rb +0 -37
  67. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_sqlite3.rb +0 -21
  68. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_statement.rb +0 -260
  69. data/vendor/gems/sqlite3/gems/sqlite3-1.3.13/test/test_statement_execute.rb +0 -35
  70. data/vendor/gems/sqlite3/specifications/sqlite3-1.3.13.gemspec +0 -56
@@ -1,588 +0,0 @@
1
- require 'sqlite3/errors'
2
-
3
- module SQLite3
4
-
5
- # This module is intended for inclusion solely by the Database class. It
6
- # defines convenience methods for the various pragmas supported by SQLite3.
7
- #
8
- # For a detailed description of these pragmas, see the SQLite3 documentation
9
- # at http://sqlite.org/pragma.html.
10
- module Pragmas
11
-
12
- # Returns +true+ or +false+ depending on the value of the named pragma.
13
- def get_boolean_pragma( name )
14
- get_first_value( "PRAGMA #{name}" ) != "0"
15
- end
16
-
17
- # Sets the given pragma to the given boolean value. The value itself
18
- # may be +true+ or +false+, or any other commonly used string or
19
- # integer that represents truth.
20
- def set_boolean_pragma( name, mode )
21
- case mode
22
- when String
23
- case mode.downcase
24
- when "on", "yes", "true", "y", "t"; mode = "'ON'"
25
- when "off", "no", "false", "n", "f"; mode = "'OFF'"
26
- else
27
- raise Exception,
28
- "unrecognized pragma parameter #{mode.inspect}"
29
- end
30
- when true, 1
31
- mode = "ON"
32
- when false, 0, nil
33
- mode = "OFF"
34
- else
35
- raise Exception,
36
- "unrecognized pragma parameter #{mode.inspect}"
37
- end
38
-
39
- execute( "PRAGMA #{name}=#{mode}" )
40
- end
41
-
42
- # Requests the given pragma (and parameters), and if the block is given,
43
- # each row of the result set will be yielded to it. Otherwise, the results
44
- # are returned as an array.
45
- def get_query_pragma( name, *parms, &block ) # :yields: row
46
- if parms.empty?
47
- execute( "PRAGMA #{name}", &block )
48
- else
49
- args = "'" + parms.join("','") + "'"
50
- execute( "PRAGMA #{name}( #{args} )", &block )
51
- end
52
- end
53
-
54
- # Return the value of the given pragma.
55
- def get_enum_pragma( name )
56
- get_first_value( "PRAGMA #{name}" )
57
- end
58
-
59
- # Set the value of the given pragma to +mode+. The +mode+ parameter must
60
- # conform to one of the values in the given +enum+ array. Each entry in
61
- # the array is another array comprised of elements in the enumeration that
62
- # have duplicate values. See #synchronous, #default_synchronous,
63
- # #temp_store, and #default_temp_store for usage examples.
64
- def set_enum_pragma( name, mode, enums )
65
- match = enums.find { |p| p.find { |i| i.to_s.downcase == mode.to_s.downcase } }
66
- raise Exception,
67
- "unrecognized #{name} #{mode.inspect}" unless match
68
- execute( "PRAGMA #{name}='#{match.first.upcase}'" )
69
- end
70
-
71
- # Returns the value of the given pragma as an integer.
72
- def get_int_pragma( name )
73
- get_first_value( "PRAGMA #{name}" ).to_i
74
- end
75
-
76
- # Set the value of the given pragma to the integer value of the +value+
77
- # parameter.
78
- def set_int_pragma( name, value )
79
- execute( "PRAGMA #{name}=#{value.to_i}" )
80
- end
81
-
82
- # The enumeration of valid synchronous modes.
83
- SYNCHRONOUS_MODES = [ [ 'full', 2 ], [ 'normal', 1 ], [ 'off', 0 ] ]
84
-
85
- # The enumeration of valid temp store modes.
86
- TEMP_STORE_MODES = [ [ 'default', 0 ], [ 'file', 1 ], [ 'memory', 2 ] ]
87
-
88
- # The enumeration of valid auto vacuum modes.
89
- AUTO_VACUUM_MODES = [ [ 'none', 0 ], [ 'full', 1 ], [ 'incremental', 2 ] ]
90
-
91
- # The list of valid journaling modes.
92
- JOURNAL_MODES = [ [ 'delete' ], [ 'truncate' ], [ 'persist' ], [ 'memory' ],
93
- [ 'wal' ], [ 'off' ] ]
94
-
95
- # The list of valid locking modes.
96
- LOCKING_MODES = [ [ 'normal' ], [ 'exclusive' ] ]
97
-
98
- # The list of valid encodings.
99
- ENCODINGS = [ [ 'utf-8' ], [ 'utf-16' ], [ 'utf-16le' ], [ 'utf-16be ' ] ]
100
-
101
- # The list of valid WAL checkpoints.
102
- WAL_CHECKPOINTS = [ [ 'passive' ], [ 'full' ], [ 'restart' ], [ 'truncate' ] ]
103
-
104
- def application_id
105
- get_int_pragma "application_id"
106
- end
107
-
108
- def application_id=( integer )
109
- set_int_pragma "application_id", integer
110
- end
111
-
112
- def auto_vacuum
113
- get_enum_pragma "auto_vacuum"
114
- end
115
-
116
- def auto_vacuum=( mode )
117
- set_enum_pragma "auto_vacuum", mode, AUTO_VACUUM_MODES
118
- end
119
-
120
- def automatic_index
121
- get_boolean_pragma "automatic_index"
122
- end
123
-
124
- def automatic_index=( mode )
125
- set_boolean_pragma "automatic_index", mode
126
- end
127
-
128
- def busy_timeout
129
- get_int_pragma "busy_timeout"
130
- end
131
-
132
- def busy_timeout=( milliseconds )
133
- set_int_pragma "busy_timeout", milliseconds
134
- end
135
-
136
- def cache_size
137
- get_int_pragma "cache_size"
138
- end
139
-
140
- def cache_size=( size )
141
- set_int_pragma "cache_size", size
142
- end
143
-
144
- def cache_spill
145
- get_boolean_pragma "cache_spill"
146
- end
147
-
148
- def cache_spill=( mode )
149
- set_boolean_pragma "cache_spill", mode
150
- end
151
-
152
- def case_sensitive_like=( mode )
153
- set_boolean_pragma "case_sensitive_like", mode
154
- end
155
-
156
- def cell_size_check
157
- get_boolean_pragma "cell_size_check"
158
- end
159
-
160
- def cell_size_check=( mode )
161
- set_boolean_pragma "cell_size_check", mode
162
- end
163
-
164
- def checkpoint_fullfsync
165
- get_boolean_pragma "checkpoint_fullfsync"
166
- end
167
-
168
- def checkpoint_fullfsync=( mode )
169
- set_boolean_pragma "checkpoint_fullfsync", mode
170
- end
171
-
172
- def collation_list( &block ) # :yields: row
173
- get_query_pragma "collation_list", &block
174
- end
175
-
176
- def compile_options( &block ) # :yields: row
177
- get_query_pragma "compile_options", &block
178
- end
179
-
180
- def count_changes
181
- get_boolean_pragma "count_changes"
182
- end
183
-
184
- def count_changes=( mode )
185
- set_boolean_pragma "count_changes", mode
186
- end
187
-
188
- def data_version
189
- get_int_pragma "data_version"
190
- end
191
-
192
- def database_list( &block ) # :yields: row
193
- get_query_pragma "database_list", &block
194
- end
195
-
196
- def default_cache_size
197
- get_int_pragma "default_cache_size"
198
- end
199
-
200
- def default_cache_size=( size )
201
- set_int_pragma "default_cache_size", size
202
- end
203
-
204
- def default_synchronous
205
- get_enum_pragma "default_synchronous"
206
- end
207
-
208
- def default_synchronous=( mode )
209
- set_enum_pragma "default_synchronous", mode, SYNCHRONOUS_MODES
210
- end
211
-
212
- def default_temp_store
213
- get_enum_pragma "default_temp_store"
214
- end
215
-
216
- def default_temp_store=( mode )
217
- set_enum_pragma "default_temp_store", mode, TEMP_STORE_MODES
218
- end
219
-
220
- def defer_foreign_keys
221
- get_boolean_pragma "defer_foreign_keys"
222
- end
223
-
224
- def defer_foreign_keys=( mode )
225
- set_boolean_pragma "defer_foreign_keys", mode
226
- end
227
-
228
- def encoding
229
- get_enum_pragma "encoding"
230
- end
231
-
232
- def encoding=( mode )
233
- set_enum_pragma "encoding", mode, ENCODINGS
234
- end
235
-
236
- def foreign_key_check( *table, &block ) # :yields: row
237
- get_query_pragma "foreign_key_check", *table, &block
238
- end
239
-
240
- def foreign_key_list( table, &block ) # :yields: row
241
- get_query_pragma "foreign_key_list", table, &block
242
- end
243
-
244
- def foreign_keys
245
- get_boolean_pragma "foreign_keys"
246
- end
247
-
248
- def foreign_keys=( mode )
249
- set_boolean_pragma "foreign_keys", mode
250
- end
251
-
252
- def freelist_count
253
- get_int_pragma "freelist_count"
254
- end
255
-
256
- def full_column_names
257
- get_boolean_pragma "full_column_names"
258
- end
259
-
260
- def full_column_names=( mode )
261
- set_boolean_pragma "full_column_names", mode
262
- end
263
-
264
- def fullfsync
265
- get_boolean_pragma "fullfsync"
266
- end
267
-
268
- def fullfsync=( mode )
269
- set_boolean_pragma "fullfsync", mode
270
- end
271
-
272
- def ignore_check_constraints=( mode )
273
- set_boolean_pragma "ignore_check_constraints", mode
274
- end
275
-
276
- def incremental_vacuum( pages, &block ) # :yields: row
277
- get_query_pragma "incremental_vacuum", pages, &block
278
- end
279
-
280
- def index_info( index, &block ) # :yields: row
281
- get_query_pragma "index_info", index, &block
282
- end
283
-
284
- def index_list( table, &block ) # :yields: row
285
- get_query_pragma "index_list", table, &block
286
- end
287
-
288
- def index_xinfo( index, &block ) # :yields: row
289
- get_query_pragma "index_xinfo", index, &block
290
- end
291
-
292
- def integrity_check( *num_errors, &block ) # :yields: row
293
- get_query_pragma "integrity_check", *num_errors, &block
294
- end
295
-
296
- def journal_mode
297
- get_enum_pragma "journal_mode"
298
- end
299
-
300
- def journal_mode=( mode )
301
- set_enum_pragma "journal_mode", mode, JOURNAL_MODES
302
- end
303
-
304
- def journal_size_limit
305
- get_int_pragma "journal_size_limit"
306
- end
307
-
308
- def journal_size_limit=( size )
309
- set_int_pragma "journal_size_limit", size
310
- end
311
-
312
- def legacy_file_format
313
- get_boolean_pragma "legacy_file_format"
314
- end
315
-
316
- def legacy_file_format=( mode )
317
- set_boolean_pragma "legacy_file_format", mode
318
- end
319
-
320
- def locking_mode
321
- get_enum_pragma "locking_mode"
322
- end
323
-
324
- def locking_mode=( mode )
325
- set_enum_pragma "locking_mode", mode, LOCKING_MODES
326
- end
327
-
328
- def max_page_count
329
- get_int_pragma "max_page_count"
330
- end
331
-
332
- def max_page_count=( size )
333
- set_int_pragma "max_page_count", size
334
- end
335
-
336
- def mmap_size
337
- get_int_pragma "mmap_size"
338
- end
339
-
340
- def mmap_size=( size )
341
- set_int_pragma "mmap_size", size
342
- end
343
-
344
- def page_count
345
- get_int_pragma "page_count"
346
- end
347
-
348
- def page_size
349
- get_int_pragma "page_size"
350
- end
351
-
352
- def page_size=( size )
353
- set_int_pragma "page_size", size
354
- end
355
-
356
- def parser_trace=( mode )
357
- set_boolean_pragma "parser_trace", mode
358
- end
359
-
360
- def query_only
361
- get_boolean_pragma "query_only"
362
- end
363
-
364
- def query_only=( mode )
365
- set_boolean_pragma "query_only", mode
366
- end
367
-
368
- def quick_check( *num_errors, &block ) # :yields: row
369
- get_query_pragma "quick_check", *num_errors, &block
370
- end
371
-
372
- def read_uncommitted
373
- get_boolean_pragma "read_uncommitted"
374
- end
375
-
376
- def read_uncommitted=( mode )
377
- set_boolean_pragma "read_uncommitted", mode
378
- end
379
-
380
- def recursive_triggers
381
- get_boolean_pragma "recursive_triggers"
382
- end
383
-
384
- def recursive_triggers=( mode )
385
- set_boolean_pragma "recursive_triggers", mode
386
- end
387
-
388
- def reverse_unordered_selects
389
- get_boolean_pragma "reverse_unordered_selects"
390
- end
391
-
392
- def reverse_unordered_selects=( mode )
393
- set_boolean_pragma "reverse_unordered_selects", mode
394
- end
395
-
396
- def schema_cookie
397
- get_int_pragma "schema_cookie"
398
- end
399
-
400
- def schema_cookie=( cookie )
401
- set_int_pragma "schema_cookie", cookie
402
- end
403
-
404
- def schema_version
405
- get_int_pragma "schema_version"
406
- end
407
-
408
- def schema_version=( version )
409
- set_int_pragma "schema_version", version
410
- end
411
-
412
- def secure_delete
413
- get_boolean_pragma "secure_delete"
414
- end
415
-
416
- def secure_delete=( mode )
417
- set_boolean_pragma "secure_delete", mode
418
- end
419
-
420
- def short_column_names
421
- get_boolean_pragma "short_column_names"
422
- end
423
-
424
- def short_column_names=( mode )
425
- set_boolean_pragma "short_column_names", mode
426
- end
427
-
428
- def shrink_memory
429
- execute( "PRAGMA shrink_memory" )
430
- end
431
-
432
- def soft_heap_limit
433
- get_int_pragma "soft_heap_limit"
434
- end
435
-
436
- def soft_heap_limit=( mode )
437
- set_int_pragma "soft_heap_limit", mode
438
- end
439
-
440
- def stats( &block ) # :yields: row
441
- get_query_pragma "stats", &block
442
- end
443
-
444
- def synchronous
445
- get_enum_pragma "synchronous"
446
- end
447
-
448
- def synchronous=( mode )
449
- set_enum_pragma "synchronous", mode, SYNCHRONOUS_MODES
450
- end
451
-
452
- def temp_store
453
- get_enum_pragma "temp_store"
454
- end
455
-
456
- def temp_store=( mode )
457
- set_enum_pragma "temp_store", mode, TEMP_STORE_MODES
458
- end
459
-
460
- def threads
461
- get_int_pragma "threads"
462
- end
463
-
464
- def threads=( count )
465
- set_int_pragma "threads", count
466
- end
467
-
468
- def user_cookie
469
- get_int_pragma "user_cookie"
470
- end
471
-
472
- def user_cookie=( cookie )
473
- set_int_pragma "user_cookie", cookie
474
- end
475
-
476
- def user_version
477
- get_int_pragma "user_version"
478
- end
479
-
480
- def user_version=( version )
481
- set_int_pragma "user_version", version
482
- end
483
-
484
- def vdbe_addoptrace=( mode )
485
- set_boolean_pragma "vdbe_addoptrace", mode
486
- end
487
-
488
- def vdbe_debug=( mode )
489
- set_boolean_pragma "vdbe_debug", mode
490
- end
491
-
492
- def vdbe_listing=( mode )
493
- set_boolean_pragma "vdbe_listing", mode
494
- end
495
-
496
- def vdbe_trace
497
- get_boolean_pragma "vdbe_trace"
498
- end
499
-
500
- def vdbe_trace=( mode )
501
- set_boolean_pragma "vdbe_trace", mode
502
- end
503
-
504
- def wal_autocheckpoint
505
- get_int_pragma "wal_autocheckpoint"
506
- end
507
-
508
- def wal_autocheckpoint=( mode )
509
- set_int_pragma "wal_autocheckpoint", mode
510
- end
511
-
512
- def wal_checkpoint
513
- get_enum_pragma "wal_checkpoint"
514
- end
515
-
516
- def wal_checkpoint=( mode )
517
- set_enum_pragma "wal_checkpoint", mode, WAL_CHECKPOINTS
518
- end
519
-
520
- def writable_schema=( mode )
521
- set_boolean_pragma "writable_schema", mode
522
- end
523
-
524
- ###
525
- # Returns information about +table+. Yields each row of table information
526
- # if a block is provided.
527
- def table_info table
528
- stmt = prepare "PRAGMA table_info(#{table})"
529
- columns = stmt.columns
530
-
531
- needs_tweak_default =
532
- version_compare(SQLite3.libversion.to_s, "3.3.7") > 0
533
-
534
- result = [] unless block_given?
535
- stmt.each do |row|
536
- new_row = Hash[columns.zip(row)]
537
-
538
- # FIXME: This should be removed but is required for older versions
539
- # of rails
540
- if(Object.const_defined?(:ActiveRecord))
541
- new_row['notnull'] = new_row['notnull'].to_s
542
- end
543
-
544
- tweak_default(new_row) if needs_tweak_default
545
-
546
- if block_given?
547
- yield new_row
548
- else
549
- result << new_row
550
- end
551
- end
552
- stmt.close
553
-
554
- result
555
- end
556
-
557
- private
558
-
559
- # Compares two version strings
560
- def version_compare(v1, v2)
561
- v1 = v1.split(".").map { |i| i.to_i }
562
- v2 = v2.split(".").map { |i| i.to_i }
563
- parts = [v1.length, v2.length].max
564
- v1.push 0 while v1.length < parts
565
- v2.push 0 while v2.length < parts
566
- v1.zip(v2).each do |a,b|
567
- return -1 if a < b
568
- return 1 if a > b
569
- end
570
- return 0
571
- end
572
-
573
- # Since SQLite 3.3.8, the table_info pragma has returned the default
574
- # value of the row as a quoted SQL value. This method essentially
575
- # unquotes those values.
576
- def tweak_default(hash)
577
- case hash["dflt_value"]
578
- when /^null$/i
579
- hash["dflt_value"] = nil
580
- when /^'(.*)'$/m
581
- hash["dflt_value"] = $1.gsub(/''/, "'")
582
- when /^"(.*)"$/m
583
- hash["dflt_value"] = $1.gsub(/""/, '"')
584
- end
585
- end
586
- end
587
-
588
- end