Class: QDA::Backend::SQLite::DatabaseBase

Inherits:
SQLITE_DB_CLASS
  • Object
show all
Defined in:
lib/weft/backend/sqlite/database.rb

Direct Known Subclasses

FileDatabase, InMemoryDatabase

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ DatabaseBase

Returns a new instance of DatabaseBase.



25
26
27
28
29
# File 'lib/weft/backend/sqlite/database.rb', line 25

def initialize(*args)
  super(*args)
  self.results_as_hash = true
  self.synchronous = 'OFF'
end

Instance Method Details

#date_freeze(date) ⇒ Object



31
32
33
# File 'lib/weft/backend/sqlite/database.rb', line 31

def date_freeze(date)
  date ? date.strftime('%Y-%m-%d %H:%M:%S') : ''
end

#date_thaw(str) ⇒ Object



35
36
37
38
# File 'lib/weft/backend/sqlite/database.rb', line 35

def date_thaw(str)
  return nil if str.empty?
  return Time.local( *str.split(/[- :]/) )
end