Emacs: how to set the default database type for SQL file in SQL mode

In SQL mode, we can select the product type, such as posgres, mysql, oracle, etc., and the default is ANSI, how to set the default type as postgresql after emacs starts? What needs to be placed in .emacs?

+5
source share
2 answers

SQL mode has a sql-set-product function that is used to install the product.

Ch f sql-set-product RET lists the details of the function.

 sql-set-product is an interactive compiled Lisp function. (sql-set-product PRODUCT) Set `sql-product' to PRODUCT and enable appropriate highlighting. 

So you can add

 (sql-set-product "postgres") 

to the .emacs file to make it the default.

At any given time, if you want to change its mysql or something else, you can use

 Mx sql-set-rpoduct RET mysql RET 
+7
source

This is also an option, a comment on the first line in the file.

 -- -*- mode: sql; sql-product: mysql; -*- 

cm

 http://stackoverflow.com/a/18118619/714357 
+1
source

Source: https://habr.com/ru/post/1210100/


All Articles