[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacsql-mysql - best way to close connection?
From: |
Guido Van Hoecke |
Subject: |
emacsql-mysql - best way to close connection? |
Date: |
Sat, 01 Apr 2017 09:14:06 +0200 |
Hi,
I create a mysql connection in a let* form:
(let* ((host "mysql.host.com")
(dummy (netrc-credentials host)) ;; needed to define remaining netrc
stuff
(info (netrc-machine (netrc-parse (expand-file-name "~/.netrc")) host))
(id (cdr (assoc "login" info)))
(pw (cdr (assoc "password" info)))
(db (emacsql-mysql "database" :user id :password pw :host host)))
....)
Somehow I hoped that the connection would go away when the let* form
finishes but the connection does survive. The documentation at
[[https://github.com/skeeto/emacsql][EmacSQL]] does mention: 'It works
by maintaining a inferior process running (a "connection") for
interacting with the back-end database. Connections are automatically
cleaned up if they are garbage collected. All requests are synchronous.'
Each time the form is executed, a new connection is created. Typically
this happens once a day, but by the end of the week it accumulates 7
open connections :(
There's probably a better way to create and close connections, but up to
now I have not been able to find relevant documentation.
Please advise.
TIA,
--
Guido
After Donald Trump's stretch limousine was stolen and found
undamaged a few blocks away; he said, "Nothing was stolen. I had
an honest thief."-International Herald Tribune, page 3, March 2,
1992
- emacsql-mysql - best way to close connection?,
Guido Van Hoecke <=