all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#25628: 26.0.50; [PATCH] sql-mode w/ sqlite: In-memory database
@ 2017-02-05 19:19 Rolf Ade
  2017-03-02 13:35 ` npostavs
  0 siblings, 1 reply; 4+ messages in thread
From: Rolf Ade @ 2017-02-05 19:19 UTC (permalink / raw)
  To: 25628


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





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#25628: 26.0.50; [PATCH] sql-mode w/ sqlite: In-memory database
  2017-02-05 19:19 bug#25628: 26.0.50; [PATCH] sql-mode w/ sqlite: In-memory database Rolf Ade
@ 2017-03-02 13:35 ` npostavs
  2017-03-02 16:56   ` rolf
  0 siblings, 1 reply; 4+ messages in thread
From: npostavs @ 2017-03-02 13:35 UTC (permalink / raw)
  To: Rolf Ade; +Cc: 25628


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

Could this potentially cause problems for users of a non-sqlite
database?





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#25628: 26.0.50; [PATCH] sql-mode w/ sqlite: In-memory database
  2017-03-02 13:35 ` npostavs
@ 2017-03-02 16:56   ` rolf
  2017-03-03  0:12     ` npostavs
  0 siblings, 1 reply; 4+ messages in thread
From: rolf @ 2017-03-02 16:56 UTC (permalink / raw)
  To: npostavs; +Cc: 25628


Am 03/02/2017 02:35 PM, npostavs@users.sourceforge.net wrote:
> 
>> 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.
> 
> Could this potentially cause problems for users of a non-sqlite 
> database?

"Impossible" is a strong word and therefor I'm shy to use it, but it
comes really close to that. To start with: The product "sqlite" is the
only product of the currently supported db engines, that use the :file
property by default.

In theory, a user could have customized another product to use the :file
property for the login parameters, but even after thinking about this
(again) for a few minutes I don't see, how this could make sense (they
are client/server db systems). But even then: my patch changes only one
special case - the user enters the empty string on the read-file-name
prompt - and for every other input everything still is, as it was. And
this one single case, that is altered by my patch, wasn't a resonable
input even after the changes of #23566.

But an even stronger argument is: Prior to the unreleased changes from
#23566 it was in fact impossible (without changing the source file or
effectively replace this part of the implementation with something else
by advice overwrite), to enter the empty string on the read-file-name
prompt (because of the third argument to the read-file-name parameters).

Thanks for taking care.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#25628: 26.0.50; [PATCH] sql-mode w/ sqlite: In-memory database
  2017-03-02 16:56   ` rolf
@ 2017-03-03  0:12     ` npostavs
  0 siblings, 0 replies; 4+ messages in thread
From: npostavs @ 2017-03-03  0:12 UTC (permalink / raw)
  To: rolf; +Cc: 25628

tags 25628 fixed
close 25628 26.1
quit

Okay, sounds reasonable, pushed to master [1: 71871670c8].

1: 2017-03-02 19:01:18 -0500 71871670c816f2ecc4383ef0fe516cbd9c9f781f
  sql-mode w/ sqlite: In-memory database





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-03  0:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-05 19:19 bug#25628: 26.0.50; [PATCH] sql-mode w/ sqlite: In-memory database Rolf Ade
2017-03-02 13:35 ` npostavs
2017-03-02 16:56   ` rolf
2017-03-03  0:12     ` npostavs

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.