Adding/changing sql editors

Starting with version 2.3, MyWebSQL uses configurable sql editors, so that you can add/edit or delete sql editors according to your requirements. The following steps describes how to change the sql editor functionality.

  • The current editor used by MyWebSQL is defined in the ‘config/config.php’ file. Changing the value of the config directive ‘SQL_EDITORTYPE’ sets the editor be used for the application. Possible values are ‘simple’, ‘codemirror’ and ‘codemirror2’. Codemirror is default which provides syntax highlighting and is pretty stable.
  • In ‘simple’ mode there is no syntax highlighting and is the fastest mode for sql editor. If you are having problems with syntax highlighted editor, you can switch to the simple one to avoid those issues.
  • Codemirror2 is experimental and included for testing purposes. You are welcome to test it out and submit your bug reports.

Alternatively, you can also include a new editor for sql editing (e.g. ACE) using the following steps.

  • create a folder inside the ‘js’ folder with the name of your editor. Put all related javascript files inside it.
  • copy any one of the existing file inside the ‘lib/editors’ folder, and save in the same folder with the name of the editor (e.g. ‘ace.php’)
  • Edit the newly created file and change the editor creation code. Refer to the editor’s documentation to complete this step.
  • Edit the config/keys.php file in MyWebSQL installation folder, and add hotkey information for the editor at the end of that file.
  • Edit the config/config.php file and change the value of the directive ‘SQL_EDITORTYPE’ to the name of the new editor
  • Now you can reload the MyWebSQL interface in browser to see your editor in action.
  • If you require add additional css files to be included for the editor to work properly, you can do so in the file you created in ‘lib/editors’ folder earlier.