Skip to content

Commit

Permalink
【カスタムコンテンツ】フィールドでSQLの予約語を利用するとカスタムエントリーが正常に動作しない問題を改善 #3193
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Apr 18, 2024
1 parent 1935c27 commit 691a9ea
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
31 changes: 30 additions & 1 deletion plugins/baser-core/config/setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,36 @@
* 予約語
* 主にDBの予約語としてテーブルのフィールドで利用できない名称
*/
'reservedWords' => ['group', 'rows', 'option'],
'reservedWords' => ["accessible", "add", "all", "alter", "analyze", "and", "array", "as", "asc", "asensitive",
"before", "between", "bigint", "binary", "blob", "both", "by", "call", "cascade", "case", "change", "char",
"character", "check", "collate", "column", "condition", "constraint", "continue", "convert", "create",
"cross", "cube", "cume_dist", "current_date", "current_time", "current_timestamp", "current_user",
"cursor", "database", "databases", "day_hour", "day_microsecond", "day_minute", "day_second",
"dec", "decimal", "declare", "default", "delayed", "delete", "dense_rank", "desc", "describe",
"deterministic", "distinct", "distinctrow", "div", "double", "drop", "dual", "each", "else",
"elseif", "empty", "enclosed", "escaped", "except", "exists", "exit", "explain", "false", "fetch",
"first_value", "float", "float4", "float8", "for", "force", "foreign", "from", "fulltext", "function",
"generated", "get", "grant", "group", "grouping", "groups", "having", "high_priority", "hour_microsecond",
"hour_minute", "hour_second", "if", "ignore", "in", "index", "infilex", "inner", "inout", "insensitive",
"insert", "int", "int1", "int2", "int3", "int4", "int8", "integer", "interval", "into", "io_after_gtids",
"io_before_gtids", "is", "iterate", "join", "json_table", "key", "keys", "kill", "lag", "last_value",
"lateral", "lead", "leading", "leave", "left", "like", "limit", "linear", "lines", "load", "localtime",
"localtimestamp", "lock", "long", "longblob", "longtext", "loop", "low_priority", "master", "master_bind",
"master_ssl_verify_server_cert", "match", "maxvalue", "mediumblob", "mediumint", "mediumtext", "member",
"middleint", "minute_microsecond", "minute_second", "mod", "modifies", "natural", "not",
"no_write_to_binlog", "nth_value", "ntile", "null", "numeric", "of", "on", "optimize", "optimizer_costs",
"option", "optionally", "or", "order", "out", "outer", "outfile", "over", "partition", "percent_rank",
"precision", "primary", "procedure", "purge", "range", "rank", "read", "reads", "read_write", "real",
"recursive", "references", "regexp", "release", "rename", "repeat", "replace", "require", "resignal",
"restrict", "return", "revoke", "right", "rlike", "row", "rows", "row_number", "schema", "schemas",
"second_microsecond", "select", "sensitive", "separator", "set", "show", "signal", "smallint", "spatial",
"specific", "sql", "sqlexception", "sqlstate", "sqlwarning", "sql_big_result", "sql_calc_found_rows",
"sql_small_result", "ssl", "starting", "stored", "straight_join", "system", "table", "terminated", "then",
"tinyblob", "tinyint", "tinytext", "to", "trailing", "trigger", "true", "undo", "union", "unique",
"unlock", "unsigned", "update", "usage", "use", "using", "utc_date", "utc_time", "utc_timestamp", "values",
"varbinary", "varchar", "varcharacter", "varying", "virtual", "when", "where", "while", "window", "with",
"write", "xor", "year_month", "zerofill"
],

/**
* システムメッセージの言語につてサイト設定を利用する
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function validationDefault(Validator $validator): Validator
'reserved' => [
'rule' => ['reserved'],
'provider' => 'bc',
'message' => __d('baser_core', '{0} はシステム予約名称のため利用できません。', implode(', ', Configure::read('BcApp.reservedWords')))
'message' => __d('baser_core', 'システム予約名称のため利用できません。')
]]);
$validator
->scalar('title')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function test_validationDefault()
$errors = $validator->validate([
'name' => 'option',
]);
$this->assertStringContainsString( 'はシステム予約名称のため利用できません', current($errors['name']));
$this->assertStringContainsString( 'システム予約名称のため利用できません', current($errors['name']));
//既に登録のケース
CustomLinkFactory::make([
'name' => 'recruit_category',
Expand Down

0 comments on commit 691a9ea

Please sign in to comment.