* sql-completion.el messing with sql-mysql?
@ 2014-02-19 23:47 Frank Stutzman
2014-02-20 11:06 ` Chris Van Dusen
[not found] ` <mailman.15610.1392894407.10748.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 3+ messages in thread
From: Frank Stutzman @ 2014-02-19 23:47 UTC (permalink / raw)
To: help-gnu-emacs
Has anyone else had problems with sql-completion.el messing with sql-mysql
mode am I doing something dumb?
I'm using GNU Emacs 24.3.1. If I have no init file (--no-init) when I start
it, I have no problems with going into sql-mode and opening up a SQLi
connection to my remote database. Works great.
However, if I install sql-completion.el (version 1.1.1.1) and put:
(require 'mysql)
(require 'sql-completion)
(setq sql-interactive-mode-hook
(lambda ()
(define-key sql-interactive-mode-map "\t" 'comint-dynamic-complete)
(sql-mysql-completion-init)))
Into my .emacs file (that bit is exactly what the is sql-completion.el file
tells you to do), do a 'M-x sql-mysql' and suddenly things start breaking.
Namely, right after I enter the login information I get an error saying:
"if: ERROR 2002 (HY000): Can't connect to local MySQL server through
socket '/var/run/mysqld/mysqld.sock' (13)"
Oddly enough the *SQL* buffer is created and is functioning, and I can set
'sql-set-sqli-buffer' to it, but if I try to 'c-c c-r' a snippet of
sql code, I get a 'Wrong type arguement: processp, nil'
I'm pretty new to emacs customization (almost as new as I am to emacs)
so maybe I'm missing something, but it sure seems to me something is
broken.
Just a few more details. My database is on a machine different than the
one I'm running emacs on. The shell mysql client has no problems
connecting to the remote database. Originally I had a bunch of other code
in my .emacs, but I have trimmed it all down to what I show above. If its
not obvious, I can cut and paste elisp but I really don't understand it.
--
Frank Stutzman
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: sql-completion.el messing with sql-mysql?
2014-02-19 23:47 sql-completion.el messing with sql-mysql? Frank Stutzman
@ 2014-02-20 11:06 ` Chris Van Dusen
[not found] ` <mailman.15610.1392894407.10748.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 3+ messages in thread
From: Chris Van Dusen @ 2014-02-20 11:06 UTC (permalink / raw)
To: Frank Stutzman; +Cc: help-gnu-emacs
Frank,
On Feb 19, 2014, at 5:47 PM, Frank Stutzman <stutzman@cat2.kjsl.com> wrote:
> Has anyone else had problems with sql-completion.el messing with sql-mysql
> mode am I doing something dumb?
>
> I'm using GNU Emacs 24.3.1. If I have no init file (--no-init) when I start
> it, I have no problems with going into sql-mode and opening up a SQLi
> connection to my remote database. Works great.
>
> However, if I install sql-completion.el (version 1.1.1.1) and put:
>
> (require 'mysql)
> (require 'sql-completion)
> (setq sql-interactive-mode-hook
> (lambda ()
> (define-key sql-interactive-mode-map "\t" 'comint-dynamic-complete)
> (sql-mysql-completion-init)))
>
> Into my .emacs file (that bit is exactly what the is sql-completion.el file
> tells you to do), do a 'M-x sql-mysql' and suddenly things start breaking.
> Namely, right after I enter the login information I get an error saying:
>
> "if: ERROR 2002 (HY000): Can't connect to local MySQL server through
> socket '/var/run/mysqld/mysqld.sock' (13)"
>
I believe this is because sql-completion.el assumes that MySQL is running on
localhost. See the function mysql-shell-query.
> Oddly enough the *SQL* buffer is created and is functioning, and I can set
> 'sql-set-sqli-buffer' to it, but if I try to 'c-c c-r' a snippet of
> sql code, I get a 'Wrong type arguement: processp, nil'
>
>
This may be a separate issue since you do have a running process.
>
> --
> Frank Stutzman
>
>
hth,
Chris.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: sql-completion.el messing with sql-mysql?
[not found] ` <mailman.15610.1392894407.10748.help-gnu-emacs@gnu.org>
@ 2014-02-20 16:10 ` Frank Stutzman
0 siblings, 0 replies; 3+ messages in thread
From: Frank Stutzman @ 2014-02-20 16:10 UTC (permalink / raw)
To: help-gnu-emacs
Chris Van Dusen <cavandusen@gmail.com> wrote:
>
> I believe this is because sql-completion.el assumes that MySQL is running on
> localhost. See the function mysql-shell-query.
Thanks Chris, this looksl like the right path although mysql-shell-query
is defined in mysql.el. Here is that function in entirity:
;;; query with shell command
(defun mysql-shell-query (sql &optional db)
(let ((cmd (mapconcat
'identity
(append (append (list mysql-program)
;; -s option inhibit header in output
(remove "-s" mysql-options))
(list
"-u" mysql-user
db
(and (string< "" mysql-password)
(concat "-p" mysql-password))
"-e" (format "\"%s\"" sql)))
" ")))
(mysql-output-table (shell-command-to-string cmd))))
Staring at this long enough has me convinced that what it is feeding to
the mysql client is missing a '-h server_name' when it is needed. The server
name seems to be kept in the sql-mysql-login-params variable, although I am
unclear how to extract it from the other parameters.
In further poking about, it seems to me that mysql.el just isn't set up to
handle a remote database at all. For example, the mysql-connect fuction
is also missing any reference to a server.
I think fixing this is beyond my limited skills. For my needs, I am going to
have to abandon the idea of have completion available for my mysql development.
--
Frank Stutzman
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-20 16:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-19 23:47 sql-completion.el messing with sql-mysql? Frank Stutzman
2014-02-20 11:06 ` Chris Van Dusen
[not found] ` <mailman.15610.1392894407.10748.help-gnu-emacs@gnu.org>
2014-02-20 16:10 ` Frank Stutzman
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).