Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sql-mode]

The tag has no usage guidance.

2
votes
1answer
23 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
0answers
20 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 (...
2
votes
1answer
33 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, ...
1
vote
1answer
69 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
1answer
55 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 ...
2
votes
1answer
99 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
1answer
222 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 ...
4
votes
1answer
123 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
1answer
149 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-...
2
votes
0answers
89 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
1answer
476 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-...
8
votes
1answer
897 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
1answer
238 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 ...
2
votes
2answers
1k 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
1answer
155 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 ...
1
vote
1answer
361 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
0answers
173 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
2answers
797 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
0answers
89 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
1answer
687 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 ...