国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.9KB

  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. <code><a href="?mime=text/x-pgsql">text/x-pgsql</a></code>,
  57. <code><a href="?mime=text/x-gql">text/x-gql</a></code>.
  58. </p>
  59. <script>
  60. window.onload = function() {
  61. var mime = 'text/x-mariadb';
  62. // get mime type
  63. if (window.location.href.indexOf('mime=') > -1) {
  64. mime = window.location.href.substr(window.location.href.indexOf('mime=') + 5);
  65. }
  66. window.editor = CodeMirror.fromTextArea(document.getElementById('code'), {
  67. mode: mime,
  68. indentWithTabs: true,
  69. smartIndent: true,
  70. lineNumbers: true,
  71. matchBrackets : true,
  72. autofocus: true,
  73. extraKeys: {"Ctrl-Space": "autocomplete"},
  74. hintOptions: {tables: {
  75. users: {name: null, score: null, birthDate: null},
  76. countries: {name: null, population: null, size: null}
  77. }}
  78. });
  79. };
  80. </script>
  81. </article>