Class: Arc::DataStores::ObjectDefinitions::MysqlSchema

Inherits:
Schema
  • Object
show all
Defined in:
lib/arc/data_stores/mysql/object_definitions.rb

Instance Method Summary collapse

Methods inherited from Schema

#initialize

Constructor Details

This class inherits a constructor from Arc::DataStores::ObjectDefinitions::Schema

Instance Method Details

#execute_ddl(ddl) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/arc/data_stores/mysql/object_definitions.rb', line 17

def execute_ddl ddl
  case ddl
  when Array
    ddl = ddl.select do |stmt|
      !stmt.nil? && !stmt.empty? && !stmt == "\n"
    end
    ddl.each { |s| @data_store.execute "#{s}" }
  when String
    execute_ddl ddl.split(';')
  end        
end

#fetch_item(name) ⇒ Object



13
14
15
# File 'lib/arc/data_stores/mysql/object_definitions.rb', line 13

def fetch_item name
  MysqlTable.new name, @data_store
end

#fetch_keysObject



7
8
9
10
11
# File 'lib/arc/data_stores/mysql/object_definitions.rb', line 7

def fetch_keys
  @data_store.read("SHOW TABLES").map do |r|
    r[r.keys.first].to_sym
  end
end