| 5 |
lars |
1 |
<!doctype html>
|
|
|
2 |
<title>CodeMirror: SQL Mode for CodeMirror</title>
|
|
|
3 |
<meta charset="utf-8" />
|
|
|
4 |
<link rel=stylesheet href="../../doc/docs.css">
|
|
|
5 |
<link rel="stylesheet" href="../../lib/codemirror.css" />
|
|
|
6 |
<script src="../../lib/codemirror.js"></script>
|
|
|
7 |
<script src="sql.js"></script>
|
|
|
8 |
<link rel="stylesheet" href="../../addon/hint/show-hint.css" />
|
|
|
9 |
<script src="../../addon/hint/show-hint.js"></script>
|
|
|
10 |
<script src="../../addon/hint/sql-hint.js"></script>
|
|
|
11 |
<style>
|
|
|
12 |
.CodeMirror {
|
|
|
13 |
border-top: 1px solid black;
|
|
|
14 |
border-bottom: 1px solid black;
|
|
|
15 |
}
|
|
|
16 |
</style>
|
|
|
17 |
<div id=nav>
|
|
|
18 |
<a href="http://codemirror.net">
|
|
|
19 |
<h1>CodeMirror</h1>
|
|
|
20 |
<img id=logo src="../../doc/logo.png">
|
|
|
21 |
</a>
|
|
|
22 |
<ul>
|
|
|
23 |
<li>
|
|
|
24 |
<a href="../../index.html">Home</a>
|
|
|
25 |
<li>
|
|
|
26 |
<a href="../../doc/manual.html">Manual</a>
|
|
|
27 |
<li>
|
|
|
28 |
<a href="https://github.com/codemirror/codemirror">Code</a>
|
|
|
29 |
</ul>
|
|
|
30 |
<ul>
|
|
|
31 |
<li>
|
|
|
32 |
<a href="../index.html">Language modes</a>
|
|
|
33 |
<li>
|
|
|
34 |
<a class=active href="#">SQL Mode for CodeMirror</a>
|
|
|
35 |
</ul>
|
|
|
36 |
</div>
|
|
|
37 |
<article>
|
|
|
38 |
<h2>SQL Mode for CodeMirror</h2>
|
|
|
39 |
<form>
|
|
|
40 |
<textarea id="code" name="code">-- SQL Mode for CodeMirror SELECT SQL_NO_CACHE DISTINCT @var1 AS `val1`, @'val2', @global.'sql_mode', 1.1 AS `float_val`, .14 AS `another_float`, 0.09e3 AS `int_with_esp`, 0xFA5 AS `hex`, x'fa5' AS `hex2`, 0b101 AS `bin`, b'101' AS `bin2`, DATE
|
|
|
41 |
'1994-01-01' AS `sql_date`, { T "1994-01-01" } AS `odbc_date`, 'my string', _utf8'your string', N'her string', TRUE, FALSE, UNKNOWN FROM DUAL -- space needed after '--' # 1 line comment /* multiline comment! */ LIMIT 1 OFFSET 0; </textarea>
|
|
|
42 |
</form>
|
|
|
43 |
<p>
|
|
|
44 |
<strong>MIME types defined:</strong> <code><a href="?mime=text/x-sql">text/x-sql</a></code>, <code><a href="?mime=text/x-mysql">text/x-mysql</a></code>, <code><a href="?mime=text/x-mariadb">text/x-mariadb</a></code>, <code><a href="?mime=text/x-cassandra">text/x-cassandra</a></code>,
|
|
|
45 |
<code><a href="?mime=text/x-plsql">text/x-plsql</a></code>, <code><a href="?mime=text/x-mssql">text/x-mssql</a></code>, <code><a href="?mime=text/x-hive">text/x-hive</a></code>. </p>
|
|
|
46 |
<script>
|
|
|
47 |
window.onload = function()
|
|
|
48 |
{
|
|
|
49 |
var mime = 'text/x-mariadb';
|
|
|
50 |
// get mime type
|
|
|
51 |
if (window.location.href.indexOf('mime=') > -1)
|
|
|
52 |
{
|
|
|
53 |
mime = window.location.href.substr(window.location.href.indexOf('mime=') + 5);
|
|
|
54 |
}
|
|
|
55 |
window.editor = CodeMirror.fromTextArea(document.getElementById('code'),
|
|
|
56 |
{
|
|
|
57 |
mode: mime,
|
|
|
58 |
indentWithTabs: true,
|
|
|
59 |
smartIndent: true,
|
|
|
60 |
lineNumbers: true,
|
|
|
61 |
matchBrackets: true,
|
|
|
62 |
autofocus: true,
|
|
|
63 |
extraKeys:
|
|
|
64 |
{
|
|
|
65 |
"Ctrl-Space": "autocomplete"
|
|
|
66 |
},
|
|
|
67 |
hintOptions:
|
|
|
68 |
{
|
|
|
69 |
tables:
|
|
|
70 |
{
|
|
|
71 |
users:
|
|
|
72 |
{
|
|
|
73 |
name: null,
|
|
|
74 |
score: null,
|
|
|
75 |
birthDate: null
|
|
|
76 |
},
|
|
|
77 |
countries:
|
|
|
78 |
{
|
|
|
79 |
name: null,
|
|
|
80 |
population: null,
|
|
|
81 |
size: null
|
|
|
82 |
}
|
|
|
83 |
}
|
|
|
84 |
}
|
|
|
85 |
});
|
|
|
86 |
};
|
|
|
87 |
</script>
|
|
|
88 |
</article>
|