Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » Using the SQL Query Builder UI
Using the SQL Query Builder UI [message #653140] Tue, 08 February 2011 16:16 Go to next message
akoeck is currently offline akoeckFriend
Messages: 62
Registered: December 2010
Member
I want to use the SQL Query Builder UI in my Project.

First of all is this possible?
If so, is there a tutorial or something else which describes how to use it?

I want to use the ui to create simple intersect, minus and union queries for mysql.
Since mysql doesn't support intersect and minus i have to build my own via joins. So they have to be simple.
The user should use the query builder to select the rows and tables and in the background the query should be build.
Re: Using the SQL Query Builder UI [message #653853 is a reply to message #653140] Fri, 11 February 2011 14:55 Go to previous messageGo to next message
akoeck is currently offline akoeckFriend
Messages: 62
Registered: December 2010
Member
I found this http://wiki.eclipse.org/SQL_Query_Builder_Component_API

But I'm not quite sure how I open the Query Builder UI and how i create my own sql.

Hope someone out there can hel me.

Regards
Alexander
Re: Using the SQL Query Builder UI [message #653937 is a reply to message #653853] Fri, 11 February 2011 23:25 Go to previous messageGo to next message
Brian Payton is currently offline Brian PaytonFriend
Messages: 154
Registered: July 2009
Senior Member
You can open the SQL Query Builder either as an editor or as a dialog.

Here's how to open it both ways in the DTP UI. To open the SQB as a
dialog, first open the SQL editor, then launch the SQB from a DML
statement in the editor. Here are steps:
1. Make sure you have an active database connection. (Let's call it
TESTDB.)
2. Make sure the Project Explorer view is open.
3. Create a project. (A General project will do.)
3. Do a New -> SQL File action. In the New SQL File wizard, associate
the editor with TESTDB.
4. In the SQL editor, enter a valid DML (query) statement, such as
"select lastname from employees".
5. Select the query statement text, right-click, and do a "Edit in SQL
Query Builder..." action. This should launch the SQB on the statement.

To open the SQB as an editor, you can right-click on a .sql file that
contains a single DML statement and do an Open With -> SQL Query Builder
action. For example, let's assume you have done the above steps, and
have closed the SQL editor and saved the query statement above in a file
named test.sql in your project. Then simply right-click on test.sql and
do the Open With -> SQL Query Builder action.

On a programmatic level, the SQL Query Builder plugin registers itself
as an editor on files with a .sql extension. See the plugin.xml file of
the org.eclipse.datatools.sqltools.sqlbuilder plugin.

To see how the SQB is launched as a dialog, see the following:
- the run method in class DMLDialogSelectionSQLAction in plugin
org.eclipse.datatools.sqltools.sqleditor
- the getDMLDialog method in class UIComponentService in plugin
org.eclipse.datatools.sqltools.editor.core.ui
- the getDMLDialog method in class SQLBuilderUIComponentService in
plugin org.eclipse.datatools.sqltools.sqlbuilder

On 2/11/2011 6:55 AM, akoeck@gmx.de wrote:
> I found this http://wiki.eclipse.org/SQL_Query_Builder_Component_API
>
> But I'm not quite sure how I open the Query Builder UI and how i create
> my own sql.
>
> Hope someone out there can hel me.
>
> Regards
> Alexander
Re: Using the SQL Query Builder UI [message #654115 is a reply to message #653937] Mon, 14 February 2011 09:25 Go to previous messageGo to next message
akoeck is currently offline akoeckFriend
Messages: 62
Registered: December 2010
Member
Do't know if this really helps me.

I want to combine it with an GMF Editor. When I run my creation tool a
dialog should open where the user can choose to write the SQL per hand
or to use the Query Builder for Intersect, Union or Minus.
This is my problem and I don't exactly know how to solve this. I mean
the code snippets are good, but I don't know how to bring them together.


Am 12.02.2011 00:25, schrieb Brian Payton:
> You can open the SQL Query Builder either as an editor or as a dialog.
>
> Here's how to open it both ways in the DTP UI. To open the SQB as a
> dialog, first open the SQL editor, then launch the SQB from a DML
> statement in the editor. Here are steps:
> 1. Make sure you have an active database connection. (Let's call it
> TESTDB.)
> 2. Make sure the Project Explorer view is open.
> 3. Create a project. (A General project will do.)
> 3. Do a New -> SQL File action. In the New SQL File wizard, associate
> the editor with TESTDB.
> 4. In the SQL editor, enter a valid DML (query) statement, such as
> "select lastname from employees".
> 5. Select the query statement text, right-click, and do a "Edit in SQL
> Query Builder..." action. This should launch the SQB on the statement.
>
> To open the SQB as an editor, you can right-click on a .sql file that
> contains a single DML statement and do an Open With -> SQL Query Builder
> action. For example, let's assume you have done the above steps, and
> have closed the SQL editor and saved the query statement above in a file
> named test.sql in your project. Then simply right-click on test.sql and
> do the Open With -> SQL Query Builder action.
>
> On a programmatic level, the SQL Query Builder plugin registers itself
> as an editor on files with a .sql extension. See the plugin.xml file of
> the org.eclipse.datatools.sqltools.sqlbuilder plugin.
>
> To see how the SQB is launched as a dialog, see the following:
> - the run method in class DMLDialogSelectionSQLAction in plugin
> org.eclipse.datatools.sqltools.sqleditor
> - the getDMLDialog method in class UIComponentService in plugin
> org.eclipse.datatools.sqltools.editor.core.ui
> - the getDMLDialog method in class SQLBuilderUIComponentService in
> plugin org.eclipse.datatools.sqltools.sqlbuilder
>
> On 2/11/2011 6:55 AM, akoeck@gmx.de wrote:
>> I found this http://wiki.eclipse.org/SQL_Query_Builder_Component_API
>>
>> But I'm not quite sure how I open the Query Builder UI and how i create
>> my own sql.
>>
>> Hope someone out there can hel me.
>>
>> Regards
>> Alexander
Re: Using the SQL Query Builder UI [message #657164 is a reply to message #654115] Tue, 01 March 2011 19:03 Go to previous messageGo to next message
akoeck is currently offline akoeckFriend
Messages: 62
Registered: December 2010
Member
I've decided to create a simple GUI on my own. But therefore I want to know which visual elements are used in the area where I "build" my query with the visual elements.
Re: Using the SQL Query Builder UI [message #657241 is a reply to message #657164] Wed, 02 March 2011 05:32 Go to previous messageGo to next message
Brian Payton is currently offline Brian PaytonFriend
Messages: 154
Registered: July 2009
Senior Member
I'm not quite sure what you are asking for here. Can you explain in a
little more detail?

On 3/1/2011 11:03 AM, akoeck@gmx.de wrote:
> I've decided to create a simple GUI on my own. But therefore I want to
> know which visual elements are used in the area where I "build" my query
> with the visual elements.
Re: Using the SQL Query Builder UI [message #657247 is a reply to message #657241] Wed, 02 March 2011 07:35 Go to previous message
akoeck is currently offline akoeckFriend
Messages: 62
Registered: December 2010
Member
Ok, I try to explain it form the beginning.

I need to have a GUI for the user to build INTERSECT, MINUS and UNION queries for MySQL. UNION is not the problem. Since there is no INTERSECT and MINUS supportet in MySQL the user should only "build" the query via an visual editor. So this is where comes your Query Builder into the game.
http://www.abload.de/img/query_builderluw9.jpg

But, i don't really know how tu use your UI, and also I don't know if I can use there my own "SQL Building (Joins insetad of Intersect and Minus)", I'm also using temporary tables, and I don't know if I could select them with your UI.
Also I don't really need everything from the Query Builder Dialog. Only the marked area and there I really need the part where the tables and statement types are shown.
http://www.abload.de/img/query_builder2snp3.jpg

But there I don't exactly know which visual components are used there to build the editorarea and the tables and connections within.

This is what I'm asking. I mean when you tell me this is all easier to achieve with your Query Builder i would use it, but if not, i need to know how to build the editor.

Thanks in advance.

Brian Payton wrote on Wed, 02 March 2011 00:32
I'm not quite sure what you are asking for here. Can you explain in a
little more detail?

On 3/1/2011 11:03 AM, akoeck@gmx.de wrote:
> I've decided to create a simple GUI on my own. But therefore I want to
> know which visual elements are used in the area where I "build" my query
> with the visual elements.

[Updated on: Wed, 02 March 2011 07:36]

Report message to a moderator

Previous Topic:MySQL schema not shown in 'data source explorer' view - Helios
Next Topic:Displaying database package source
Goto Forum:
  


Current Time: Fri Apr 19 22:08:16 GMT 2024

Powered by FUDForum. Page generated in 0.03396 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top