Class: Droonga::GroongaHandler::TableCreate

Inherits:
Command
  • Object
show all
Defined in:
lib/droonga/plugin/handler/groonga/table_create.rb

Instance Method Summary collapse

Methods inherited from Command

#execute, #initialize

Constructor Details

This class inherits a constructor from Droonga::GroongaHandler::Command

Instance Method Details

#process_request(request) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/droonga/plugin/handler/groonga/table_create.rb', line 24

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

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

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