sequeler icon indicating copy to clipboard operation
sequeler copied to clipboard

Execute Multiple Queries.

Open ar0ra1 opened this issue 6 years ago • 14 comments

Right Now, it only executes the first query and ignores the remaining ones.

ar0ra1 avatar Oct 29 '17 09:10 ar0ra1

I was about to file the same issue :-) I guess the general solution would imply using an SQL parser (there seem to be several written in C and C++ on GitHub), but for a first solution it might be enough with a simple lexer that only understands comments and strings, and then simply splits by semicolon.

I might be able to help a bit but I haven't programmed C (or used lex) in ages and I have never programmed in Vala :-)

Edit: On second thought, what I expect is actually that only the query under the cursor will be executed (ie. what happens in DataGrip, which is great BTW). I guess if there's an active selection all the selected SQL should be sent as a query... that would cover @ar0ra1's usecase.

emanchado avatar Oct 29 '17 16:10 emanchado

Thanks both for the report and suggestion. The Gda Library for database queries is not the most intuitive in handling a query string, and as you noticed, it's really basic. Added to the backlog of future updates and features.

Alecaddd avatar Oct 29 '17 17:10 Alecaddd

Pushing a new version with the fix for this issue later tomorrow!

Alecaddd avatar Feb 19 '18 23:02 Alecaddd

It still doesn't run the second query!

ar0ra1 avatar Feb 25 '18 08:02 ar0ra1

That's a limitation of the LibGDA that unfortunately I can't fix. I'm working on the new version where I'm gonna drop that library and use specific database bindings. That'll solve it.

Alecaddd avatar Feb 25 '18 17:02 Alecaddd

Are there any news on this issue? Being able to execute multiple SQL statements in one tab/window would be quite nice.

diethardsteiner avatar Jul 06 '18 20:07 diethardsteiner

I'm working on this and it should be out around version 0.6 or similar. I'm trying to keep a sort of organized roadmap of the futures I'm implementing.

Alecaddd avatar Jul 06 '18 20:07 Alecaddd

ok thanks for letting me know! I am looking forward to this release then.

diethardsteiner avatar Jul 06 '18 21:07 diethardsteiner

I still have this problem, but 0.6 has already been released.

create table tab1 (
xxxxxx int
);


drop table tab1;

pktiuk avatar Dec 15 '20 19:12 pktiuk

It's quite an old issue, and I haven't seen the implementation since then. But, Why not build an array of queries? Split the string queries via delimiter (i.e., ";") Add to the queue and execute queries in the series?

@Alecaddd this was for the implementation

ar0ra1 avatar Dec 16 '20 12:12 ar0ra1

Maybe I misunderstood something, this description seemed to match my issue.

Split the string queries via delimiter (i.e., ";")

That's what I am doing.

I put multiple strings with queries in one query, I try to execute it, but only the last query is executed. image

pktiuk avatar Dec 17 '20 17:12 pktiuk

Sequeler doesn't currently support running multiple queries at once, I need to work on that feature. You can, for now, put your cursor on the first string, run the query, then move the cursor to the last string and run the query again.

Basically, for now, Sequeler runs the only the string that starts from an empty line or new line, until the end of the document or a semicolon.

Alecaddd avatar Dec 17 '20 18:12 Alecaddd

I need to work on that feature.

If it is a thing to implement maybe this issue should be reopened? To mark it as a something to be done.

pktiuk avatar Dec 18 '20 15:12 pktiuk

Kind of related to this: it'd be nice if you could run an entire .sql file from Sequeler.

freaktechnik avatar Feb 22 '22 17:02 freaktechnik