index.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>SQL Mode for CodeMirror</title>
  6. <link rel="stylesheet" href="../../lib/codemirror.css" />
  7. <script src="../../lib/codemirror.js"></script>
  8. <script src="../../lib/codemirror.js"></script>
  9. <script src="sql.js"></script>
  10. <style>
  11. .CodeMirror {
  12. border-top: 1px solid black;
  13. border-bottom: 1px solid black;
  14. }
  15. </style>
  16. <link rel="stylesheet" href="../../doc/docs.css">
  17. <script>
  18. var init = function() {
  19. var mime = 'text/x-mariadb';
  20. // get mime type
  21. if (window.location.href.indexOf('mime=') > -1) {
  22. mime = window.location.href.substr(window.location.href.indexOf('mime=') + 5);
  23. }
  24. window.editor = CodeMirror.fromTextArea(document.getElementById('code'), {
  25. mode: mime,
  26. indentWithTabs: true,
  27. smartIndent: true,
  28. lineNumbers: true,
  29. matchBrackets : true,
  30. autofocus: true
  31. });
  32. };
  33. </script>
  34. </head>
  35. <body onload="init();">
  36. <h1>SQL Mode for CodeMirror</h1>
  37. <form>
  38. <textarea id="code" name="code">-- SQL Mode for CodeMirror
  39. SELECT SQL_NO_CACHE DISTINCT
  40. @var1 AS `val1`, @'val2', @global.'sql_mode',
  41. 1.1 AS `float_val`, .14 AS `another_float`, 0.09e3 AS `int_with_esp`,
  42. 0xFA5 AS `hex`, x'fa5' AS `hex2`, 0b101 AS `bin`, b'101' AS `bin2`,
  43. DATE '1994-01-01' AS `sql_date`, { T "1994-01-01" } AS `odbc_date`,
  44. 'myString', UNKNOWN
  45. FROM DUAL
  46. -- space needed after '--'
  47. # 1 line comment
  48. /* multiline
  49. comment! */
  50. LIMIT 1 OFFSET 0;
  51. </textarea>
  52. </form>
  53. <p><strong>MIME types defined:</strong>
  54. <code><a href="?mime=text/x-sql">text/x-sql</a></code>,
  55. <code><a href="?mime=text/x-mysql">text/x-mysql</a></code>,
  56. <code><a href="?mime=text/x-mariadb">text/x-mariadb</a></code>,
  57. <code><a href="?mime=text/x-plsql">text/x-plsql</a></code>.
  58. </p>
  59. <p>
  60. <strong>Tests:</strong>
  61. <a href="../../test/index.html#sql_*">normal</a>,
  62. <a href="../../test/index.html#verbose,sql_*">verbose</a>.
  63. </p>
  64. </body>
  65. </html>