unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Rolf Ade <rolf@pointsman.de>
To: 25628@debbugs.gnu.org
Subject: bug#25628: 26.0.50; [PATCH] sql-mode w/ sqlite: In-memory database
Date: Sun, 05 Feb 2017 20:19:04 +0100	[thread overview]
Message-ID: <8737fsv42f.fsf@point> (raw)


From 8ea7a41eab9465bba14349cb948d779748bc9516 Mon Sep 17 00:00:00 2001
From: Rolf Ade <rolf@pointsman.de>
Date: Sun, 5 Feb 2017 19:46:24 +0100
Subject: [PATCH] sql-mode w/ sqlite: In-memory database

Enable the usage of an in-memory database. Prior to this, sql-mode w/
sqlite could only be used with file databases.
* list/progmodes/sql.el (sql-get-login-ext): Don't expand an empty
file name provided by the user, but call sub-process sqlite with that,
in which case it use an in-memory database.

Copyright-paperwork-exempt: yes
---
 lisp/progmodes/sql.el |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 8868343..634c6b5 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -2952,17 +2952,20 @@ sql-get-login-ext
           (use-dialog-box nil))
      (cond
       ((plist-member plist :file)
-       (expand-file-name
-        (read-file-name prompt
-                        (file-name-directory last-value) default 'confirm
-                        (file-name-nondirectory last-value)
-                        (when (plist-get plist :file)
-                          `(lambda (f)
-                             (if (not (file-regular-p f))
-                                 t
-                               (string-match
-                                (concat "\\<" ,(plist-get plist :file) "\\>")
-                                (file-name-nondirectory f))))))))
+       (let ((file-name
+              (read-file-name prompt
+                              (file-name-directory last-value) default 'confirm
+                              (file-name-nondirectory last-value)
+                              (when (plist-get plist :file)
+                                `(lambda (f)
+                                   (if (not (file-regular-p f))
+                                       t
+                                     (string-match
+                                      (concat "\\<" ,(plist-get plist :file) "\\>")
+                                      (file-name-nondirectory f))))))))
+         (if (string= file-name "")
+             ""
+           (expand-file-name file-name))))
 
       ((plist-member plist :completion)
        (completing-read prompt-def (plist-get plist :completion) nil t
-- 
1.7.3



In GNU Emacs 26.0.50.7 (i686-pc-linux-gnu, GTK+ Version 2.12.9)
 of 2017-02-04 built on point
Repository revision: f6ff7bb1fcd062fe4ebf6c89890524110501583e





             reply	other threads:[~2017-02-05 19:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-05 19:19 Rolf Ade [this message]
2017-03-02 13:35 ` bug#25628: 26.0.50; [PATCH] sql-mode w/ sqlite: In-memory database npostavs
2017-03-02 16:56   ` rolf
2017-03-03  0:12     ` npostavs

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8737fsv42f.fsf@point \
    --to=rolf@pointsman.de \
    --cc=25628@debbugs.gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).