UNPKG

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