Class: Droonga::Plugins::Groonga::TableCreate::Command

Inherits:
GenericCommand
  • Object
show all
Defined in:
lib/droonga/plugins/groonga/table_create.rb

Instance Method Summary collapse

Methods inherited from GenericCommand

#execute, #initialize

Constructor Details

This class inherits a constructor from Droonga::Plugins::Groonga::GenericCommand

Instance Method Details

#process_request(request) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/droonga/plugins/groonga/table_create.rb', line 26

def process_request(request)
  command_class = ::Groonga::Command.find("table_create")
  @command = command_class.new("table_create", request)

  name = @command["name"]
  unless name
    message = "Should not create anonymous table"
    raise CommandError.new(:status => Status::INVALID_ARGUMENT,
                           :message => message,
                           :result => false)
  end

  validate_key_type

  options = parse_command
  ::Groonga::Schema.define(:context => @context) do |schema|
    schema.create_table(name, options)
  end
  true
end