The code isn't really documented at all. But it seems to work fairly well. Only handles SELECT and PRAGMA statements!
Created using ahk v2-a100 and not tested with any other versions.
Let me know if you have any issues with it. Source and a release has now been uploaded to GitHub - https://github.com/kczx3/SQLiteViewer
This site has a great sample database to play with -> http://www.sqlitetutorial.net/sqlite-sample-database/
Features
- Database viewer treeview
- Drag any item from the Database treeview and drop into the query editor
- When the query editor is focused, you can run with Ctrl + Enter also
- Results are displayed in a lower ListView. You can filter the results by typing into the corresponding column's filter Edit and typing
- StatusBar shows the last SQL ran, the DB that it ran against, and the number of rows returned (also shows the number of rows displayed out of the total if you are filtering)
- History tab keeps track of recently ran queries, grouped by the database file they were ran against. Select one to view the full query in the Edit to the right
- Create snippets on the right panel. If you hover over a snippet, a Tooltip is used to display the snippet contents. Double clicking a snippet will overwrite the query editor with the contents of the snippet (may change this to just insert at the current cursor position)
Updates
3/23/2019
- New version that uses Scintilla for all Edit controls that display SQLite statements. Modified Scintilla class from AutoGUI to work with AHK v2 and eliminated global variables and functions.
- Initial implementation of CallTips when writing queries in the main editor. There are a few limitations: A calltip will display if you type a function name and open parenthesis inside a string literal. If you type a close parenthesis at any time while a CallTip is open, it will close. If you select more than 1 character on the line where a CallTip was displayed, it will be closed. The parameter highlighting also does not work properly if you use arrow keys to the left a previous parameter slot and then delete the text for that parameter.
- GUI is now resizable. Resizes are buffered to only resize/redraw controls every three pixels. So there may be instances where it doesn't quite look right. Just resize it a bit more or maximize and then restore.
- Code editor improvements include better workflows for typing quotes and closing parenthesis when they have no contents. Typing two quotes for example will now not insert three quotes. Instead, your cursor will go to the far side of the second quote. Same for braces. If your cursor is in between braces or quotes and you hit backspace, the quotes or braces on both sides will be removed.
- Autocompletion of function names and SQLite keywords.
- Probably other stuff I can't think of
- Implemented the REGEXP operator to be used in SQLite queries
- Cleaned up Tab handling
- Better autocompletion - if you have a full match typed of an autocompletion item and hit Tab or Enter, the Tab or Enter is also inserted into the editor whereas before it only would complete the autocompletion
- When dragging an item from the Database Treeview into the editor, holding down the Ctrl key while releasing the mouse will instead overwrite the hovered word with the dragged word. If you are hovering near a space, then a normal text insertion is made.
- Added vertical splitter control that can be dragged to resize the editors and results tabs.