From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Guido Van Hoecke Newsgroups: gmane.emacs.help Subject: Re: emacsql-mysql - best way to close connection? Date: Sun, 2 Apr 2017 13:31:22 +0200 Message-ID: References: <8660ioy4zl.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1491132752 17203 195.159.176.226 (2 Apr 2017 11:32:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 2 Apr 2017 11:32:32 +0000 (UTC) Cc: Christopher Wellons , Emacs To: John Mastro Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Apr 02 13:32:29 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cudk8-0003Xy-7k for geh-help-gnu-emacs@m.gmane.org; Sun, 02 Apr 2017 13:32:24 +0200 Original-Received: from localhost ([::1]:54482 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cudkE-0002uq-7D for geh-help-gnu-emacs@m.gmane.org; Sun, 02 Apr 2017 07:32:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cudjh-0002t7-1r for help-gnu-emacs@gnu.org; Sun, 02 Apr 2017 07:31:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cudjg-0002PE-6J for help-gnu-emacs@gnu.org; Sun, 02 Apr 2017 07:31:57 -0400 Original-Received: from mail-wr0-x22b.google.com ([2a00:1450:400c:c0c::22b]:35712) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cudjf-0002Or-Uy for help-gnu-emacs@gnu.org; Sun, 02 Apr 2017 07:31:56 -0400 Original-Received: by mail-wr0-x22b.google.com with SMTP id k6so127501460wre.2 for ; Sun, 02 Apr 2017 04:31:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=u5jrYWQgZeETFrwSTdNABcBDgTOQNv/VCKRoLK4A5qo=; b=gLIkE7Bq0dm4yu8JzSTGKbpSrdGA0Dklc+pjHb23bRn/J7v4a5CKkrq7Lmbp/Me2kI DEHw5Ei5zGdTv67V42QRLw6Fqais0QdJPDZXNKpdQnphiaf4rE1+np49YldgXjiKrmpy /Uu+g+5zq4hnjTGPjwLlzyYaitOF2PpV4SiWq+iVjteYrm53Bsqu+s69NJLXuk4XRfa+ XC1JpK7ZYME7FoSueKwMgWNDVWdFkp/AHjA9H354fLvJdLBBdpFozBKscvd2lisBQkqx pyIi6mPzrn/t/BrC+R7LjQja/RotASnpHoEl287OibMWSqUzjta/BcrmLs6QOu1HcEDa KINA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=u5jrYWQgZeETFrwSTdNABcBDgTOQNv/VCKRoLK4A5qo=; b=Z4Mo5BRygyGKkRYWXi26+LElA3QSLImopJ+DFiIL3cdN1z9YdOhzPt+zwG0eDgQRQd afw3F1cUI4s25vnOmJm4T8pSrbqEO4D7jIQbxDzg3adZVSUAwzEGsKR1FRpif6c9oD2r Ev26XBFppFxihgONJYEH4yRFMoALTfZGi1b0t0u16Ojppeegr/rTrawMoMTTiGKehJ7r V0Dl6B+HYt0+4ySR7rBN2f+dB0An9iGKaEkpBY6Q1syNxediJEXmUycg25QPmNCugrO9 Hr1w9/qXyAIhQO69XimX93+RyKzS/Go+k5ztQBkv/8Vfsv0PUFEHEw+Utt0XqzcI36dX reyw== X-Gm-Message-State: AFeK/H2PITVkJGqGvlqLhM0e6OBFGmxBtTmYC1ZNf8ZiR4naNpVJvaggBFRxqXG4gpOhcqzUIiF0axcVEqZC1w== X-Received: by 10.223.161.132 with SMTP id u4mr10388229wru.203.1491132713221; Sun, 02 Apr 2017 04:31:53 -0700 (PDT) Original-Received: by 10.28.6.143 with HTTP; Sun, 2 Apr 2017 04:31:22 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22b X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:112674 Archived-At: > 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)