Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [dtp-dev] Execute multiple SQL statements one by one

Hi Hui,

 

Thank you for helpful direction. I estimated that I don’t need my own SQL parser (at least for now). I tried to separate SQL statements with ";"(which fortunately is default separator in MAXDB and this is registered in database definition too), but unfortunately GenericSQLParser didn’t split statements, separated with it. I tried to debug the process, but the code is obfuscated and this code is not clear to me (GenericSQLParser:1246):

 

      if (jj_2_14(2147483647)) {

        delimiter();

      } else {

 

The result is that the SQL Parser didn’t recognize the separators. This is an example snippet:

 

CREATE TABLE DD_ADDRESS (

                                ID INTEGER NOT NULL,

                                EGN TIMESTAMP,

                                STRING VARCHAR(255) UNICODE,

                                FAMILY VARCHAR(255) UNICODE,

                                NAME VARCHAR(255) UNICODE,

                                CITY VARCHAR(255) UNICODE,

                                NUMBER <UNKNOWN> NOT NULL

                );

ALTER TABLE DD_ADDRESS ADD CONSTRAINT DD_ADDRESS_PK PRIMARY KEY (ID)

 

Is the separator is used correct, or I have made mistake? I tried to type it on new row, to use GO instead of, but without any success. I tried to create JDBC connection to MAXDB and ORACLE in addition, but the behavior remained the same. The interesting is that this work for Derby, but the check is different (also unclear for me). Could you take a look and direct me what the problem is?

 

Best Regards,

Dimiter



From: dtp-dev-bounces@xxxxxxxxxxx [mailto:dtp-dev-bounces@xxxxxxxxxxx] On Behalf Of Hui.Cao@xxxxxxxxxx
Sent: Thursday, 17. May 2007 04:34
To: DTP development mailing list
Subject: Re: [dtp-dev] Execute multiple SQL statements one by one


Hi Dimiter,
        You don't need to implement your own action. The "Execute All"/"Execute Selected" actions in SQL editor takes care of this issue for you by separating the SQL statements using statement terminators defined by SQLParser. The default terminators are "GO" and ";" which are defined in GenericeSQLParser. If it does not work for MAXDB, you can override it in your MAXDB parser. To hook your parser into the framework, here are the steps:
1. provide a org.eclipse.datatools.sqltools.editor.core.dbConfigurations extension
2. return your parser in your MAXDBConfiguration.getSQLService().getSQLParser() method

For other extensible behaviors, please refer to SQLDevToolsTutorial.pdf located in the org.eclipse.datatools.sqltools/documents directory of the datatools cvs repository.

Best Regards!

Max (Hui) Cao
Sybase Shanghai RD



"Dimitrov, Dimiter" <d.dimitrov@xxxxxxx>
Sent by: dtp-dev-bounces@xxxxxxxxxxx

2007-05-16 23:52

Please respond to
DTP development mailing list <dtp-dev@xxxxxxxxxxx>

To
"DTP development mailing list" <dtp-dev@xxxxxxxxxxx>
cc
Subject
[dtp-dev] Execute multiple SQL statements one by one





Hi there,

        I want to ask a question related to the execution of SQL statements from org.eclipse.datatools.sqltools.sqlscrapbook.SQLScrapbookEditor. I had to execute multiple statements against MAXDB, but unfortunately MAXDB does not have a possibility to execute multiple statements in one JDBC call. So the solution is to execute the multiple statements one by one (but transparent for the user – not in the way, in which this functionality is realized in Outline view). So my question is whether is possible to implement myself this action (Execute All) depends on the connection and if yes how to do that.

Thank you in advance,
Dimiter

_______________________________________________
dtp-dev mailing list
dtp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dtp-dev

Attachment: smime.p7s
Description: S/MIME cryptographic signature


Back to the top