index.html 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. </p>
  52. <script>
  53. window.onload = function() {
  54. var mime = 'text/x-mariadb';
  55. // get mime type
  56. if (window.location.href.indexOf('mime=') > -1) {
  57. mime = window.location.href.substr(window.location.href.indexOf('mime=') + 5);
  58. }
  59. window.editor = CodeMirror.fromTextArea(document.getElementById('code'), {
  60. mode: mime,
  61. indentWithTabs: true,
  62. smartIndent: true,
  63. lineNumbers: true,
  64. matchBrackets : true,
  65. autofocus: true
  66. });
  67. };
  68. </script>
  69. </article>