dbgate / dbgate

Database manager for MySQL, PostgreSQL, SQL Server, MongoDB, SQLite and others. Runs under Windows, Linux, Mac or as web application
https://dbgate.org
GNU General Public License v3.0
5.16k stars 297 forks source link

FEAT: Add Default Execution Mode setting #738

Open bgtron opened 5 months ago

bgtron commented 5 months ago

When I'm drafting queries, it is not uncommon to have multiple select statements as I'm testing and building things. However, when I hit execute, it runs them all and shows many result tabs, one for each statement. I can separate each section with a semicolon, and the editor now colors the line numbers blue for the query where my cursor is, so the editor recognizes the separation, but for speed in iterating, I only want the query with the cursor in it to run...producing only one result tab.

This is the behavior of the DBeaver app and I really like it. If I want to run more than one, I can highlight them and then hit execute and they both run...which is something DBGate does well.

Maybe a way do add this feature would be to add a setting in "Settings" that would allow users to determine if the default execution mode is to execute the whole document or just the active statement (indicated by cursor placement). Using the cursor to highlight a specific area of the document to be executed is already a working function, so that wouldn't need to change. This way, both use cases could be possible, depending on user preference.

risner commented 5 months ago

I just installed this tool today. It's by far the best, most elegant, db tool I've tried between dbeaver, Beekeeper and others. But this is kind of a show stopper. I'm very afraid I'll click execute without selecting the "current only" and run queries / updates / changes I don't plan now and could delete or alter the database in a harmful way.

The execute everything option should be difficult to activate and the current statement way should be the default.