8.3.8. column_list

8.3.8.1. 概要

column_list コマンドはテーブルにあるカラムの一覧を返します。

8.3.8.2. 構文

column_list コマンドの引数は1つで必須です:

column_list table

8.3.8.3. 使い方

以下は column_list コマンドの簡単な使用例です。

実行例:

table_create Users TABLE_PAT_KEY ShortText
# [[0, 1337566253.89858, 0.000355720520019531], true]
column_create Users age COLUMN_SCALAR UInt8
# [[0, 1337566253.89858, 0.000355720520019531], true]
column_create Users tags COLUMN_VECTOR ShortText
# [[0, 1337566253.89858, 0.000355720520019531], true]
column_list Users
# [
#   [
#     0,
#     1337566253.89858,
#     0.000355720520019531
#   ],
#   [
#     [
#       [
#         "id",
#         "UInt32"
#       ],
#       [
#         "name",
#         "ShortText"
#       ],
#       [
#         "path",
#         "ShortText"
#       ],
#       [
#         "type",
#         "ShortText"
#       ],
#       [
#         "flags",
#         "ShortText"
#       ],
#       [
#         "domain",
#         "ShortText"
#       ],
#       [
#         "range",
#         "ShortText"
#       ],
#       [
#         "source",
#         "ShortText"
#       ]
#     ],
#     [
#       256,
#       "_key",
#       "",
#       "",
#       "COLUMN_SCALAR",
#       "Users",
#       "ShortText",
#       []
#     ],
#     [
#       257,
#       "age",
#       "/tmp/groonga-databases/commands_column_list.0000101",
#       "fix",
#       "COLUMN_SCALAR|PERSISTENT",
#       "Users",
#       "UInt8",
#       []
#     ],
#     [
#       258,
#       "tags",
#       "/tmp/groonga-databases/commands_column_list.0000102",
#       "var",
#       "COLUMN_VECTOR|PERSISTENT",
#       "Users",
#       "ShortText",
#       []
#     ]
#   ]
# ]

8.3.8.4. 引数

このセクションでは column_list の引数について説明します。

8.3.8.4.1. 必須引数

すべての引数は必須です。

8.3.8.4.1.1. table

カラムの一覧を取得するテーブルの名前を指定します。

8.3.8.5. 戻り値

column_list returns the list of column information in the table:

[
  HEADER,
  [
    COLUMN_LIST_HEADER,
    COLUMN_INFORMATION1,
    COLUMN_INFORMATION2,
    ...
  ]
]

HEADER

HEADER については 出力形式 を参照してください。

COLUMN_LIST_HEADER

COLUMN_LIST_HEADER describes about content of each COLUMN_INFORMATION.

COLUMN_LIST_HEADER is the following format:

[
  ["id",     "UInt32"],
  ["name",   "ShortText"],
  ["path",   "ShortText"],
  ["type",   "ShortText"],
  ["flags",  "ShortText"],
  ["domain", "ShortText"],
  ["range",  "ShortText"],
  ["source", "ShortText"]
]

以下のことを意味します。

  • COLUMN_INFORMATION の1番目の要素は id の値で、その値の型は UInt32 です。

  • COLUMN_INFORMATION の2番目の要素は name の値で、その値の型は ShortText です。

  • COLUMN_INFORMATION の3番目の要素は…

See the following COLUMN_INFORMATION description for details.

This field provides meta-data of column information. So this field will be useful for programs rather than humans.

COLUMN_INFORMATION

Each COLUMN_INFORMATION is the following format:

[
  ID,
  NAME,
  PATH,
  TYPE,
  FLAGS,
  DOMAIN,
  RANGE,
  SOURCES
]

ID

The column ID in the Groonga database. Normally, you don't care about it.

NAME

カラム名。

PATH

カラムのデータを保存しているパス。

TYPE

カラムの型。次のうちのどれかです。

Value

説明

fix The column is a fixed size column. Scalar column that its type is fixed size type is fixed size column.
var The column is a variable size column. Vector column or scalar column that its type is variable size type are variable size column.
index

このカラムはインデックスカラムです。

FLAGS

The flags of the column. Each flag is separated by | like COLUMN_VECTOR|WITH_WEIGHT. FLAGS must include one of COLUMN_SCALAR, COLUMN_VECTOR or COLUMN_INDEX. Other flags are optional.

有効なフラグは以下の通りです。

フラグ

説明

COLUMN_SCALAR

このカラムはスカラーカラムです。

COLUMN_VECTOR

このカラムはベクターカラムです。

COLUMN_INDEX

このカラムはインデックスカラムです。

WITH_WEIGHT The column can have weight. COLUMN_VECTOR and COLUMN_INDEX may have it. COLUMN_SCALAR doesn't have it.
WITH_SECTION

The column can have section information. COLUMN_INDEX may have it. COLUMN_SCALAR and COLUMN_VECTOR don't have it.

マルチカラムインデックスはこのフラグを持ちます。

WITH_POSITION

The column can have position information. COLUMN_INDEX may have it. COLUMN_SCALAR and COLUMN_VECTOR don't have it.

全文検索インデックスはこのフラグを持つべきです。

PERSISTENT The column is a persistent column. It means that the column isn't a 疑似カラム (pseudo_column).

DOMAIN

カラムを持っているテーブルの生です。

RANGE

The value type name of the column. It is a type name or a table name.

SOURCES

An array of the source column names of the index. If the index column is multiple column index, the array has two or more source column names.

It is always an empty array for COLUMN_SCALAR and COLUMN_VECTOR.

8.3.8.6. 参考