Kouhei Sutou
null+****@clear*****
Wed Nov 30 16:21:17 JST 2016
Kouhei Sutou 2016-11-30 16:21:17 +0900 (Wed, 30 Nov 2016) New Revision: 2fe547b65e59865da17583aace525a69d8cfe85c https://github.com/pgroonga/pgroonga.github.io/commit/2fe547b65e59865da17583aace525a69d8cfe85c Message: Translate pgroonga.query_escape() Added files: _po/ja/reference/functions/pgroonga-query-escape.po Copied files: ja/reference/functions/pgroonga-query-escape.md (from reference/functions/pgroonga-query-escape.md) Modified files: reference/functions/pgroonga-query-escape.md reference/functions/pgroonga-query-extract-keywords.md Added: _po/ja/reference/functions/pgroonga-query-escape.po (+281 -0) 100644 =================================================================== --- /dev/null +++ _po/ja/reference/functions/pgroonga-query-escape.po 2016-11-30 16:21:17 +0900 (c30d020) @@ -0,0 +1,281 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"PO-Revision-Date: 2016-11-30 16:20+0900\n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgid "" +"---\n" +"title: pgroonga.query_escape function\n" +"---" +msgstr "" +"---\n" +"title: pgroonga.query_escape関数\n" +"---" + +msgid "# `pgroonga.query_escape` function" +msgstr "# `pgroonga.query_escape`関数" + +msgid "Since 1.1.9." +msgstr "1.1.9で追加。" + +msgid "## Summary" +msgstr "## 概要" + +msgid "" +"`pgroonga.query_escape` function escapes special characters in [query syntax](" +"http://groonga.org/docs/reference/grn_expr/query_syntax.html). Query syntax is" +" used by [`@@` operator](../operators/query.html), [`&?` operator](../operator" +"s/query-v2.html) and so on." +msgstr "" +"`pgroonga.query_escape`関数は[クエリー構文](http://groonga.org/ja/docs/reference/grn_ex" +"pr/query_syntax.html)で特別な意味を持つ文字をエスケープします。[`@@`演算子](../operators/query.html)、[" +"`&?`演算子](../operators/query-v2.html)などがクエリー構文を使っています。" + +msgid "" +"`pgroonga.query_escape` function is useful to prevent Groonga command injectio" +"n via [`pgroonga.command` function](pgroonga-command.html). See also [`pgroong" +"a.command_escape_value` function](pgroonga-command-escape-value.html) and [`pg" +"roonga.escape` function](pgroonga-escape.html) for preventing Groonga command " +"injection." +msgstr "" +"`pgroonga.query_escape`関数は[`pgroonga.command`関数](pgroonga-command.html)経由でGroo" +"ngaコマンドインジェクションが発生することを防ぐときに有用です。Groongaコマンドインジェクションを防ぐことについては[`pgroonga.comma" +"nd_escape_value`関数](pgroonga-command-escape-value.html)と[`pgroonga.escape`関数](" +"pgroonga-escape.html)も参照してください。" + +msgid "## Syntax" +msgstr "## 構文" + +msgid "Here is the syntax of this function:" +msgstr "この関数の構文は次の通りです。" + +msgid "" +"```text\n" +"text pgroonga.query_escape(query)\n" +"```" +msgstr "" + +msgid "" +"`query` is a `text` type value. It uses [query syntax](http://groonga.org/docs" +"/reference/grn_expr/query_syntax.html)." +msgstr "" +"`query`は[クエリー構文](http://groonga.org/ja/docs/reference/grn_expr/query_syntax.ht" +"ml)を使っている`text`型の値です。" + +msgid "" +"`pgroonga.query_escape` returns a `text` type value. All special characters in" +" the value are escaped." +msgstr "`pgroonga.query_escape`は`text`型の値を返します。この値中の特別な意味を持つ文字はすべてエスケープされています。" + +msgid "## Usage" +msgstr "## 使い方" + +msgid "Here are sample schema and data:" +msgstr "サンプルスキーマとデータは次の通りです。" + +msgid "" +"```sql\n" +"CREATE TABLE memos (\n" +" content text\n" +");" +msgstr "" + +msgid "" +"CREATE INDEX pgroonga_memos_index\n" +" ON memos\n" +" USING pgroonga (content);" +msgstr "" + +msgid "" +"INSERT INTO memos VALUES ('PGroonga (PostgreSQL+Groonga) is great!');\n" +"```" +msgstr "" + +msgid "" +"You get an error with the query \"(PostgreSQL\" because closed parenthesis doesn" +"'t exist:" +msgstr "クエリーが「(PostgreSQL」の場合はエラーが発生します。なぜなら対応する閉じカッコがないからです。" + +msgid "" +"```sql\n" +"SELECT * FROM memos WHERE content @@ '(PostgreSQL';\n" +"-- ERROR: pgroonga: failed to parse expression: Syntax error: <(PostgreSQL||>" +"\n" +"```" +msgstr "" + +msgid "" +"You can use the query \"(PostgreSQL\" as is (\"(\" isn't treated as a special char" +"acter) by `pgroonga.query_escape` function:" +msgstr "" +"`pgroonga.query_escape`関数を使うことで「(PostgreSQL」というクエリーそのもの(「(」を特別な文字として扱わない)で検索でき" +"ます。" + +msgid "" +"```sql\n" +"SELECT * FROM memos WHERE content @@ pgroonga.query_escape('(PostgreSQL');\n" +"-- content \n" +"-- -----------------------------------------\n" +"-- PGroonga (PostgreSQL+Groonga) is great!\n" +"-- (1 row)\n" +"```" +msgstr "" + +msgid "" +"The same thing is occurred with [`pgroonga.command` function](pgroonga-command" +".html):" +msgstr "[`pgroonga.command`関数](pgroonga-command.html)でも同じことが発生します。" + +msgid "" +"```sql\n" +"SELECT jsonb_pretty(\n" +" pgroonga.command('select ' ||\n" +" '--table ' || pgroonga.table_name('pgroonga_memos_index') |" +"| ' ' ||\n" +" '--match_columns content ' ||\n" +" '--query \"(PostgreSQL\"')::jsonb\n" +");\n" +"-- jsonb_pretty \n" +"-- ------------------------------------------\n" +"-- [ +\n" +"-- [ +\n" +"-- -63, +\n" +"-- 1480432652.751489, +\n" +"-- 0.0007565021514892578, +\n" +"-- \"Syntax error: <(PostgreSQL||>\" +\n" +"-- ] +\n" +"-- ]\n" +"-- (1 row)\n" +"```" +msgstr "" + +msgid "" +"`pgroonga.query_escape` function with [`pgroonga.command_escape_value` functio" +"n](pgroonga-command-escape-value.html) can prevent the case:" +msgstr "" +"`pgroonga.query_escape`関数を[`pgroonga.command_escape_value`関数](pgroonga-command" +"-escape-value.html)と一緒に使うとこのケースを防ぐことができます。" + +msgid "" +"```sql\n" +"SELECT jsonb_pretty(\n" +" pgroonga.command('select ' ||\n" +" '--table ' || pgroonga.table_name('pgroonga_memos_index') |" +"| ' ' ||\n" +" '--match_columns content ' ||\n" +" '--query ' || pgroonga.command_escape_value(pgroonga.query_" +"escape('(PostgreSQL')))::jsonb\n" +");\n" +"-- jsonb_pretty \n" +"-- ------------------------------------------------------------\n" +"-- [ +\n" +"-- [ +\n" +"-- 0, +\n" +"-- 1480432832.061276, +\n" +"-- 0.0252687931060791 +\n" +"-- ], +\n" +"-- [ +\n" +"-- [ +\n" +"-- [ +\n" +"-- 1 +\n" +"-- ], +\n" +"-- [ +\n" +"-- [ +\n" +"-- \"_id\", +\n" +"-- \"UInt32\" +\n" +"-- ], +\n" +"-- [ +\n" +"-- \"content\", +\n" +"-- \"LongText\" +\n" +"-- ], +\n" +"-- [ +\n" +"-- \"ctid\", +\n" +"-- \"UInt64\" +\n" +"-- ] +\n" +"-- ], +\n" +"-- [ +\n" +"-- 1, +\n" +"-- \"PGroonga (PostgreSQL+Groonga) is great!\",+\n" +"-- 1 +\n" +"-- ] +\n" +"-- ] +\n" +"-- ] +\n" +"-- ]\n" +"-- (1 row)\n" +"```" +msgstr "" + +msgid "" +"You can also use arguments array style [`pgroonga.command` function](pgroonga-" +"command.html):" +msgstr "" +"コマンドの引数を配列で指定するスタイルで[`pgroonga.command`関数](pgroonga-command.html)使ってもこのケースを防ぐこ" +"とができます。" + +msgid "" +"```sql\n" +"SELECT jsonb_pretty(\n" +" pgroonga.command('select',\n" +" ARRAY[\n" +" 'table', pgroonga.table_name('pgroonga_memos_index'),\n" +" 'match_columns', 'content',\n" +" 'query', pgroonga.query_escape('(PostgreSQL')\n" +" ])::jsonb\n" +");\n" +"-- jsonb_pretty \n" +"-- ------------------------------------------------------------\n" +"-- [ +\n" +"-- [ +\n" +"-- 0, +\n" +"-- 1480433038.482539, +\n" +"-- 0.0001201629638671875 +\n" +"-- ], +\n" +"-- [ +\n" +"-- [ +\n" +"-- [ +\n" +"-- 1 +\n" +"-- ], +\n" +"-- [ +\n" +"-- [ +\n" +"-- \"_id\", +\n" +"-- \"UInt32\" +\n" +"-- ], +\n" +"-- [ +\n" +"-- \"content\", +\n" +"-- \"LongText\" +\n" +"-- ], +\n" +"-- [ +\n" +"-- \"ctid\", +\n" +"-- \"UInt64\" +\n" +"-- ] +\n" +"-- ], +\n" +"-- [ +\n" +"-- 1, +\n" +"-- \"PGroonga (PostgreSQL+Groonga) is great!\",+\n" +"-- 1 +\n" +"-- ] +\n" +"-- ] +\n" +"-- ] +\n" +"-- ]\n" +"-- (1 row)\n" +"```" +msgstr "" + +msgid "## See also" +msgstr "## 参考" + +msgid " * [`pgroonga.command` function](pgroonga-command.html)" +msgstr " * [`pgroonga.command`関数](pgroonga-command.html)" + +msgid "" +" * [`pgroonga.command_escape_value` function](pgroonga-command-escape-value.h" +"tml)" +msgstr " * [`pgroonga.command_escape_value`関数](pgroonga-command-escape-value.html)" + +msgid " * [`pgroonga.escape` function](pgroonga-escape.html)" +msgstr " * [`pgroonga.escape`関数](pgroonga-escape.html)" Copied: ja/reference/functions/pgroonga-query-escape.md (+21 -21) 74% =================================================================== --- reference/functions/pgroonga-query-escape.md 2016-11-30 16:05:04 +0900 (d3869d1) +++ ja/reference/functions/pgroonga-query-escape.md 2016-11-30 16:21:17 +0900 (c685980) @@ -1,32 +1,32 @@ --- -title: pgroonga.query_escape function +title: pgroonga.query_escape関数 --- -# `pgroonga.query_escape` function +# `pgroonga.query_escape`関数 -Since 1.1.9. +1.1.9で追加。 -## Summary +## 概要 -`pgroonga.query_escape` function escapes special characters in [query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html). Query syntax is used by [`@@` operator](../operators/query.html), [`&?` operator](../operators/query-v2.html) and so on. +`pgroonga.query_escape`関数は[クエリー構文](http://groonga.org/ja/docs/reference/grn_expr/query_syntax.html)で特別な意味を持つ文字をエスケープします。[`@@`演算子](../operators/query.html)、[`&?`演算子](../operators/query-v2.html)などがクエリー構文を使っています。 -`pgroonga.query_escape` function is useful to prevent Groonga command injection via [`pgroonga.command` function](pgroonga-command.html). See also [`pgroonga.command_escape_value` function](pgroonga-command-escape-value.html) and [`pgroonga.escape` function](pgroonga-escape.html) for prevent Groonga command injection. +`pgroonga.query_escape`関数は[`pgroonga.command`関数](pgroonga-command.html)経由でGroongaコマンドインジェクションが発生することを防ぐときに有用です。Groongaコマンドインジェクションを防ぐことについては[`pgroonga.command_escape_value`関数](pgroonga-command-escape-value.html)と[`pgroonga.escape`関数](pgroonga-escape.html)も参照してください。 -## Syntax +## 構文 -Here is the syntax of this function: +この関数の構文は次の通りです。 ```text text pgroonga.query_escape(query) ``` -`query` is a text that uses [query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html). +`query`は[クエリー構文](http://groonga.org/ja/docs/reference/grn_expr/query_syntax.html)を使っている`text`型の値です。 -`pgroonga.query_escape` returns a text. All special characters in the text are escaped. +`pgroonga.query_escape`は`text`型の値を返します。この値中の特別な意味を持つ文字はすべてエスケープされています。 -## Usage +## 使い方 -Here are sample schema and data: +サンプルスキーマとデータは次の通りです。 ```sql CREATE TABLE memos ( @@ -40,14 +40,14 @@ CREATE INDEX pgroonga_memos_index INSERT INTO memos VALUES ('PGroonga (PostgreSQL+Groonga) is great!'); ``` -You get an error with the query `(PostgreSQL` because closed parenthesis doesn't exist: +クエリーが「(PostgreSQL」の場合はエラーが発生します。なぜなら対応する閉じカッコがないからです。 ```sql SELECT * FROM memos WHERE content @@ '(PostgreSQL'; -- ERROR: pgroonga: failed to parse expression: Syntax error: <(PostgreSQL||> ``` -You can use the query `(PostgreSQL` as is (`(` isn't treated as a special character) by `pgroonga.query_escape` function: +`pgroonga.query_escape`関数を使うことで「(PostgreSQL」というクエリーそのもの(「(」を特別な文字として扱わない)で検索できます。 ```sql SELECT * FROM memos WHERE content @@ pgroonga.query_escape('(PostgreSQL'); @@ -57,7 +57,7 @@ SELECT * FROM memos WHERE content @@ pgroonga.query_escape('(PostgreSQL'); -- (1 row) ``` -The same thing is occurred with [`pgroonga.command`](pgroonga-command.html): +[`pgroonga.command`関数](pgroonga-command.html)でも同じことが発生します。 ```sql SELECT jsonb_pretty( @@ -79,7 +79,7 @@ SELECT jsonb_pretty( -- (1 row) ``` -`pgroonga.query_escape` with [`pgroonga.command_escape_value`](pgroonga-command-escape-value.html) can also prevent the case: +`pgroonga.query_escape`関数を[`pgroonga.command_escape_value`関数](pgroonga-command-escape-value.html)と一緒に使うとこのケースを防ぐことができます。 ```sql SELECT jsonb_pretty( @@ -126,7 +126,7 @@ SELECT jsonb_pretty( -- (1 row) ``` -You can also use arguments array style [`pgroonga.command`](pgroonga-command.html): +コマンドの引数を配列で指定するスタイルで[`pgroonga.command`関数](pgroonga-command.html)使ってもこのケースを防ぐことができます。 ```sql SELECT jsonb_pretty( @@ -175,10 +175,10 @@ SELECT jsonb_pretty( -- (1 row) ``` -## See also +## 参考 - * [`pgroonga.command` function](pgroonga-command.html) + * [`pgroonga.command`関数](pgroonga-command.html) - * [`pgroonga.command_escape_value` function](pgroonga-command-escape-value.html) + * [`pgroonga.command_escape_value`関数](pgroonga-command-escape-value.html) - * [`pgroonga.escape` function](pgroonga-escape.html) + * [`pgroonga.escape`関数](pgroonga-escape.html) Modified: reference/functions/pgroonga-query-escape.md (+8 -8) =================================================================== --- reference/functions/pgroonga-query-escape.md 2016-11-30 16:05:04 +0900 (d3869d1) +++ reference/functions/pgroonga-query-escape.md 2016-11-30 16:21:17 +0900 (97255e9) @@ -10,7 +10,7 @@ Since 1.1.9. `pgroonga.query_escape` function escapes special characters in [query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html). Query syntax is used by [`@@` operator](../operators/query.html), [`&?` operator](../operators/query-v2.html) and so on. -`pgroonga.query_escape` function is useful to prevent Groonga command injection via [`pgroonga.command` function](pgroonga-command.html). See also [`pgroonga.command_escape_value` function](pgroonga-command-escape-value.html) and [`pgroonga.escape` function](pgroonga-escape.html) for prevent Groonga command injection. +`pgroonga.query_escape` function is useful to prevent Groonga command injection via [`pgroonga.command` function](pgroonga-command.html). See also [`pgroonga.command_escape_value` function](pgroonga-command-escape-value.html) and [`pgroonga.escape` function](pgroonga-escape.html) for preventing Groonga command injection. ## Syntax @@ -20,9 +20,9 @@ Here is the syntax of this function: text pgroonga.query_escape(query) ``` -`query` is a text that uses [query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html). +`query` is a `text` type value. It uses [query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html). -`pgroonga.query_escape` returns a text. All special characters in the text are escaped. +`pgroonga.query_escape` returns a `text` type value. All special characters in the value are escaped. ## Usage @@ -40,14 +40,14 @@ CREATE INDEX pgroonga_memos_index INSERT INTO memos VALUES ('PGroonga (PostgreSQL+Groonga) is great!'); ``` -You get an error with the query `(PostgreSQL` because closed parenthesis doesn't exist: +You get an error with the query "(PostgreSQL" because closed parenthesis doesn't exist: ```sql SELECT * FROM memos WHERE content @@ '(PostgreSQL'; -- ERROR: pgroonga: failed to parse expression: Syntax error: <(PostgreSQL||> ``` -You can use the query `(PostgreSQL` as is (`(` isn't treated as a special character) by `pgroonga.query_escape` function: +You can use the query "(PostgreSQL" as is ("(" isn't treated as a special character) by `pgroonga.query_escape` function: ```sql SELECT * FROM memos WHERE content @@ pgroonga.query_escape('(PostgreSQL'); @@ -57,7 +57,7 @@ SELECT * FROM memos WHERE content @@ pgroonga.query_escape('(PostgreSQL'); -- (1 row) ``` -The same thing is occurred with [`pgroonga.command`](pgroonga-command.html): +The same thing is occurred with [`pgroonga.command` function](pgroonga-command.html): ```sql SELECT jsonb_pretty( @@ -79,7 +79,7 @@ SELECT jsonb_pretty( -- (1 row) ``` -`pgroonga.query_escape` with [`pgroonga.command_escape_value`](pgroonga-command-escape-value.html) can also prevent the case: +`pgroonga.query_escape` function with [`pgroonga.command_escape_value` function](pgroonga-command-escape-value.html) can prevent the case: ```sql SELECT jsonb_pretty( @@ -126,7 +126,7 @@ SELECT jsonb_pretty( -- (1 row) ``` -You can also use arguments array style [`pgroonga.command`](pgroonga-command.html): +You can also use arguments array style [`pgroonga.command` function](pgroonga-command.html): ```sql SELECT jsonb_pretty( Modified: reference/functions/pgroonga-query-extract-keywords.md (+1 -1) =================================================================== --- reference/functions/pgroonga-query-extract-keywords.md 2016-11-30 16:05:04 +0900 (efd20dd) +++ reference/functions/pgroonga-query-extract-keywords.md 2016-11-30 16:21:17 +0900 (5eef855) @@ -20,7 +20,7 @@ Here is the syntax of this function: text[] pgroonga.query_extract_keywords(query) ``` -`query` is a text that uses [query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html). +`query` is a `text` type value. It uses [query syntax](http://groonga.org/docs/reference/grn_expr/query_syntax.html). `pgroonga.query_extract_keywords` returns an array of keywords. -------------- next part -------------- HTML����������������������������...下載