From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas =?iso-8859-1?q?R=F6hler?= Newsgroups: gmane.emacs.help Subject: sql-automatic-login Date: Fri, 29 Feb 2008 12:52:09 +0100 Message-ID: <200802291252.11049.andreas.roehler@online.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_rH/xHjGYYWf31L/" X-Trace: ger.gmane.org 1204285942 32058 80.91.229.12 (29 Feb 2008 11:52:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 29 Feb 2008 11:52:22 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Michael Mauger Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Feb 29 12:52:48 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JV3n4-0004EA-J1 for geh-help-gnu-emacs@m.gmane.org; Fri, 29 Feb 2008 12:52:38 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JV3mY-0002qU-6a for geh-help-gnu-emacs@m.gmane.org; Fri, 29 Feb 2008 06:52:06 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JV3lZ-000288-Pd for help-gnu-emacs@gnu.org; Fri, 29 Feb 2008 06:51:05 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JV3lY-00026r-UV for help-gnu-emacs@gnu.org; Fri, 29 Feb 2008 06:51:05 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JV3lY-00026d-QE for help-gnu-emacs@gnu.org; Fri, 29 Feb 2008 06:51:04 -0500 Original-Received: from moutng.kundenserver.de ([212.227.126.177]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JV3lY-0006kG-Ct for help-gnu-emacs@gnu.org; Fri, 29 Feb 2008 06:51:04 -0500 Original-Received: from noname (p54BE885A.dip0.t-ipconnect.de [84.190.136.90]) by mrelayeu.kundenserver.de (node=mrelayeu8) with ESMTP (Nemesis) id 0ML31I-1JV3lW48Oj-0004yY; Fri, 29 Feb 2008 12:51:03 +0100 User-Agent: KMail/1.9.5 X-Provags-ID: V01U2FsdGVkX1+4K3LzkKRrWdxJMh7b+CRdvynrtKbcM521AH4 38+wiAcCWHXqZqIRmxUHTkdm0E+p9f4Z/Xbt/ZKhv79gSj2HzQ 4qmgej73vpGNK7LvjRizg== X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:51968 Archived-At: --Boundary-00=_rH/xHjGYYWf31L/ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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=F6hler --Boundary-00=_rH/xHjGYYWf31L/ Content-Type: text/x-diff; charset="iso-8859-1"; name="sql.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="sql.diff" --- 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 --Boundary-00=_rH/xHjGYYWf31L/--