From: "Andreas Röhler" <andreas.roehler@online.de>
To: Michael Mauger <mmaug@yahoo.com>
Cc: help-gnu-emacs@gnu.org
Subject: sql-automatic-login
Date: Fri, 29 Feb 2008 12:52:09 +0100 [thread overview]
Message-ID: <200802291252.11049.andreas.roehler@online.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 292 bytes --]
Hi,
using sql-mysql, I'd prefer to login without being
queried, if default values are customised.
Couldn't see it in the code, so here a diff for that.
A new introduced variable `sql-automatic-login'
provides such thing doesn't happen inadvertently.
Thanks
Andreas Röhler
[-- Attachment #2: sql.diff --]
[-- Type: text/x-diff, Size: 2477 bytes --]
--- alt/sql.el 2007-09-26 02:28:25.000000000 +0200
+++ neu/sql.el 2008-02-29 12:28:49.000000000 +0100
@@ -246,6 +246,12 @@
;; These four variables will be used as defaults, if set.
+(defcustom sql-automatic-login t
+ "Login from default values without query"
+
+:type 'boolean
+:group 'SQL)
+
(defcustom sql-user ""
"*Default username."
:type 'string
@@ -1929,37 +1935,40 @@
(defun sql-get-login (&rest what)
"Get username, password and database from the user.
-
The variables `sql-user', `sql-password', `sql-server', and
`sql-database' can be customized. They are used as the default values.
Usernames, servers and databases are stored in `sql-user-history',
`sql-server-history' and `database-history'. Passwords are not stored
in a history.
-
Parameter WHAT is a list of the arguments passed to this function.
The function asks for the username if WHAT contains symbol `user', for
the password if it contains symbol `password', for the server if it
contains symbol `server', and for the database if it contains symbol
`database'. The members of WHAT are processed in the order in which
they are provided.
-
In order to ask the user for username, password and database, call the
function like this: (sql-get-login 'user 'password 'database)."
(interactive)
(while what
(cond
- ((eq (car what) 'user) ; user
+ ((eq (car what) 'user) ; user
(setq sql-user
- (read-from-minibuffer "User: " sql-user nil nil
- sql-user-history)))
- ((eq (car what) 'password) ; password
+ (if sql-automatic-login
+ sql-user
+ (read-from-minibuffer "User: " sql-user nil nil
+ sql-user-history))))
+ ((eq (car what) 'password) ; password
(setq sql-password
- (sql-read-passwd "Password: " sql-password)))
- ((eq (car what) 'server) ; server
+ (if sql-automatic-login
+ sql-password
+ (sql-read-passwd "Password: " sql-password))))
+ ((eq (car what) 'server) ; server
(setq sql-server
- (read-from-minibuffer "Server: " sql-server nil nil
- sql-server-history)))
- ((eq (car what) 'database) ; database
+ (if sql-automatic-login
+ sql-server
+ (read-from-minibuffer "Server: " sql-server nil nil
+ sql-server-history))))
+ ((eq (car what) 'database) ; database
(setq sql-database
(read-from-minibuffer "Database: " sql-database nil nil
sql-database-history))))
Diff finished. Fri Feb 29 12:33:48 2008
reply other threads:[~2008-02-29 11:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200802291252.11049.andreas.roehler@online.de \
--to=andreas.roehler@online.de \
--cc=help-gnu-emacs@gnu.org \
--cc=mmaug@yahoo.com \
/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 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.