On Mon, 13 May 2013, Ben Stover wrote:
> Assume I have various SQL statements entered in the SQL editor pane.
>
> They are all delimited by a blank line.
>
> When I put now the cursor onto lets say the 3rd SQL statement (out of 5)
> and press the "run" icon in the toolbar then all SQL statements from
> cursor position downwards are executed.
>
> How can I let Squirrel only execute ONLY the SQL statement under the
> current cursor position (until the next blank line) and stop then?
That is how it behaves for me with all the database platforms I use it
with. A blank line is a delimiter, and it only executes one block of SQL
as delimited by blank lines.
This can be annoying when you load an SQL script from a file and forget
this limitation, or if you accidentally hit RETURN once too often in the
middle of a query... :)
Be *VERY CAREFUL* of accidentally inserting a blank line before the WHERE
clause of an UPDATE or DELETE query... :(
Squirrel will execute the code preceding the cursor if it's on a blank
line after text (e.g. so you can type a query, hit [ENTER] reflexively,
then hit [CTRL]-[ENTER] and it will still execute the query you just
typed), but if your cursor is on a single blank line between queries, I'm
not sure what happens - I usually separate queries by two or more blank
lines to make selecting them a little easier.
I've *never* seen it execute from the cursor to the end of the file
regardless of blank lines like you describe.
I don't know why it wouldn't be behaving this way for you. What database
platform is this? Are all your options at the defaults? I suppose it's
possible one of the SQL parsing options (query delimiter, perhaps?) got
changed from the default and that's causing this behavior.
> How can I let Squirrel execute ALL SQL statements on pane regardless of
> the current curosr position?
[CTRL]-A to select all, then execute. [CTRL]-A, [CTRL]-[RETURN]
What is selected (highlighted) is what will be executed regardless of
where the cursor is.
--
John Hardin KA7OHZ http://www.impsec.org/~jhardin/
jh...@im... FALaholic #11174 pgpk -a jh...@im...
key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
Drugs will always be around. Politicians are therefore making an
active decision to distribute them through violent gangs. --Twitter
-----------------------------------------------------------------------
347 days since the first successful private support mission to ISS (SpaceX)
|