Skip to content

Conversation

huangsheng0415
Copy link

The reason why I raise this problem is that I encounter a business scenario in the company. I use mysql. I need to execute the SQL script during the running of the program. The SQL script creates databases, tables, stored procedures, functions and views, but errors often occur during the execution. The main reason is that the splitters cannot be handled uniformly when parsing SQL, Here I give an example.

微信图片_20210814191007

Let's take a look at this example. At present, the default separator is ";", This is effective for the above operations such as creating a database, but it is not allowed to execute the following stored procedure. Therefore, I added an attribute to expand its function. After testing, after setting this attribute, the program can execute the whole SQL script normally. If this attribute is not set, there will be no impact on the original function. Thank you

@harawata
Copy link
Member

Thank you for the PR, @q2wdqea ,

First of all, please use text instead of image whenever possible.

DELIMITER ;; is a syntax specific to MySQL client.
If you use ScriptRunner, you must use its syntax which is...

-- @DELIMITER ;;

I will close this PR.
The reason is explained in the class comment.

* This is an internal testing utility.<br>
* You are welcome to use this class for your own purposes,<br>
* but if there is some feature/enhancement you need for your own usage,<br>
* please make and modify your own copy instead of sending us an enhancement request.<br>

p.s.
There have been many ideas about supporting various clients' native syntax.
See the discussion on #1890 if you are interested.

@harawata harawata closed this Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants