GNU bug report logs - #25628
26.0.50; [PATCH] sql-mode w/ sqlite: In-memory database

Previous Next

Package: emacs;

Reported by: Rolf Ade <rolf <at> pointsman.de>

Date: Sun, 5 Feb 2017 19:17:01 UTC

Severity: minor

Tags: fixed, patch

Found in version 26.0.50

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25628 in the body.
You can then email your comments to 25628 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25628; Package emacs. (Sun, 05 Feb 2017 19:17:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rolf Ade <rolf <at> pointsman.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 05 Feb 2017 19:17:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rolf Ade <rolf <at> pointsman.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.0.50; [PATCH] sql-mode w/ sqlite: In-memory database
Date: Sun, 05 Feb 2017 20:19:04 +0100
From 8ea7a41eab9465bba14349cb948d779748bc9516 Mon Sep 17 00:00:00 2001
From: Rolf Ade <rolf <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25628; Package emacs. (Thu, 02 Mar 2017 13:35:02 GMT) Full text and rfc822 format available.

Message #8 received at 25628 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Rolf Ade <rolf <at> pointsman.de>
Cc: 25628 <at> debbugs.gnu.org
Subject: Re: bug#25628: 26.0.50; [PATCH] sql-mode w/ sqlite: In-memory database
Date: Thu, 02 Mar 2017 08:35:25 -0500
> From: Rolf Ade <rolf <at> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25628; Package emacs. (Thu, 02 Mar 2017 16:58:02 GMT) Full text and rfc822 format available.

Message #11 received at 25628 <at> debbugs.gnu.org (full text, mbox):

From: rolf <at> linux-qg7d.i-did-not-set--mail-host-address--so-tickle-me
To: npostavs <at> users.sourceforge.net
Cc: 25628 <at> debbugs.gnu.org
Subject: Re: bug#25628: 26.0.50; [PATCH] sql-mode w/ sqlite: In-memory database
Date: Thu, 02 Mar 2017 17:56:01 +0100
Am 03/02/2017 02:35 PM, npostavs <at> users.sourceforge.net wrote:
> 
>> From: Rolf Ade <rolf <at> 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.




Added tag(s) fixed. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Fri, 03 Mar 2017 00:11:01 GMT) Full text and rfc822 format available.

bug marked as fixed in version 26.1, send any further explanations to 25628 <at> debbugs.gnu.org and Rolf Ade <rolf <at> pointsman.de> Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Fri, 03 Mar 2017 00:11:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25628; Package emacs. (Fri, 03 Mar 2017 00:11:02 GMT) Full text and rfc822 format available.

Message #18 received at 25628 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: <rolf <at> pointsman.de>
Cc: 25628 <at> debbugs.gnu.org
Subject: Re: bug#25628: 26.0.50; [PATCH] sql-mode w/ sqlite: In-memory database
Date: Thu, 02 Mar 2017 19:12:06 -0500
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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 31 Mar 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 160 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.