Yasuhiro Horimoto 2019-01-05 17:21:24 +0900 (Sat, 05 Jan 2019) Revision: c7898833e4dcf24b75a7e891bd87e0da211960d8 https://github.com/groonga/groonga/commit/c7898833e4dcf24b75a7e891bd87e0da211960d8 Message: doc select: add QUERY_NO_SYNTAX_ERROR into --query_flags GitHub: fix #887 Added files: doc/source/example/reference/commands/select/query_flags_no_query_no_syntax_error.log doc/source/example/reference/commands/select/query_flags_query_no_syntax_error.log Modified files: doc/locale/ja/LC_MESSAGES/reference.po doc/source/reference/commands/select.rst Modified: doc/locale/ja/LC_MESSAGES/reference.po (+24 -0) =================================================================== --- doc/locale/ja/LC_MESSAGES/reference.po 2019-01-04 16:36:25 +0900 (b5425c354) +++ doc/locale/ja/LC_MESSAGES/reference.po 2019-01-05 17:21:24 +0900 (c90bc3f8d) @@ -12792,6 +12792,9 @@ msgstr "" msgid "``ALLOW_LEADING_NOT``" msgstr "" +msgid "``QUERY_NO_SYNTAX_ERROR``" +msgstr "" + msgid "" "``ALLOW_PRAGMA`` enables pragma at the head of ``query``. This is not " "implemented yet." @@ -12830,6 +12833,17 @@ msgstr "" "ルトでは無効になっています。もし、このフラグを使う場合は重いクエリーとなると" "いうことを十分気をつけてください。" +msgid "" +"``QUERY_NO_SYNTAX_ERROR`` enables never causes syntax error for query. This " +"flag is useful when an application uses user input directly and doesn't want " +"to show syntax error to the user and in a log. This flag is disabled by " +"default." +msgstr "" +"``QUERY_NO_SYNTAX_ERROR`` を指定すると、クエリーは構文エラーにならなくなりま" +"す。このフラグは、アプリケーションがユーザーの入力を直接使う時や、構文エラー" +"をユーザーに見せたくない時、ログに記録したくない時に便利です。このフラグは、" +"デフォルトで無効になっています。" + msgid "``NONE`` is just ignores. You can use ``NONE`` for specifying no flags." msgstr "" "``NONE`` は単に無視されます。フラグを指定しないときに ``NONE`` を使えます。" @@ -12874,6 +12888,16 @@ msgstr "" "この ``select`` コマンドは ``Entries`` テーブルの中から ``content`` カラムの" "値に ``mroonga`` を含んでいないレコードを検索します。" +msgid "Here is a usage example of ``QUERY_NO_SYNTAX_ERROR``." +msgstr "以下は ``QUERY_NO_SYNTAX_ERROR`` の使用例です。" + +msgid "" +"If you don't specify this flag, this query of example causes a syntax error " +"as below." +msgstr "" +"このフラグを指定しない場合は、以下のように、この例のクエリーは、構文エラーに" +"なります。" + msgid "Here is a usage example of ``NONE``." msgstr "以下は ``NONE`` の使用例です。" Added: doc/source/example/reference/commands/select/query_flags_no_query_no_syntax_error.log (+28 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/select/query_flags_no_query_no_syntax_error.log 2019-01-05 17:21:24 +0900 (5de68dcad) @@ -0,0 +1,28 @@ +Execution example:: + + table_create --name Magazine --flags TABLE_HASH_KEY --key_type ShortText + # [[0,1546673320.275529,0.08708477020263672],true] + column_create --table Magazine --name title --type ShortText + # [[0,1546673346.042032,0.09989762306213379],true] + load --table Magazine + [ + {"_key":"http://test.jp/magazine/webplus","title":"WEB+"}, + {"_key":"http://test.jp/magazine/database","title":"DataBase"}, + ] + # [[0,1546673366.725134,0.0009036064147949219],2] + select Magazine --output_pretty yes --match_columns title --query 'WEB +' --query_flags ALLOW_PRAGMA|ALLOW_COLUMN + # [ + # [ + # -63, + # 1546674147.89755, + # 0.0006532669067382812, + # "Syntax error: <WEB +||>", + # [ + # [ + # "yy_syntax_error", + # "grn_ecmascript.lemon", + # 37 + # ] + # ] + # ] + # ] Added: doc/source/example/reference/commands/select/query_flags_query_no_syntax_error.log (+46 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/select/query_flags_query_no_syntax_error.log 2019-01-05 17:21:24 +0900 (db24806be) @@ -0,0 +1,46 @@ +Execution example:: + + table_create --name Magazine --flags TABLE_HASH_KEY --key_type ShortText + # [[0,1546673320.275529,0.08708477020263672],true] + column_create --table Magazine --name title --type ShortText + # [[0,1546673346.042032,0.09989762306213379],true] + load --table Magazine + [ + {"_key":"http://test.jp/magazine/webplus","title":"WEB+"}, + {"_key":"http://test.jp/magazine/database","title":"DataBase"}, + ] + # [[0,1546673366.725134,0.0009036064147949219],2] + select Magazine --output_pretty yes --match_columns title --query 'WEB +' --query_flags ALLOW_PRAGMA|ALLOW_COLUMN|QUERY_NO_SYNTAX_ERROR + # [ + # [ + # 0, + # 1546673389.499156, + # 0.04232335090637207 + # ], + # [ + # [ + # [ + # 1 + # ], + # [ + # [ + # "_id", + # "UInt32" + # ], + # [ + # "_key", + # "ShortText" + # ], + # [ + # "title", + # "ShortText" + # ] + # ], + # [ + # 1, + # "http://test.jp/magazine/webplus", + # "WEB+" + # ] + # ] + # ] + # ] Modified: doc/source/reference/commands/select.rst (+31 -0) =================================================================== --- doc/source/reference/commands/select.rst 2019-01-04 16:36:25 +0900 (879cfb9ad) +++ doc/source/reference/commands/select.rst 2019-01-05 17:21:24 +0900 (edd1e6d7d) @@ -809,6 +809,7 @@ Here are available values: * ``ALLOW_COLUMN`` * ``ALLOW_UPDATE`` * ``ALLOW_LEADING_NOT`` +* ``QUERY_NO_SYNTAX_ERROR`` * ``NONE`` ``ALLOW_PRAGMA`` enables pragma at the head of ``query``. This is not @@ -828,6 +829,10 @@ syntax. The query searches records that doesn't match because it matches many records. So this flag is disabled by default. Be careful about it when you use the flag. +``QUERY_NO_SYNTAX_ERROR`` enables never causes syntax error for query. +This flag is useful when an application uses user input directly and doesn't want to show syntax error to the user and in a log. +This flag is disabled by default. + ``NONE`` is just ignores. You can use ``NONE`` for specifying no flags. They can be combined by separated ``|`` such as @@ -871,6 +876,32 @@ Here is a usage example of ``ALLOW_LEADING_NOT``. The ``select`` command searches records that don't contain ``mroonga`` in ``content`` column value from ``Entries`` table. +Here is a usage example of ``QUERY_NO_SYNTAX_ERROR``. + +.. groonga-command +.. include:: ../../example/reference/commands/select/query_flags_query_no_syntax_error.log +.. table_create --name Magazine --flags TABLE_HASH_KEY --key_type ShortText +.. column_create --table Magazine --name title --type ShortText +.. load --table Magazine +.. [ +.. {"_key":"http://test.jp/magazine/webplus","title":"WEB+"}, +.. {"_key":"http://test.jp/magazine/database","title":"DataBase"}, +.. ] +.. select Magazine --output_pretty yes --match_columns title --query 'WEB +' --query_flags ALLOW_PRAGMA|ALLOW_COLUMN|QUERY_NO_SYNTAX_ERROR + +If you don't specify this flag, this query of example causes a syntax error as below. + +.. groonga-command +.. include:: ../../example/reference/commands/select/query_flags_no_query_no_syntax_error.log +.. table_create --name Magazine --flags TABLE_HASH_KEY --key_type ShortText +.. column_create --table Magazine --name title --type ShortText +.. load --table Magazine +.. [ +.. {"_key":"http://test.jp/magazine/webplus","title":"WEB+"}, +.. {"_key":"http://test.jp/magazine/database","title":"DataBase"}, +.. ] +.. select Magazine --output_pretty yes --match_columns title --query 'WEB +' --query_flags ALLOW_PRAGMA|ALLOW_COLUMN + Here is a usage example of ``NONE``. .. groonga-command -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190105/6aa449f7/attachment-0001.html>