joereynolds / joereynolds/SQHell.vim
Extract SQL querys to seperate functions to enable easy reload of buffer contents on change
Nobody has claimed this yet.
- Dominant language
- Vim Script
- Stars
- 132
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
As implied in this comment I think it would be a good idea to extract all SQL query generations (even if really simple) to their own functions which would enable a very easy and simple reload functionality for SQHDatabase, SQHTable, and SQHResult buffers when using key bindings that change their contents.
Currently reloading is done like this:
open SQHDatabase -> dd to delete a database -> mysql#DropDatabase(which creates the query, executes the query with mysql#GetResultsFromQuery, deletes the buffer, and opens new buffer with mysql#ShowDatabases)
My idea is to make it work like this:
open SQHDatabase -> dd to delete a database -> mysql#DropDatabase(which creates the query, executes the query, deletes all the lines in the current buffer, gets query for showing all the databases, and executes that query with mysql#GetResultsFromQuery)
Note: the empty buffer and fill with new contents would be a separate function
Pros:
- makes all the queries really reusable
- doesn't screw up the jump list
- possibly beneficial in the future
- would tidy up some code
Cons:
- idea not really that thought out yet (probably could use improvement)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the SQHDatabase, SQHTable, and SQHResult buffer actions, especially mysql#DropDatabase, mysql#GetResultsFromQuery, and mysql#ShowDatabases. Identify where SQL is currently generated and how buffers are reopened. Done means query generation is reusable and buffer contents can be refreshed without reopening the buffer or disrupting the jump list.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, sql, vim
- Domain
- database, tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100