question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Execute the current query

See original GitHub issue

Is it possible to execute the current query (i.e. the one where the cursor is)?

I have a .sql file with several queries, as part of the research phase, and I want to execute only one of them. Currently, F5 would execute all queries in the file unless I select one of them. It will be amazing if I could easily execute the query at the position of the cursor.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
droratacommented, Apr 26, 2017

Thanks for the hint! It was worthy! In init.coffee I added:

atom.commands.add 'atom-text-editor', 'da:select-current-paragrpah', ->
  editor = atom.workspace.getActiveTextEditor()
  editor.moveToBeginningOfNextParagraph()
  editor.selectToBeginningOfPreviousParagraph()

atom.commands.add 'atom-text-editor', 'da:execute-current-query', ->
  editor = atom.workspace.getActiveTextEditor()
  editorElement = atom.views.getView(editor)
  atom.commands.dispatch(editorElement, 'da:select-current-paragrpah')
  atom.commands.dispatch(editorElement, 'data-atom:execute')

and in keymap.cson:

'atom-text-editor':
  'f6': 'da:execute-current-query'

Now, when the cursor is in a query (or at least as far Atom.io paragraphs and SQL queries are the same) I can hit F6 and execute it.

I would like to figure out how to bind F6 to this function only when the language is SQL. Do you know?

0reactions
lukemurraycommented, Apr 3, 2018

Sure was image

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I run just the statement my cursor is on in SQL Server ...
Shift-F5 will select the current statement (which allows you to review what you are currently going to execute). Then you press F5 and...
Read more >
Select Current Statement / Run current statement - SSMSBoost
We have implemented "Select Current Statement" (SHIFT+F5) feature which, followed by "Execute (F5)", gives you the desired "Run current statement" functionality ...
Read more >
See what queries are currently running - SQLMatters
Sometimes it is useful to see what is currently running on a SQL server. On SQL Server 2005 and later this is fairly...
Read more >
sql server - Execute new query when current query finalises
So I would just wait until the current query is finished, and then you can highlight the rest of the script and run...
Read more >
SQL Prompt Tips #5 - Current Statement Execution
By pressing Shift+F5, I'll execute the current statement only. That's the one that has my cursor in it. In any line, any part...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found