vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I'd like to write CGI-BIN compiled 'C' programs that use the MySQL 'C' API. However, I'm concerned about dying processes. If a process segfaults or otherwise dies unexpectedly: a)Does the MySQL connection close automatically? b)Do table locks release automatically? Thanks, Dave. |
| |||
| "David T. Ashley" <dta@e3ft.com> wrote: > I'd like to write CGI-BIN compiled 'C' programs that use the MySQL 'C' API. > > However, I'm concerned about dying processes. If a process segfaults or > otherwise dies unexpectedly: > > a)Does the MySQL connection close automatically? > > b)Do table locks release automatically? Table locks are released automatically if the connection terminates. A client connection will be terminated by the following events: 1. when the client closes the connection explicitly 2. when the TCP connection to the server is closed 3. after connect_timeout seconds without any client action (connect_timeout is configurable in my.cnf, default: 12 hours) 4. when somebody explicitly kills the thread in the MySQL server In *most* cases the operating system will close the TCP connection(s) for dying processes. In fact I haven't witnessed other behaviour. But this may be pure luck. XL -- Axel Schwenke, Senior Software Developer, MySQL AB Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/ MySQL User Forums: http://forums.mysql.com/ |
| |||
| "Axel Schwenke" <axel.schwenke@gmx.de> wrote in message news:gjt7je.ulj.ln@xl.homelinux.org... > > Table locks are released automatically if the connection terminates. > > A client connection will be terminated by the following events: > > 1. when the client closes the connection explicitly > 2. when the TCP connection to the server is closed > 3. after connect_timeout seconds without any client action > (connect_timeout is configurable in my.cnf, default: 12 hours) > 4. when somebody explicitly kills the thread in the MySQL server > > In *most* cases the operating system will close the TCP connection(s) > for dying processes. In fact I haven't witnessed other behaviour. > But this may be pure luck. Thanks. My experimentation seems to hint at the same behavior. Just one more question ... In reading the MySQL documentation, it isn't clear to me what the difference between the standard library and the "embedded" library are. <BEGIN QUESTION> What is the "embedded" library? <END QUESTION> An "embedded" (no server) library would seem to be impossible because only the MySQL daemon can get at the MySQL database files involved. I'm thinking the standard library is what I want because if the process dies, the TCP connection closes, and the MySQL daemon cleans up everything. Thanks. |
| ||||
| "David T. Ashley" <dta@e3ft.com> wrote: > In reading the MySQL documentation, it isn't clear to me what the difference > between the standard library and the "embedded" library are. > > <BEGIN QUESTION> > What is the "embedded" library? > <END QUESTION> I guess you mean the embedded server. This is the MySQL server in form of a library. You link you programm against libmysqld. Soon after your program starts, you call mysql_server_init() to start the embedded server (running as subthread of your program now). You can access this embedded server just like the external server (the API functions are overloaded in libmysqld). However this does not work if you have several instances of your program running at the same time; i.e. if your program is a CGI app. XL -- Axel Schwenke, Senior Software Developer, MySQL AB Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/ MySQL User Forums: http://forums.mysql.com/ |