Skip to content
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

Script Runner #10515

Closed
nbrugger-tgm opened this issue Aug 21, 2020 · 4 comments
Closed

Script Runner #10515

nbrugger-tgm opened this issue Aug 21, 2020 · 4 comments

Comments

@nbrugger-tgm
Copy link

Use case:

Sometimes i have a SQL schema and i would like my application to be able to connect to any Database and apply it to the server. So my application is able to use any database

Possible solution you'd like to see:

An jOOQ'ified version of https://github.com/BenoitDuffez/ScriptRunner/blob/master/ScriptRunner.java (Originaly from iBatis)

create.scrip(<File/Reader/Stream/whatever>).execute()

Possible workarounds:

Not me but some iBatis dupe (https://github.com/BenoitDuffez/ScriptRunner/blob/master/ScriptRunner.java)

@lukaseder
Copy link
Member

Thanks for your feature request.

From what I can tell, we have all the operations that you require here, mostly:

// If you're working with generated code
ctx.meta(generatedSchema).ddl().executeBatch();

// If you're working with SQL scripts
ctx.meta(Source.of(file/reader/whatever)).ddl().executeBatch();

// Or even just parse the thing
ctx.parser().parse(Source.of(file/reader/whatver)).executeBatch();

I hope this helps

@nbrugger-tgm
Copy link
Author

nbrugger-tgm commented Aug 24, 2020

Sadly this does not work with procedures or triggers which it does with the script runner.

At least it didn't worked the last time I tried it. I think it might be because of the DELMITTER command

@lukaseder
Copy link
Member

Procedure and trigger support are on the roadmap: #6956, #9190, but that's probably not what you had in mind - you'd like jOOQ to be Flyway? I.e. to "semi-parse" scripts to detect and interpret things like DELIMITER commands, SET commands, but none of the others?

@lukaseder
Copy link
Member

I think this may make sense, I've created a separate feature request to look into the option of turning the parser into a SQL statement agnostic one, interpreting only preprocessing commands, like DELIMITER: #10519

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants