Class: Arc::DataStores::ObjectDefinitions::SqliteTable
- Inherits:
-
Table
- Object
- Table
- Arc::DataStores::ObjectDefinitions::SqliteTable
show all
- Defined in:
- lib/arc/data_stores/sqlite/object_definitions.rb
Instance Attribute Summary
Attributes inherited from Table
#name
Instance Method Summary
collapse
Methods inherited from Table
#initialize
Instance Method Details
#fetch_item(column_name) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/arc/data_stores/sqlite/object_definitions.rb', line 30
def fetch_item column_name
c = raw_column_data.select {|c| c[:name] == column_name.to_s }.first || {}
c = {
name: c[:name],
allows_null: c[:notnull] == 0,
default: c[:dflt_value],
primary_key: c[:pk] == 1,
type: c[:type]
}
SqliteColumn.new @data_store, c
end
|
#fetch_keys ⇒ Object
27
28
29
|
# File 'lib/arc/data_stores/sqlite/object_definitions.rb', line 27
def fetch_keys
raw_column_data.map { |c| c[:name].to_sym }
end
|
#raw_column_data ⇒ Object
22
23
24
25
26
|
# File 'lib/arc/data_stores/sqlite/object_definitions.rb', line 22
def raw_column_data
@rcd ||= @data_store.read " PRAGMA table_info('\#{@name}'); \n SQL\nend\n"
|