pg_result

Name

pg_result -- get information about a query result -- 問い合わせ結果についての情報を得ます。

Synopsis

pg_result resultHandle resultOption

入力

resultHandle

The handle for a query result.

問い合わせ結果のハンドル。

resultOption

Specifies one of several possible options.

設定可能なオプションの内の 1 つを指定します。

オプション

-status

the status of the result.

結果のステータス

-error

the error message, if the status indicates error; otherwise an empty string.

ステータスがエラーを示していた場合はエラーメッセージ。さもなく ば、空文字列。

-conn

the connection that produced the result.

結果を作成した接続。

-oid

if the command was an INSERT, the OID of the inserted tuple; otherwise an empty string.

INSERT コマンドの場合、挿入されたタプルの OID。さもなくば空文字列。

-numTuples

the number of tuples returned by the query.

問い合わせによって返されたタプル数。

-numAttrs

the number of attributes in each tuple.

各タプルの属性数。

-assign arrayName

assign the results to an array, using subscripts of the form (tupno,attributeName).

(tupno,attributeName) という形式にインデックスされた配列に結果 を割り当てます。

-assignbyidx arrayName ?appendstr?

assign the results to an array using the first attribute's value and the remaining attributes' names as keys. If appendstr is given then it is appended to each key. In short, all but the first field of each tuple are stored into the array, using subscripts of the form (firstFieldValue,fieldNameAppendStr).

最初の属性値と残る属性名をキーとして使った配列に結果を割り当てます。 appendstr がある場合、各キーにそれを追加します。簡単にいうと、各タ プルの最初のフィールドを除く全てが、 (firstFieldValue,fieldNameAppendStr) という形式にインデックスされた 配列の中に格納されます。

-getTuple tupleNumber

returns the fields of the indicated tuple in a list. Tuple numbers start at zero.

リストから指定タプルのフィールドを返します。タプル番号は 0 から 始まります。

-tupleArray tupleNumber arrayName

stores the fields of the tuple in array arrayName, indexed by field names. Tuple numbers start at zero.

指定タプルのフィールドを、フィールド名でインデックスされた配列 arrayName に保存します。タプル番号は 0 から始まります。

-attributes

returns a list of the names of the tuple attributes.

タプル属性の名前のリストを返します。

-lAttributes

returns a list of sublists, {name ftype fsize} for each tuple attribute.

各タプルの属性について {name ftype fsize} という副リストを持つリスト を返します。

-clear

clear the result query object.

問い合わせ結果オブジェクトをクリアします。

出力

The result depends on the selected option, as described above.

結果は、上述のとおり、選択したオプションに依存します。

説明

pg_result returns information about a query result created by a prior pg_exec.

pg_result は、事前に行なわれた pg_exec によって作成された問い合わせ結果につい ての情報を返します。

You can keep a query result around for as long as you need it, but when you are done with it, be sure to free it by executing pg_result -clear. Otherwise, you have a memory leak, and Pgtcl will eventually start complaining that you've created too many query result objects.

必要な期間、問い合わせ結果を保持できます。ただし必要が無くなったら、 確実に pg_result -clear を実行して結果を開放し て下さい。さもないと、メモリリークが起って Pgtcl が突然、あまりにも 多くの問い合わせ結果オブジェクトを作成したといった警報を出すことがあ ります。