SPI_connect

Name

SPI_connect --  Connects your procedure to the SPI manager. はユーザ定義のプロシージャを SPI マネージャに接続します。

Synopsis

int SPI_connect(void)

入力

なし。

出力

int

Return status

以下の状態を返します。

SPI_OK_CONNECT

if connected

接続された場合

SPI_ERROR_CONNECT

if not connected

接続されなかった場合

説明

SPI_connect opens a connection to the Postgres backend. You should call this function if you will need to execute queries. Some utility SPI functions may be called from un-connected procedures.

SPI_connectPostgres バックエンドとの接続を開きます。問い合わせを実行する必要がある場合は、 この関数を呼び出す必要があります。SPI ユーティリティ関数には接続を行な わないプロシージャから呼び出すことができるものもあります。

You may get SPI_ERROR_CONNECT error if SPI_connect is called from an already connected procedure - e.g. if you directly call one procedure from another connected one. Actually, while the child procedure will be able to use SPI, your parent procedure will not be able to continue to use SPI after the child returns (if SPI_finish is called by the child). It's bad practice.

既に接続済みのプロシージャから SPI_connect が呼 び出された場合は、SPI_ERROR_CONNECT という エラーが返ります。例えば、接続済みのプロシージャから直接他のプロシー ジャを呼び出すような場合です。実際には、子プロシージャがSPIを使用可能 になっている場合、(その子プロシージャから SPI_finish が呼び出されると)親プロシージャは子プ ロシージャから戻った後に SPI を使用できなくなります。これを行なうことは 良くありません。

使い方

XXX thomas 1997-12-24

アルゴリズム

SPI_connect は以下を実行します。

Initializes the SPI internal structures for query execution and memory management.

問い合わせの実行とメモリの管理を行なう SPI の内部構造体を初期化します。