* GNU Emacs as a lightweight SQL IDE
@ 2020-03-28 7:31 Anand Tamariya
0 siblings, 0 replies; only message in thread
From: Anand Tamariya @ 2020-03-28 7:31 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1975 bytes --]
Here's my next installment of "GNU Emacs as a lightweight IDE" series for
editing SQL. These enhancements to Semantic and sql-mode allows SQL
code-completion for most common use-cases.
- Offline - Use DDLs in current file for auto-suggest
- Online - Use table information from DB for auto-suggest. DB connection
is made using JDBC which allows connection to ANY DB in a platform
independent manner. It also allows multiple simultaneous connections with
easy switch-over.
Hope this will aid your productivity while using SQL in Emacs.
Code: Emacs customization (https://gitlab.com/atamariya/emacs/tree/dev)
H2 customization (
https://github.com/atamariya/h2database/tree/atamariya-patch-1)
Config (.emacs):
(global-ede-mode 1)
(semantic-mode 1)
(srecode-minor-mode 1)
;; Install company for inline completion with dropdown
(require 'company)
(global-company-mode)
Demo:
Part 1 (Offline): https://youtu.be/yJ55cQez5Tc
Part 2 (Online): https://youtu.be/dUbqdY0KU0U
Implementation notes:
The SQL specific implementation is confined to three files - sql.wy
<https://gitlab.com/atamariya/emacs/-/blob/0cbbf9e29a2d915195336a3996be3703682b1c92/admin/grammars/sql.wy>,
sql.el
<https://gitlab.com/atamariya/emacs/-/blob/0cbbf9e29a2d915195336a3996be3703682b1c92/lisp/cedet/semantic/sql.el>
and company-semantic.el
<https://gitlab.com/atamariya/emacs/-/blob/0cbbf9e29a2d915195336a3996be3703682b1c92/lisp/cedet/company-semantic.el>.
Most of the heavy lifting is done by the semantic and company framework.
- sql.wy - This is the language grammar file. You compile this (run make in
emacs/lisp directory) to generate language parser sql-tags-wy.el.
- semantic/sql.el - Overrides some semantic functions
- company-semantic.el - Deals with auto-completion using semantic
- progmodes/sql.el - JDBC product definition and supporting functions
- H2 web console supports "@tables" meta commands. My customization makes
them available to CLI console as well.
Regards,
Anand
[-- Attachment #2: Type: text/html, Size: 7354 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-03-28 7:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-28 7:31 GNU Emacs as a lightweight SQL IDE Anand Tamariya
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.