]> git.eshelyaron.com Git - emacs.git/commitdiff
sql-mode w/ sqlite: In-memory database
authorRolf Ade <rolf@pointsman.de>
Sun, 5 Feb 2017 18:46:24 +0000 (19:46 +0100)
committerNoam Postavsky <npostavs@gmail.com>
Fri, 3 Mar 2017 00:01:18 +0000 (19:01 -0500)
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 uses an in-memory database.

Copyright-paperwork-exempt: yes

lisp/progmodes/sql.el

index 8868343129060730eaccfb42a993750ae2d6837d..634c6b57bdc81ba0936b68d2e24d90610d32a83d 100644 (file)
@@ -2952,17 +2952,20 @@ value.  (The property value is used as the PREDICATE argument to
           (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