From: Rolf Ade <rolf@pointsman.de>
To: npostavs@users.sourceforge.net
Cc: 23566@debbugs.gnu.org
Subject: bug#23566: sql-sqlite: selecting database file is crippled)
Date: Tue, 03 Jan 2017 01:19:46 +0100 [thread overview]
Message-ID: <87k2adro4d.fsf@pointsman.de> (raw)
In-Reply-To: <87pok777gk.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net's message of "Sat, 31 Dec 2016 23:03:07 -0500")
Thank you to take care.
npostavs@users.sourceforge.net writes:
> Rolf Ade <rolf@pointsman.de> writes:
>
>> Therefor I propose this slightly more elaborate patch:
>>
>> [...]
>> :version "24.1"
>
> The :version should be updated when the default value is changed.
Done, see below.
>
>> [...]
>> + (if (not(file-regular-p f))
> ^^
> missed a space here
Thanks for the review and for spotting this.
> This looks reasonable to me, and is small enough to install without
> copyright assignment. Could you add a commit message too? (format as
> described in CONTRIBUTE)
Commit message:
Fix selecting SQLite database files with sql-mode (bug#23566)
* lisp/progmodes/sql.el (sql-sqlite-login-params): Allow any name as
SQLite database file name, by default.
(sql-get-login-ext): Fixed read-file-name arguments to provide
path completion even if a database name pattern is customized and to
allow creation of new SQLite database files.
Copyright-paperwork-exempt: yes
>> There is no need for fear, a user may by mistake damage a non SQLite
>> file (by not restricting the file select to a small number of file name
>> suffixes (which would't be a great strategy. if such fear had ground).
>> Every SQLite database file has a 100 byte long database header described
>> here: https://www.sqlite.org/fileformat.html#the_database_header
>
> I think the idea is more to restrict the completion to database files
> for convenience, not protection from damage. But since there doesn't
> seem to be much of a convention for sqlite file extensions, setting the
> default to nil seems okay.
I agree. Most probably, the idea was to provide some
convenience. Therefor, I didn't removed the whole machinery but fixed
it.
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index d6c9516..55ba320 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -933,10 +933,10 @@ sql-sqlite-options
:version "20.8"
:group 'SQL)
-(defcustom sql-sqlite-login-params '((database :file ".*\\.\\(db\\|sqlite[23]?\\)"))
+(defcustom sql-sqlite-login-params '((database :file nil))
"List of login parameters needed to connect to SQLite."
:type 'sql-login-params
- :version "24.1"
+ :version "26.1"
:group 'SQL)
;; Customization for MySQL
@@ -2958,9 +2958,11 @@ sql-get-login-ext
(file-name-nondirectory last-value)
(when (plist-get plist :file)
`(lambda (f)
- (string-match
- (concat "\\<" ,(plist-get plist :file) "\\>")
- (file-name-nondirectory f)))))))
+ (if (not (file-regular-p f))
+ t
+ (string-match
+ (concat "\\<" ,(plist-get plist :file) "\\>")
+ (file-name-nondirectory f))))))))
((plist-member plist :completion)
(completing-read prompt-def (plist-get plist :completion) nil t
next prev parent reply other threads:[~2017-01-03 0:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-17 20:02 bug#23566: 25.0.94; sql-sqlite: selecting database file is crippled rolf
[not found] ` <handler.23566.B.146353563826367.ack@debbugs.gnu.org>
2016-05-18 12:50 ` bug#23566: Acknowledgement (25.0.94; sql-sqlite: selecting database file is crippled) Rolf Ade
2016-07-20 23:11 ` bug#23566: " Rolf Ade
2017-01-01 3:13 ` Rolf Ade
2017-01-01 4:03 ` npostavs
2017-01-03 0:19 ` Rolf Ade [this message]
2017-01-03 23:42 ` Rolf Ade
2017-01-07 17:01 ` 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=87k2adro4d.fsf@pointsman.de \
--to=rolf@pointsman.de \
--cc=23566@debbugs.gnu.org \
--cc=npostavs@users.sourceforge.net \
/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).