index.html 3.1 KB

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