YUKI Hiroshi
null+****@clear*****
Mon Apr 28 21:01:33 JST 2014
YUKI Hiroshi 2014-04-28 21:01:33 +0900 (Mon, 28 Apr 2014) New Revision: 9590f342430caba57d317376917ec11e094fb016 https://github.com/droonga/droonga-engine/commit/9590f342430caba57d317376917ec11e094fb016 Message: groonga: Don't return "false" as the body of the error response for column_list Modified files: lib/droonga/plugins/groonga/column_create.rb lib/droonga/plugins/groonga/column_remove.rb lib/droonga/plugins/groonga/column_rename.rb lib/droonga/plugins/groonga/delete.rb lib/droonga/plugins/groonga/generic_command.rb lib/droonga/plugins/groonga/table_remove.rb Modified: lib/droonga/plugins/groonga/column_create.rb (+1 -1) =================================================================== --- lib/droonga/plugins/groonga/column_create.rb 2014-04-28 20:44:01 +0900 (19ab3ca) +++ lib/droonga/plugins/groonga/column_create.rb 2014-04-28 21:01:33 +0900 (f1a2a5a) @@ -27,7 +27,7 @@ module Droonga command_class = ::Groonga::Command.find("column_create") @command = command_class.new("column_create", request) - table_name = valid_table_name("table") + table_name = valid_table_name("table", :error_result => false) if****@comma*****_index? define_index(table_name) Modified: lib/droonga/plugins/groonga/column_remove.rb (+3 -2) =================================================================== --- lib/droonga/plugins/groonga/column_remove.rb 2014-04-28 20:44:01 +0900 (857f6d3) +++ lib/droonga/plugins/groonga/column_remove.rb 2014-04-28 21:01:33 +0900 (9c782b3) @@ -27,8 +27,9 @@ module Droonga command_class = ::Groonga::Command.find("column_remove") @command = command_class.new("column_remove", request) - table_name = valid_table_name("table") - column_name = valid_column_name("name", table_name) + table_name = valid_table_name("table", :error_result => false) + column_name = valid_column_name("name", :table_name => table_name, + :error_result => false) remove_column(table_name, column_name) end Modified: lib/droonga/plugins/groonga/column_rename.rb (+3 -2) =================================================================== --- lib/droonga/plugins/groonga/column_rename.rb 2014-04-28 20:44:01 +0900 (26e82fd) +++ lib/droonga/plugins/groonga/column_rename.rb 2014-04-28 21:01:33 +0900 (5ffe304) @@ -27,8 +27,9 @@ module Droonga command_class = ::Groonga::Command.find("column_rename") @command = command_class.new("column_rename", request) - table_name = valid_table_name("table") - column_name = valid_column_name("name", table_name) + table_name = valid_table_name("table", :error_result => false) + column_name = valid_column_name("name", :table_name => table_name, + :error_result => false) new_name = @command["new_name"] Modified: lib/droonga/plugins/groonga/delete.rb (+1 -1) =================================================================== --- lib/droonga/plugins/groonga/delete.rb 2014-04-28 20:44:01 +0900 (b7c8ff9) +++ lib/droonga/plugins/groonga/delete.rb 2014-04-28 21:01:33 +0900 (d1da976) @@ -27,7 +27,7 @@ module Droonga command_class = ::Groonga::Command.find("delete") @command = command_class.new("delete", request) - table_name = valid_table_name("table") + table_name = valid_table_name("table", :error_result => false) key = @command["key"] id = @command["id"] Modified: lib/droonga/plugins/groonga/generic_command.rb (+9 -6) =================================================================== --- lib/droonga/plugins/groonga/generic_command.rb 2014-04-28 20:44:01 +0900 (a7903d2) +++ lib/droonga/plugins/groonga/generic_command.rb 2014-04-28 21:01:33 +0900 (12731d5) @@ -59,34 +59,37 @@ module Droonga header end - def valid_table_name(name) + def valid_table_name(name, params={}) + error_result = params[:error_result] table_name = @command[name] if table_name.nil? message = "you must specify table via \"#{name}\"" raise CommandError.new(:status => Status::INVALID_ARGUMENT, :message => message, - :result => false) + :result => error_result) end if @context[table_name].nil? message = "table not found: <#{table_name.to_s}>" raise CommandError.new(:status => Status::INVALID_ARGUMENT, :message => message, - :result => false) + :result => error_result) end table_name end - def valid_column_name(name, table_name) + def valid_column_name(name, params={}) + table_name = params[:table_name] + error_result = params[:error_result] column_name = @command[name] if column_name.nil? message = "you must specify column via \"#{name}\"" raise CommandError.new(:status => Status::INVALID_ARGUMENT, :message => message, - :result => false) + :result => error_result) end if @context[table_name].column(column_name).nil? @@ -94,7 +97,7 @@ module Droonga "<#{table_name.to_s}>" raise CommandError.new(:status => Status::INVALID_ARGUMENT, :message => message, - :result => false) + :result => error_result) end column_name Modified: lib/droonga/plugins/groonga/table_remove.rb (+1 -1) =================================================================== --- lib/droonga/plugins/groonga/table_remove.rb 2014-04-28 20:44:01 +0900 (81baac8) +++ lib/droonga/plugins/groonga/table_remove.rb 2014-04-28 21:01:33 +0900 (9d2c35a) @@ -27,7 +27,7 @@ module Droonga command_class = ::Groonga::Command.find("table_remove") @command = command_class.new("table_remove", request) - name = valid_table_name("name") + name = valid_table_name("name", :error_result => false) ::Groonga::Schema.define(:context => @context) do |schema| schema.remove_table(name) -------------- next part -------------- HTML����������������������������...Download