Hi all,
I have just a simple question.
I have a sql file with multiple statements.
Is there a way to execute only the selected statment in the sql editor?
Greetings
Marco
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That depends on the version of Quantum you use and on the line endings of your statements. I verified this with 3.3.0 and the internal Derby database,
If all is well, you simply select the statements you want to run, and then right click and execute (or hit shift-control-q.
Whether this is successful, depends on whether the statements can be parsed. Currently quantum splits the statements on a ; . Even if you use SQL Server we recommend to end the statements like this. This makes your SQL more portable to other databases.
Hope this helps,
Kind regards,
Jan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Jan,
I have Quantum version 3.3.0 installed.
My two statements are ending with ; and I use MySql.
If I select the first statement in "Quantum SQL2 Editor" and try to execute this statement, all statements will be executed. As result I get the last sql statement.
If I do the same in "Quantum SQL Queries View" everything works fine.
It seems that this feature is not implemented for the Editor.
Can you confirm this?
Best wishes
Marco
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I have just a simple question.
I have a sql file with multiple statements.
Is there a way to execute only the selected statment in the sql editor?
Greetings
Marco
Dear Marco,
That depends on the version of Quantum you use and on the line endings of your statements. I verified this with 3.3.0 and the internal Derby database,
If all is well, you simply select the statements you want to run, and then right click and execute (or hit shift-control-q.
Whether this is successful, depends on whether the statements can be parsed. Currently quantum splits the statements on a ; . Even if you use SQL Server we recommend to end the statements like this. This makes your SQL more portable to other databases.
Hope this helps,
Kind regards,
Jan
Hi Jan,
I have Quantum version 3.3.0 installed.
My two statements are ending with ; and I use MySql.
If I select the first statement in "Quantum SQL2 Editor" and try to execute this statement, all statements will be executed. As result I get the last sql statement.
If I do the same in "Quantum SQL Queries View" everything works fine.
It seems that this feature is not implemented for the Editor.
Can you confirm this?
Best wishes
Marco
Yipii... finally I found out what the problem was.
It was a little bug in Quantum version 3.3.0
I just did following modification in com.quantum.editors.SQL2Editor.java
change following method:
public String getQuery() {
return getSourceViewer().getTextWidget().getText();
}
to
public String getQuery() {
String query;
if (getSourceViewer().getTextWidget().getSelectionText().length() > 0)
query = getSourceViewer().getTextWidget().getSelectionText();
else
query = getSourceViewer().getTextWidget().getText();
return query;
}
With this modification the behavoir(and also the source) is equal with Quantum SQL Queries View.
Cheers!
Marco
Great! I'll check it into the main source tree. Sorry for not answering before, I keep getting no mails from sourceforge.net.
Thanks for your contribution.
Julen.