Minor mode for emacs to output the results of mysql queries to org tables, with auto completion of table and column names and parameter replacement.
mysql-to-org is available as a MELPA package: M-x package-install
[RET] mysql-to-org
[RET]
The mysql command and the mysql user can be changed through the variables mysql-to-org-mysql-command
variable (defaults to "mysql"
) and mysql-to-org-mysql-user
(defaults to "root"
).
- Activate the minor mode by pressing M-x
mysql-to-org-mode
or adding the mode as a hook to another mode, f.ex.(add-hook 'php-mode-hook 'mysql-to-org-mode
). - On first activiation of the mode, you will be asked to enter a password to connect to mysql.
- When the mode is active, the following commands are available:
- C-c C-m e (
mysql-to-org-eval
): evaluate the mysql query inside the active region or current line. - C-c C-m p (
mysql-to-org-eval-string-at-point
): evaluate the string at point. - C-c C-m s (
mysql-to-org-scratch
): open a scratch buffer to evaluate mysql queries. - C-c C-m 1 (
mysql-to-org-only-show-output-window
): only show the output window with the query results. - C-c C-m r (
mysql-to-org-reload-completion-candidates
): reload the completion candidates (f.ex. after changing the database schema).
- If a query contains parameters, you will be asked to supply values for these parameters in the minibuffer to evaluate the query. The regexp to find parameters can be customized with the
mysql-to-org-parameter-regexp
variable. - All table names and column names are available for auto completion using the completion-at-point-functions.
- Query results are available as org tables.