开发者

Using the erlang mysql module, how is a database connection closed?

In using the erlang mysql module the exposed external functions are:

%% External exports
-export([start_link/5,
   start_link/6,
   start_link/7,
   start_link/8,

   start/5,
   start/6,
   start/7,
   start/8,

   connect/7,
   connect/8,
   connect/9,

   fetch/1,
   fetch/2,
   fetch/3,

   prepare/2,
   execute/1,
   execute/2,
   execute/3,
   execute/4,
   unprepare/1,
   get_prepared/1,
   get_prepared/2,

   transaction/2,
   transaction/3,

   get_result_field_info/1,
   get_result_rows/开发者_如何学JAVA1,
   get_result_affected_rows/1,
   get_result_reason/1,

   encode/1,
   encode/2,
   asciz_binary/2
  ]).

From the this this, it is not apparent how to close a connection. How a connection closed?


I quickly browsed through the mysql_driver code. You're right - it doesn't seem to have a mechanism to close opened connections. In fact I actually don't even see proper clean-up code to close the open sockets when a gen_server let's say gets shutdown (in the terminate method).


{Type, Result} = mysql:start_link(P1, Host, User, Passwd, DB),

stop(Result) closes the connection

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜