Menu

#821 Execute currently selected query

Fixed
nobody
None
Default
Enhancement
2010-06-27
2008-10-22
Anonymous
No

Originally created by: SuperNiFF@gmail.com

What is the idea in abstract terms?

Make it easier to work on multiple queries by treating the query that the
cursor is on separate from the rest of the sql in the query editor tab.

Here's an example:
------8<--------------
select 'foo';
select <CURSOR_IS_HERE>'bar';
select 1+2;
------>8--------------

In this case, only "select 'bar'" should be executed with Shift-F9 (or Alt-
F9).
It saves the user from having to go to the beginning of the query, start
the selection, and then select until the end of the query.

F9 should execute all statements sequentially.

To assist the user, it would be helpful if the currently selected query
looks different from the rest of the SQL (see photoshopped example...).

I've had this on my mind for a while now, but I've never bothered to
create an issue here. After reading Issue #496 I thought I should suggest
this. It would solve the problem of the guy who wanted a virtual cursor,
in an elegant way.

1 Attachments

Related

Tickets: #1965
Tickets: #1991
Tickets: #496

Discussion

1 2 > >> (Page 1 of 2)
  • Anonymous

    Anonymous - 2008-10-23

    Originally posted by: a...@anse.de

    A similar mechanism is already implemented: Shift+Ctrl+F9 executes the current
    *line*, which is not 100% what you mean here but may probably do it. Real query
    parsing is a really complex thing so that might impact performance too much for a
    minor feature addition.

    Status: Accepted

     
  • Anonymous

    Anonymous - 2008-10-23

    Originally posted by: SuperNiFF@gmail.com

    Hmm, I have to admit that I didn't look into the Delphi code of this yet, but when I
    have the following multi-line queries in the query editor:

    select
      sleep(1);
    select
      sleep(1);
    select
      sleep(1);

    I get a neat progress bar that advances per query after I press F9. That indicated
    to me that HeidiSQL is already able to separate multi-line queries.

     
  • Anonymous

    Anonymous - 2008-10-31

    Originally posted by: bas...@hotmail.com

    I would like a feature that is close to the suggestions here, except that it doesn't
    require any selection. That is: execute the query at the position of the cursor.
    HeidiSQL only needs to find the previous and the next query separator.

    SQLYog also works this way and has even the default F9 key mapped to this action.
    Ctrl-F9 is used to execute the selected queries there. (but leave the HeidiSQL key
    shortcuts please as they are now to avoid confusion)

     
  • Anonymous

    Anonymous - 2009-02-11

    Originally posted by: a...@anse.de

    Could be done by combining parseSQL() and compare the results with the cursor position.

     
  • Anonymous

    Anonymous - 2009-06-11

    Originally posted by: kirankon...@gmail.com

    How about a ctrl+enter to execute a query where the cursor is currently on (more like
    query browser)...

     
  • Anonymous

    Anonymous - 2010-01-10

    Originally posted by: a...@anse.de

    (No comment was entered for this change.)

    Summary: Execute currently selected query

     
  • Anonymous

    Anonymous - 2010-02-08

    Originally posted by: sdje...@gmail.com

    Hi, I don't know if this behaviour is related :

    set @variable=call_to_a_function(parameters);
    select @variable;

    when I run this kind of query, I get no resultset :
    0 rows affected by last query. Duration for 1 query : 0.047

    (
    although the log entry contains both lines of the query :
    set @variable=call_to_a_function(parameters);   select @variable;$
    )
    (Heidi 5.0 / build 3066)

    so, in big SQL batches, we can't be sure of what is really executed...

     
  • Anonymous

    Anonymous - 2010-02-08

    Originally posted by: a...@anse.de

    > so, in big SQL batches, we can't be sure of what is really executed

    Well, if you see both queries, both are executed, very clear or?

    Anyway, this is not reproducible here:
      set @va=3;
      select @va;
    ... gives me a result of 1x1 grid with a "3".

    Perhaps your "call_to_a_function(parameters)" does not return any value?

     
  • Anonymous

    Anonymous - 2010-02-08

    Originally posted by: sdje...@gmail.com

    nice try :)

    my function always returns smthing. see by yourself :

    CREATE FUNCTION `get_l2d`(dico enum('NA','DIMENSION','EXTERNAL_ID','FORMAT','IMAGE_ID'), label
    varchar(100)) RETURNS int(11)
    BEGIN
      DECLARE result INTEGER(11);
      SET result = (select ID from INTERNAL_DICO as d
        WHERE
            d.DICO=dico
            AND d.LABEL=label
            limit 1);
      IF result IS NULL THEN
        return label;
      END IF;
      return result;
    END

     
  • Anonymous

    Anonymous - 2010-02-08

    Originally posted by: bas...@hotmail.com

    Hi sdjeser,

    Your var label is of type varchar(100). The datatype that is returned however is of
    type int(11). Are you sure that doesn't cause a problem?

     
  • Anonymous

    Anonymous - 2010-02-12

    Originally posted by: sdje...@gmail.com

    well the statement doesn't matter. With nightly builds I get more and more problems to
    run queries : some of them, although they return data, don't work in Heidi.

    here are 2 snapshots of the same query run into Heidi and into a mysql prompt :
    in heidi the log says "23 rows found" but they aren't displayed !

    http://picasaweb.google.com/sdjeser/MiscSoftwareSnapshots?feat=directlink

     
  • Anonymous

    Anonymous - 2010-02-12

    Originally posted by: a...@anse.de

    sdjeser, did you see you have maximized your query editor to the bottom on that
    screenshot? That's why you just can't see the results - they are displayed but hidden
    by your query editor. Heard that before from 2 or 3 users. Just try to
    * minimize your log panel so you can see the splitter between query editor and result
    again
    * then make your query editor slightly less high

     
  • Anonymous

    Anonymous - 2010-02-12

    Originally posted by: sdje...@gmail.com

    ok found the bug (rhaa): the result panel's size isn't updated if you reduce heidi's
    window size... so you don't see it, and need to enlarge the window to get it back.
    this is quite annoying when switching between 2 screens which don't have the same
    resolution...
    the result panel should be "locked" to be always visible (or at least let a bar to drag
    it)

     
  • Anonymous

    Anonymous - 2010-02-12

    Originally posted by: sdje...@gmail.com

    ooops didn't see your answer, ansgar.becker

     
  • Anonymous

    Anonymous - 2010-05-16

    Originally posted by: a...@anse.de

    Going to add a "Execute current query" action now. Any suggestions for a good default
    shortcut? Already used:
      F9 (all)
      Ctrl+F9 (selected text)
      Shift+Ctrl+F9 (current line)
    Or should I turn the "current line" execution into "current query"?

     
  • Anonymous

    Anonymous - 2010-05-16

    Originally posted by: june1...@gmail.com

    i vote for:

    F9 (run current query)
    Ctrl+F9 (selected text)
    Shift+Ctrl+F9 (current line)
    Shift+F9 (run all queries)

     
  • Anonymous

    Anonymous - 2010-05-17

    Originally posted by: kAlvaro

    I vote to just replace "Current line" with "Current query".

     
  • Anonymous

    Anonymous - 2010-05-17

    Originally posted by: a...@anse.de

    Yes, that was also my second thought.

     
  • Anonymous

    Anonymous - 2010-05-17

    Originally posted by: robert.l...@gmail.com

    I vote for turning current line into current query

     
  • Anonymous

    Anonymous - 2010-05-17

    Originally posted by: sdje...@gmail.com

    +1 for replacing current line by current query.

     
  • Anonymous

    Anonymous - 2010-05-17

    Originally posted by: bas...@hotmail.com

    I vote for alt-F9.

    There is indeed no longer a need for 'current line', but Shift+Ctrl+F9 seems one key
    extra to press :)

     
  • Anonymous

    Anonymous - 2010-05-18

    Originally posted by: fernando...@gmail.com

    So based on June10th's schema, and applying the current line removal, this should be
    the new shortcuts list:

    F9 ........... (run current query)
    Ctrl+F9 ...... (selected text)
    Shift+F9 ..... (run all queries)

    I vote on this because is so far usual to run just the current query and not a whole
    batch.

     
  • Anonymous

    Anonymous - 2010-05-18

    Originally posted by: andreas....@gmail.com

    Hi,
    i like your proposal to change current line to current query because i have a lot of
    multiline queries.

    Can you add a fourth option:
    if something is selected -> current selection, if nothing is selected ->all queries
    A default shortcut is not needed. But everybody who wants this, can assign a
    shortcut.
    (this is the way how it is done in querytool. I have to use querytool at work with
    DB2, and i always mix up the shurtcuts).

    Search->Peplace-Text could also be changed this way: if something is selected,
    preselect "selected text".

    Andi

     
1 2 > >> (Page 1 of 2)
MongoDB Logo MongoDB