help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacsql-mysql - best way to close connection?


From: Guido Van Hoecke
Subject: Re: emacsql-mysql - best way to close connection?
Date: Sun, 2 Apr 2017 13:31:22 +0200

> 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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]