index.html 2.8 KB

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