Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

Commit afd2e8a

Browse files
santecmarijnh
authored andcommitted
Add generic SQL mode
1 parent 3f0b43f commit afd2e8a

2 files changed

Lines changed: 338 additions & 0 deletions

File tree

mode/sql/index.html

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>SQL Mode for CodeMirror</title>
6+
<link rel="stylesheet" href="../../lib/codemirror.css" />
7+
<script src="../../lib/codemirror.js"></script>
8+
<script src="sql.js"></script>
9+
<style>
10+
.CodeMirror {
11+
border-top: 1px solid black;
12+
border-bottom: 1px solid black;
13+
}
14+
</style>
15+
<link rel="stylesheet" href="../../doc/docs.css">
16+
<script>
17+
var init = function() {
18+
var mime = 'text/x-mariadb';
19+
20+
// get mime type
21+
if (window.location.href.indexOf('mime=') > -1) {
22+
mime = window.location.href.substr(window.location.href.indexOf('mime=') + 5);
23+
}
24+
25+
CodeMirror.fromTextArea(document.getElementById('code'), {
26+
mode: mime,
27+
indentWithTabs: true,
28+
smartIndent: true,
29+
lineNumbers: true,
30+
matchBrackets : true,
31+
autofocus: true
32+
});
33+
};
34+
</script>
35+
</head>
36+
<body onload="init();">
37+
<h1>SQL Mode for CodeMirror</h1>
38+
<form>
39+
<textarea id="code" name="code">-- SQL Mode for CodeMirror
40+
SELECT SQL_NO_CACHE DISTINCT
41+
@var1 AS `val1`, @'val2', @global.'sql_mode',
42+
1.1 AS `float_val`, 0.09e3 AS `int_with_esp`,
43+
0xFA5 AS `hex`, x'fa5' AS `hex2`, 0b101 AS `bin`, b'101' AS `bin2`,
44+
'myString', UNKNOWN
45+
FROM DUAL
46+
-- space needed after '--'
47+
# 1 line comment
48+
/* multiline
49+
comment! */
50+
LIMIT 1 OFFSET 0;
51+
</textarea>
52+
</form>
53+
<p><strong>MIME types defined:</strong>
54+
<code><a href="?mime=text/x-sql">text/x-sql</a></code>,
55+
<code><a href="?mime=text/x-mysql">text/x-mysql</a></code>,
56+
<code><a href="?mime=text/x-mariadb">text/x-mariadb</a></code>.
57+
</p>
58+
</body>
59+
</html>

0 commit comments

Comments
 (0)