-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for SET TERMINATOR instruction #51
base: master
Are you sure you want to change the base?
Added support for SET TERMINATOR instruction #51
Conversation
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
514893b
to
0894f47
Compare
This makes this feature compatible to IBM CLP and Data Architect. The documentation states: > The statement must be uppercase and in a comment. There can be leading spaces before the --, but there cannot be spaces between -- and #SET TERMINATOR x https://www.ibm.com/docs/en/ida/9.1.2?topic=terminators-changing-sql-statement-terminator
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. |
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;
} |
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:
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.