openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

index.html (3110B)


      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
     37 SELECT 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             <code><a href="?mime=text/x-gpsql">text/x-gpsql</a></code>.
     63             <code><a href="?mime=text/x-esper">text/x-esper</a></code>.
     64         </p>
     65 <script>
     66 window.onload = function() {
     67   var mime = 'text/x-mariadb';
     68   // get mime type
     69   if (window.location.href.indexOf('mime=') > -1) {
     70     mime = window.location.href.substr(window.location.href.indexOf('mime=') + 5);
     71   }
     72   window.editor = CodeMirror.fromTextArea(document.getElementById('code'), {
     73     mode: mime,
     74     indentWithTabs: true,
     75     smartIndent: true,
     76     lineNumbers: true,
     77     matchBrackets : true,
     78     autofocus: true,
     79     extraKeys: {"Ctrl-Space": "autocomplete"},
     80     hintOptions: {tables: {
     81       users: ["name", "score", "birthDate"],
     82       countries: ["name", "population", "size"]
     83     }}
     84   });
     85 };
     86 </script>
     87 
     88 </article>