index.html 2.4 KB

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