-
Notifications
You must be signed in to change notification settings - Fork 31
/
ejc-doc.el
91 lines (71 loc) · 2.89 KB
/
ejc-doc.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
;;; ejc-doc.el -- SQL quick hints documentation (the part of ejc-sql).
;;; Copyright © 2018-2019 - Kostafey <[email protected]>
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software Foundation,
;;; Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
;;; Code:
(require 'dash)
(defconst ejc-sql-doc (make-hash-table :test 'eq))
(defun ejc-fill-doc (hash-const &rest args)
(-reduce (lambda (key val)
(puthash key val hash-const))
args))
(defvar ejc-doc-created-p nil)
(defun ejc-create-doc ()
(ejc-fill-doc
ejc-sql-doc
'select
"The SQL SELECT statement returns a result
set of records from one or more tables.
SELECT
[DISTINCT | DISTINCTROW | ALL]
select_expression,...
FROM table_references
[WHERE where_definition]
[GROUP BY {unsigned_integer | col_name | formula}]
[HAVING where_definition]
[ORDER BY {unsigned_integer | col_name | formula} [ASC | DESC], ...]"
'insert
"An SQL INSERT statement adds one or more records
to any single table in a relational database.
INSERT INTO table (column1 [, column2, column3 ... ])
VALUES (value1 [, value2, value3 ... ])"
'update
"An SQL UPDATE statement changes the data of one
or more records in a table. Either all the rows can
be updated, or a subset may be chosen using a condition.
UPDATE table_name SET column_name = value [, column_name = value ...]
[WHERE condition]"
'delete
"The SQL DELETE statement removes one or more records from a table.
DELETE FROM table_name [WHERE condition]"
'alter
"The ALTER TABLE command modifies column definitions and table constraints
'on the fly'. This means existing definitions are extended, changed or
deleted or existing data is casted to a different type or existing data is
evaluated against the new definitions.
-- change column definitions
ALTER TABLE <table_name> { ADD | ALTER } [ COLUMN ]
<column_name> <column_definition>;
ALTER TABLE <table_name> { DROP } [ COLUMN ]
<column_name>;
-- change table constraints
ALTER TABLE <table_name> { ADD | ALTER } CONSTRAINT
<constraint_name> <constraint_definition>;
ALTER TABLE <table_name> { DROP } CONSTRAINT
<constraint_name>;"
'distinct
"Return different values")
(setq ejc-doc-created-p t))
(provide 'ejc-doc)
;;; ejc-doc.el ends here