DISCONNECT <refpurpose>terminate a database connection</refpurpose> — データベース接続を終了する
DISCONNECT connection_name
DISCONNECT [ CURRENT ]
DISCONNECT ALL
<command>DISCONNECT</command> closes a connection (or all
connections) to the database.
DISCONNECTはデータベースとの接続(またはすべての接続)を閉ざします。
connection_name #
A database connection name established by
the <command>CONNECT</command> command.
CONNECTコマンドで確立したデータベース接続の名前です。
CURRENT #
Close the <quote>current</quote> connection, which is either
the most recently opened connection, or the connection set by
the <command>SET CONNECTION</command> command. This is also
the default if no argument is given to
the <command>DISCONNECT</command> command.
直前に開いた接続またはSET CONNECTIONコマンドで設定された接続のいずれかである、「現在の」接続を閉ざします。
これはDISCONNECTに引数が与えられなかった場合のデフォルトです。
ALL #Close all open connections. 開いているすべての接続を閉じます。
int
main(void)
{
EXEC SQL CONNECT TO testdb AS con1 USER testuser;
EXEC SQL CONNECT TO testdb AS con2 USER testuser;
EXEC SQL CONNECT TO testdb AS con3 USER testuser;
EXEC SQL DISCONNECT CURRENT; /* close con3 */
EXEC SQL DISCONNECT ALL; /* close con2 and con1 */
EXEC SQL DISCONNECT CURRENT; /* con3を閉じる */
EXEC SQL DISCONNECT ALL; /* con2とcon1を閉じる */
return 0;
}
<command>DISCONNECT</command> is specified in the SQL standard.
DISCONNECTは標準SQLで規定されています。