Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » extending SQL Builder(Extending SQL Builder and Parser to support custom host variable)
extending SQL Builder [message #484351] Mon, 07 September 2009 03:41 Go to next message
Satish Kuncha is currently offline Satish Kuncha
Messages: 2
Registered: July 2009
Junior Member
Hello,

We are trying extending the SQL Builder dialog of the SQL data tools for providing our project specific functionality.

Our requirements are

1. To have the SQLBuilder and Parser detect our own host variable
a. The syntax for our host variable is %var%.
e.g. %id% is the host variable in the following select query: Select cust_id, cust_name from customer where cust_id = %id%

2. To extend the SQLBuilder GUI for supporting host variable with new syntax.
a. One view is an additional option where we find P_BUILD_Expression(Build Expression...)
b. OR a custom page in 'Expression Builder' wizard.

The following are the problems we faced while trying to tailor SQL data tools code for our needs

About the host variable parsing/recognition:
SQLQuerySourceFormat class only provides a way to set the host variable prefix character. But in our scenario, the variable is delimited by a prefix and a suffix, i.e. '%'. The SQLQueryParserFactory's createVariableExpression() method also handles only the prefix.

About extending the SQL Builder GUI: most classes have the fields declared in default (package level) scope
a. Is there a provision to add something like P_INPUT_EXPRESSION where it presently shows P_BUILD_EXPRESSION/ P_EDIT_EXPRESSION/ P_REPLACE_EXPRESSION for launching our own expression builder
b. OR is there a way to contribute a new page to the 'Expression Builder wizard' e.g. through some sort of extension?

Thanks for your help in advance.
Re: extending SQL Builder [message #503340 is a reply to message #484351] Fri, 11 December 2009 13:40 Go to previous message
Brian Payton is currently offline Brian Payton
Messages: 152
Registered: July 2009
Senior Member
You are correct that there is a built-in assumption that host variables
have only a prefix character. You will have to do some sub-classing at
appropriate places to handle the suffix. You will have to tweak both
the Query parser and the SQLQuerySourceWriter to handle the suffix.

I suggest launching your own expression builder rather than extending
the existing one. The expression builder in the SQB isn't easy to
extend and is very hard to use. If you come up fix that allows an
extender to add to or change the expression builder launch menu items,
please submit a patch in a bug.

Satish Kuncha wrote:
> Hello,
>
> We are trying extending the SQL Builder dialog of the SQL data tools for
> providing our project specific functionality.
>
> Our requirements are
>
> 1. To have the SQLBuilder and Parser detect our own host variable
> a. The syntax for our host variable is %var%.
> e.g. %id% is the host variable in the following select query: Select
> cust_id, cust_name from customer where cust_id = %id%
>
> 2. To extend the SQLBuilder GUI for supporting host variable with new
> syntax.
> a. One view is an additional option where we find
> P_BUILD_Expression(Build Expression...)
> b. OR a custom page in 'Expression Builder' wizard.
>
> The following are the problems we faced while trying to tailor SQL data
> tools code for our needs
> About the host variable parsing/recognition: SQLQuerySourceFormat class
> only provides a way to set the host variable prefix character. But in
> our scenario, the variable is delimited by a prefix and a suffix, i.e.
> '%'. The SQLQueryParserFactory's createVariableExpression() method also
> handles only the prefix.
> About extending the SQL Builder GUI: most classes have the fields
> declared in default (package level) scope
> a. Is there a provision to add something like P_INPUT_EXPRESSION
> where it presently shows P_BUILD_EXPRESSION/ P_EDIT_EXPRESSION/
> P_REPLACE_EXPRESSION for launching our own expression builder b. OR
> is there a way to contribute a new page to the 'Expression Builder
> wizard' e.g. through some sort of extension?
>
> Thanks for your help in advance.
>
Previous Topic:Status of the Ecore ODA Driver?
Next Topic:extending SQL Builder
Goto Forum:
  


Current Time: Sun Apr 20 22:55:11 EDT 2014

Powered by FUDForum. Page generated in 0.02586 seconds