From: Guido Van Hoecke <guivho@gmail.com>
To: John Mastro <john.b.mastro@gmail.com>
Cc: Christopher Wellons <wellons@nullprogram.com>,
Emacs <help-gnu-emacs@gnu.org>
Subject: Re: emacsql-mysql - best way to close connection?
Date: Sun, 2 Apr 2017 13:31:22 +0200 [thread overview]
Message-ID: <CAEySM9EA33C9D3rq_BvcVVUSSSuBaryKjC66JnSEN-9FryU83A@mail.gmail.com> (raw)
In-Reply-To: <CAOj2CQR-4Qn-w67MuBXq_9UPge7YVh4_0fiCHT24_jj3V_ogzg@mail.gmail.com>
> It looks like there's a function `emacsql-close' for that.
>
>
Well, somehow, (emacsql-close db) does not close the mysql connection, as
clearly indicated when executing (list-processes).
> If your code that uses the connection may raise an error (which would
> cause evaluation to never reach the call to `emacsql-close' or similar),
> then you may want to wrap it in `unwind-protect':
>
> (let* (...
> (db (emacsql-mysql "database" :user id :password pw :host
> host)))
> (unwind-protect
> (progn ...)
> (emacsql-close db)))
>
> Where you code that uses the connection would go inside the `progn'.
>
>
So I'm sticking to my (delete-process "emacsql-mysql") hack, albeit wrapped
in an (unwind-protect) form thanks to your suggestion :)
--
Guido
"I would rather spend 10 hours reading someone else's source code than
10 minutes listening to Musak waiting for technical support which isn't."
(By Dr. Greg Wettstein, Roger Maris Cancer Center)
prev parent reply other threads:[~2017-04-02 11:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-01 7:14 emacsql-mysql - best way to close connection? Guido Van Hoecke
2017-04-01 9:54 ` Guido Van Hoecke
2017-04-01 19:52 ` John Mastro
2017-04-02 11:31 ` Guido Van Hoecke [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAEySM9EA33C9D3rq_BvcVVUSSSuBaryKjC66JnSEN-9FryU83A@mail.gmail.com \
--to=guivho@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=john.b.mastro@gmail.com \
--cc=wellons@nullprogram.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.