Documentation Home
MySQL 5.6 リファレンスマニュアル
Download this Manual
PDF (US Ltr) - 27.1Mb
PDF (A4) - 27.1Mb
HTML Download (TGZ) - 7.2Mb
HTML Download (Zip) - 7.2Mb


23.8.7.5 mysql_close()

void mysql_close(MYSQL *mysql)

説明

以前にオープンされた接続をクローズします。mysql_close() は、mysql によって指示された接続ハンドルが mysql_init() または mysql_connect() によって自動的に割り当てられている場合に、そのハンドルの割り当ても解除します。

戻り値

なし。

エラー

なし。


User Comments
  Posted by Benjamin K. on June 10, 2004
the mysql_close command need to stay near the connect command, which he closes or there is a warning like this: Warning: mysql_close(): 5 is not a valid MySQL-Link resource in /foo/bar on line 152
  Posted by Erno Szabados on October 12, 2006
If MySQL pointer was allocated by mysql_init(), and you plan to reuse the connection descriptor, then it is important to set it to NULL after mysql_close(), otherwise the next init will think it's already allocated, then the next the call for mysql_real_connect() will SEGFAULT.

At least, that's what happened to me.

Sign Up Login You must be logged in to post a comment.