GeezerVison is showing github.com — Added support for SET TERMINATOR instruction by Cybso · Pull Request #51 · squirrel-sql-client/squirrel-sql-code
Conversation
Cybso
commented
Nov 28, 2024
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
This allows to temporarily change the statement separator with an inline comment and thus supports to execute statements that uses the semicolon within their expression, for example triggers or procedures with BEGIN..END blocks.
Example:
DROP PROCEDURE foobar;
CREATE PROCEDURE foobar
BEGIN
--#SET TERMINATOR !
declare v char(10);
select value into v from sometable;
if v = 'test' then
update sometable set value = '';
end if;
--#SET TERMINATOR ;
END;
LABEL ON PROCEDURE foobar IS 'Example';
This commit fixes feature request 433 on sourceforge (https://sourceforge.net/p/squirrel-sql/feature-requests/433/).
It currently only supports the default QueryTokenizer. The statement separator is only changed for the current execution.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This allows to temporarily change the statement separator with an inline comment and thus supports to execute statements that uses the semicolon within their expression, for example triggers or procedures with `BEGIN..END` blocks.
Example:
```sql
DROP PROCEDURE foobar;
--#SET TERMINATOR !
CREATE PROCEDURE foobar
BEGIN
declare v char(10);
select value into v from sometable;
if v = 'test' then
update sometable set value = '';
end if;
END!
--#SET TERMINATOR ;
LABEL ON PROCEDURE foobar IS 'Example';
```
This commit fixes feature request 433 on sourceforge (https://sourceforge.net/p/squirrel-sql/feature-requests/433/).
It currently only supports the default QueryTokenizer. The statement separator is only changed for the current execution.
…with other length than 2
gerdwagner
pushed a commit
that referenced
this pull request
Nov 30, 2024
To change the statement separator during SQL execution, use the following command on a separate line:
--#SET TERMINATOR <separator>
This command does not change the separator permanently but for a single SQL execution only.
See also menu File --> New Session Properties --> tab SQL --> section "Statement separator"
Thanks to Roland Tapken for the pull request
|
Was merged with several adjustments. Please take a look if it still works for you. Most of your code is now in the new ChangeStatementSeparatorSupport class.
Thanks for your pull request.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Cybso
commented
Dec 1, 2024
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Was merged with several adjustments. Please take a look if it still works for you. Most of your code is now in the new ChangeStatementSeparatorSupport class.
I haven't completely figured out the integration, but it looks pretty good at first glance. I have added three small notes to the commit. In particular, the method isCommandPrecededBySpacesOrTabsOnly is named incorrectly or the return value is the wrong way around. However, since the call also takes this into account, it still works at the moment, it's just not intuitive:
if(isCommandPrecededBySpacesOrTabsOnly(_script, searchStartPos))
{
return null;
}
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.