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