YUKI Hiroshi
null+****@clear*****
Fri Nov 7 16:30:53 JST 2014
YUKI Hiroshi 2014-11-07 16:30:53 +0900 (Fri, 07 Nov 2014) New Revision: 6d31cb035776b8b12f70942e10ef828a85ff9db6 https://github.com/droonga/droonga-engine/commit/6d31cb035776b8b12f70942e10ef828a85ff9db6 Message: Validate key_type as a required parameter for some cases Modified files: lib/droonga/plugins/groonga/table_create.rb Modified: lib/droonga/plugins/groonga/table_create.rb (+25 -0) =================================================================== --- lib/droonga/plugins/groonga/table_create.rb 2014-11-07 16:26:14 +0900 (c9cd9b1) +++ lib/droonga/plugins/groonga/table_create.rb 2014-11-07 16:30:53 +0900 (52e47be) @@ -35,6 +35,8 @@ module Droonga :result => false) end + validate_key_type + options = parse_command ::Groonga::Schema.define(:context => @context) do |schema| schema.create_table(name, options) @@ -88,6 +90,29 @@ module Droonga return unless @command["normalizer"] options[:normalizer] = @command["normalizer"] end + + def validate_key_type + if****@comma*****_hash_key? and @command["key_type"].nil? + message = "key_type is required for TABLE_HASH_KEY table" + raise CommandError.new(:status => Status::INVALID_ARGUMENT, + :message => message, + :result => false) + end + + if****@comma*****_pat_key? and @command["key_type"].nil? + message = "key_type is required for TABLE_PAT_KEY table" + raise CommandError.new(:status => Status::INVALID_ARGUMENT, + :message => message, + :result => false) + end + + if****@comma*****_dat_key? and @command["key_type"].nil? + message = "key_type is required for TABLE_DAT_KEY table" + raise CommandError.new(:status => Status::INVALID_ARGUMENT, + :message => message, + :result => false) + end + end end class Handler < Droonga::Handler -------------- next part -------------- HTML����������������������������... ダウンロード