Questions tagged [sql-mode]
The sql-mode tag has no usage guidance.
29
questions
2
votes
1
answer
104
views
How can I make SQL output readable?
I'm trying to find an Emacs replacement for SQL Server Management Studio (SSMS). I have managed to query my Microsoft SQL Server from Emacs – and what a task that was! – through SQL Mode. However, the ...
2
votes
0
answers
51
views
Does `sql-mysql` work on MS Windows?
I remember that a few years ago when I tried there was an issue with the mysql client not supporting pipes on Windows or something like that, so it didn't work.
I tried sql-mysql with Emacs 27 and it ...
1
vote
2
answers
54
views
Can I make emacs recognize double-quoted strings in sql-mode?
I am looking for a way to make sql-mode highlight double-quoted strings in the same way as single-quoted strings. Setting the product to MySQL (which is the correct product for me) did not achieve ...
0
votes
1
answer
1k
views
How do I open an sqlite database from elisp?
I have a filepath for a sqlite database. I want to open an sql client buffer. I would like to know the best way to open that database from elisp. So far I can see that sql-sqlite will open it but it ...
2
votes
1
answer
873
views
How to send a string to the SQLi (sql-mode/sql-interactive-mode) buffer after processing?
How can I send a selected region in the sql-mode buffer to an external shell command and let the result be displayed in the sql-interactive-mode buffer (REPL)?
For example, normally, if I select a ...
2
votes
0
answers
29
views
SQL comint history saves spaces are \40
When accessing a database through an inferior process (M-x sql-msql) the history for the current session history (M-p/n) works Ok. But when restoring history entries from a previous session the string ...
1
vote
0
answers
41
views
echo the sql-command after sql-send-region
Currently I can select a region and call sql-send-region, it can be executed well. But if the command needs a long time to run, I am not sure if the command was send or not until the command is ...
0
votes
1
answer
96
views
How to make emacs to launch sql modes runtime window always at the bottom?
When using M x sql-postgres to launch the SQL mode window, emacs (as of 25.x) seems to be making smart choices about where the SQL run-time window will show. That is, it splits the viewport and shows ...
1
vote
0
answers
74
views
Cannot set sql-buffer variable from within a SQL buffer
I'm trying to link a SQL buffer to SQLi buffer by calling sql-set-sqli-buffer but nothing happens when the function is called. I'm doing this because I want to start muliple SQLi buffers with each of ...
2
votes
1
answer
73
views
Are comment style flags insufficient to separate SQL comments?
I am trying to understand why SQL mode accepts -* as a comment block start.
In sql.el, I read:
(defvar sql-mode-syntax-table
(let ((table (make-syntax-table)))
;; C-style comments /**/ ...
...
1
vote
0
answers
71
views
Why does sql-mode think -* starts a block comment?
While typing in a SQL mode buffer, I noticed that -* starts a block comment. Why?
It happens whenever I type an asterisk/star character (ASCII 42) directly after a simple dash/hyphen/minus character (...
3
votes
1
answer
223
views
Shortcut to restart sql-postgres process from sql-mode buffer?
Is there a shortcut key or command in Emacs (25.x under Unbuntu 18.04 LTS) to restart the sql-postgres process?
I need to quit and restart sql-postgres very often (for debugging purposes). Currently, ...
2
votes
1
answer
1k
views
Set the password for sql-postgres
I have a question regarding connecting to a sql database programmatically. Ideally I would like to have a function with similar functionality to the sql-postgres but instead of interactively prompting ...
0
votes
1
answer
300
views
Emacs: Error message when sending a region to a sql connection buffer: Wrong type argument: processp, nil
Based on the article here:
https://emacsredux.com/blog/2013/06/13/using-emacs-as-a-database-client/
I wish to have a .sql buffer to edit my queries and once prepared send it by (C-c C-r) to an already ...
8
votes
2
answers
1k
views
Is it possible to have shared #+PROPERTY: between multiple org files?
I'm working with org-mode and org-babel to query a PostgreSQL database. It's pretty cool setup and I love it.
At the moment, I have multiple org files with the same database property configuration ...
1
vote
1
answer
530
views
How to use mysql client (sql-mysql-program) from a docker container?
I am running MySQL inside a docker container. When I try to connect to it using M-x sql-mysql I see the following error:
Unable to locate SQL program ‘mysql’
Yeah, I don't have mysql-client ...
5
votes
1
answer
592
views
Eval SQL in Org Babel using sql-connection-alist for credentials
I would like to evaluate SQL source blocks in Org Babel using the connections I have set up in sql-connection-alist from sql-mode. This way I can save database credentials in a private (Elisp) file ...
4
votes
1
answer
273
views
sql-connect with Ivy
I've switched from helm to Ivy and mostly everything works, but today I noticed that connecting to databases with sql-connect doesn't work anymore. I have the following in the variable sql-connection-...
3
votes
0
answers
148
views
How to abort a command executing in sqli-mode?
Whilst using a sqli buffer I accidentally ran a mahoosive query. What's the easiest way to abort it?
I used sql-postgres to start the process.
3
votes
1
answer
708
views
Using sql-sqlite via TRAMP
I want to use sql-sqlite on a remote database file via TRAMP. According to this website it should be possible, but I cannot get it to work.
I visit the remote directory with Dired and then invoke sql-...
10
votes
1
answer
2k
views
Is there a company backend for completion in sql-interactive-mode?
I'm using sql-interactive-mode, and I'm in need for a Company backends that will complete SQL keywords, and preferably, also column/table names of the used database.
When looking around for any ...
1
vote
1
answer
359
views
How do I encourage Emacs to follow the output of the SQL-buffer?
This issue might be related.
I have a SQL process viewed in a buffer in a frame.
When I send SQL-statements from another window in frame to the SQL-process in the another frame, I have to scroll my ...
4
votes
2
answers
2k
views
How to change the indentation of major mode (SQL-mode)?
Configuration:
Emacs 25.0.50 on Ubuntu 15.04.
How to produce?
Do emacs -Q, then M-x sql-mode.
Paste the following in the buffer:
SELECT SUM(T01.foobar)
FROM db_foo.bar T01
WHERE T01.fooID = ...
2
votes
1
answer
258
views
How do I make multiple buffers use a single sql connection?
I am using sql mode. Is there a way to connect multiple buffers to a single sql connection? When I try to connect an existing buffer to a database, it always creates a new connection instead of ...
2
votes
1
answer
737
views
How to programmatically invoke interactive function? [duplicate]
I have written an interactive function to connect to multiple mysql databases
(defun mysql-connect (name)
"Connect to a predefined MySQL connection."
(interactive
(list
(completing-read "...
1
vote
0
answers
293
views
sql-connect: (setting-constant nil)
I am using latest Helm from MELPA on Emacs GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.6) of 2015-09-11
When I issue sql-connect I see this:
The only connection I have saved (in ...
5
votes
2
answers
1k
views
How to indent SQL code just 4 spaces, without alignment &c?
SQL mode has some cool stuff set up for indenting with aligned keywords and such. Normally, I'd think it was cool. The problem is that at my new job, the people who wrote our mountains of sql did not ...
3
votes
0
answers
112
views
Send custom commands via psql interface
When interacting with postgresql via Emacs sql-postgres, is it possible to write aliases or functions, to be able to type for example, databases instead of \l, when I want to list all databases?
4
votes
1
answer
835
views
Why do sql-mode and sql-interactive-mode not highlight strings the same way?
Here is a screenshot showing the difference between sql-interactive-mode (top) and sql-mode (bottom).
Why does the string not get highlighted properly in sql-interactive-mode? (Note - this also ...