<commit_before>#+TITLE: SQL layer
#+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="../../../css/readtheorg.css" />

[[file:img/sql.png]]

* Table of Contents                                         :TOC_4_org:noexport:
 - [[Description][Description]]
 - [[Install][Install]]
 - [[Key bindings][Key bindings]]
   - [[Highlighting][Highlighting]]
   - [[Inferior Process Interactions (SQLi)][Inferior Process Interactions (SQLi)]]
     - [[Send SQL queries to SQLi:][Send SQL queries to SQLi:]]
   - [[SQLi buffer][SQLi buffer]]

* Description

This layer adds key bindings and configuration for =sql-mode=, which manages
interactive SQL buffers and highlights a wide range of SQL dialects.

* Install
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =sql= to the existing =dotspacemacs-configuration-layers= list in this
file.

* Key bindings

** Highlighting

| Key Binding | Description                       |
|-------------+-----------------------------------|
| ~SPC m h k~ | select a SQL dialect to highlight |

** Inferior Process Interactions (SQLi)

| Key Binding | Description                 |
|-------------+-----------------------------|
| ~SPC m b b~ | show the SQLi buffer name   |
| ~SPC m b s~ | set the SQLi buffer         |
| ~SPC m l a~ | List all objects            |
| ~SPC m l t~ | list all objects in a table |

*** Send SQL queries to SQLi:

| Key Binding | Description                                                                              |
|-------------+------------------------------------------------------------------------------------------|
| ~SPC m s b~ | Send the whole buffer to the SQLi buffer                                                 |
| ~SPC m s B~ | Send the whole buffer to the SQLi buffer and switch to it in =insert state=              |
| ~SPC m s i~ | Start the SQLi process                                                                   |
| ~SPC m s f~ | Send the paragraph around point to the SQLi buffer                              |
| ~SPC m s F~ | Send the paragraph around point to the SQLi buffer and switch to it in =insert state= |
| ~SPC m s q~ | Prompt for a string to send to the SQLi buffer                                           |
| ~SPC m s Q~ | Prompt for a string to send to the SQLi buffer and switch to it in =insert state=        |
| ~SPC m s r~ | Send the selected region to the SQLi buffer                                              |
| ~SPC m s R~ | Send the selected region to the SQLi buffer and switch to it in =insert state=           |

** SQLi buffer

| Key Binding | Description                                                  |
|-------------+--------------------------------------------------------------|
| ~SPC m b r~ | rename buffer (follow up in the SQL buffer with ~SPC m b s~) |
| ~SPC m b S~ | save the current connection                                  |<commit_msg>Fix table alignment in SQL README<commit_after>#+TITLE: SQL layer
#+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="../../../css/readtheorg.css" />

[[file:img/sql.png]]

* Table of Contents                                         :TOC_4_org:noexport:
 - [[Description][Description]]
 - [[Install][Install]]
 - [[Key bindings][Key bindings]]
   - [[Highlighting][Highlighting]]
   - [[Inferior Process Interactions (SQLi)][Inferior Process Interactions (SQLi)]]
     - [[Send SQL queries to SQLi:][Send SQL queries to SQLi:]]
   - [[SQLi buffer][SQLi buffer]]

* Description

This layer adds key bindings and configuration for =sql-mode=, which manages
interactive SQL buffers and highlights a wide range of SQL dialects.

* Install
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =sql= to the existing =dotspacemacs-configuration-layers= list in this
file.

* Key bindings

** Highlighting

| Key Binding | Description                       |
|-------------+-----------------------------------|
| ~SPC m h k~ | select a SQL dialect to highlight |

** Inferior Process Interactions (SQLi)

| Key Binding | Description                 |
|-------------+-----------------------------|
| ~SPC m b b~ | show the SQLi buffer name   |
| ~SPC m b s~ | set the SQLi buffer         |
| ~SPC m l a~ | List all objects            |
| ~SPC m l t~ | list all objects in a table |

*** Send SQL queries to SQLi:

| Key Binding | Description                                                                           |
|-------------+---------------------------------------------------------------------------------------|
| ~SPC m s b~ | Send the whole buffer to the SQLi buffer                                              |
| ~SPC m s B~ | Send the whole buffer to the SQLi buffer and switch to it in =insert state=           |
| ~SPC m s i~ | Start the SQLi process                                                                |
| ~SPC m s f~ | Send the paragraph around point to the SQLi buffer                                    |
| ~SPC m s F~ | Send the paragraph around point to the SQLi buffer and switch to it in =insert state= |
| ~SPC m s q~ | Prompt for a string to send to the SQLi buffer                                        |
| ~SPC m s Q~ | Prompt for a string to send to the SQLi buffer and switch to it in =insert state=     |
| ~SPC m s r~ | Send the selected region to the SQLi buffer                                           |
| ~SPC m s R~ | Send the selected region to the SQLi buffer and switch to it in =insert state=        |

** SQLi buffer

| Key Binding | Description                                                  |
|-------------+--------------------------------------------------------------|
| ~SPC m b r~ | rename buffer (follow up in the SQL buffer with ~SPC m b s~) |
| ~SPC m b S~ | save the current connection                                  |
{'fraction_non_alphanumeric': 0.1762091950094001, 'fraction_numerical': 0.0003418219107844813, 'mean_word_length': 1.3644444444444443, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '212814', 'n_tokens_mistral': 1454, 'n_tokens_neox': 1405, 'n_words': 643}