Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dtp-dev] SQL statements don't work well.


If you are using the DDL generation wizard to generate the DDL, then the user can specify the SQL terminator in the wizard.  If you are calling the DDL generator programmatically then your code needs to determine and append the terminator.

You can look at org.eclipse.datatools.connectivity.sqm.fe.internal.ui.wizards.FEWizard.generateDDL() for an example of how the terminator is appended by the DDL generation wizard.

Larry Dunnell
RAD Data Tools, DB2 Tooling,  Eclipse WTP Project and Eclipse DTP Project
IBM DB2 Information Management Software




"hosokawa" <hosokawa@xxxxxxxxxxxxxxxxx>
Sent by: dtp-dev-bounces@xxxxxxxxxxx

01/16/2007 11:11 PM

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

To
"DTP development mailing list" <dtp-dev@xxxxxxxxxxx>
cc
Subject
Re: [dtp-dev] SQL statements don't work well.





Thanks Der Ping,

Adding termination character, the DDLs were executed successfully.

Now, our plugin generates DDL statements using the DDL generator of DTP,
but generated statements have no termination character.
We have to add it by our plugin itself? or there is any method to add it by
the DLL generator?

To specify constraints, our plugin uses "setBaseTable()" method of the
constraint object.
For exsample, in the of Unique cnstraint,

UniqueConstraint unq = new UniqueConstraintImpl();
unq.setBaseTable(baseTable);
unq.setName(constraintName);
unq.getMembers().add(unqColumn);

I gess this is because why DDL statements are separeated CREATE TABLE and
ALTER TABLE though,,,

Best regards,

Takehiro Hosokawa
VALWAY Technology Center, NEC Soft, Ltd.

----- Original Message -----
From: Der Ping Chou
To: DTP development mailing list
Cc: DTP development mailing list ; dtp-dev-bounces@xxxxxxxxxxx
Sent: Wednesday, January 17, 2007 2:19 PM
Subject: Re: [dtp-dev] SQL statements don't work well.



Hosokawa,

Could you try the DDL with termination character? For example ';' to see if
it works for you.

   CREATE TABLE test_table (
          aaa INTEGER NOT NULL,
          bbb CHAR NOT NULL
      );
  ALTER TABLE test_table ADD CONSTRAINT unq_bbb UNIQUE (bbb);

Also, I believe the dbdefinition support the so call termination character
which you can query for each database and then in the DDL generation you can
then append to the end of each statement.

Hope this help.

Der-Ping Chou
Information Management Tooling
Development Manager - Data Tools
Seattle IBM Office
tel : 1-206-587-5946 (T/L: 277-5946)
fax: 1-206-587-4415



"hosokawa" <hosokawa@xxxxxxxxxxxxxxxxx>
Sent by: dtp-dev-bounces@xxxxxxxxxxx
01/16/2007 07:15 PM Please respond to
DTP development mailing list <dtp-dev@xxxxxxxxxxx>

To"DTP development mailing list" <dtp-dev@xxxxxxxxxxx>
cc
Subject[dtp-dev] SQL statements don't work well.







Hi,

On the SQL Editor, when I execute SQL statments like below, syntax error
occurs.

Executes SQL statements like:

  CREATE TABLE test_table (
          aaa INTEGER NOT NULL,
          bbb CHAR NOT NULL
      )
  ALTER TABLE test_table ADD CONSTRAINT unq_bbb UNIQUE (bbb)

Error occurs like:

 "Syntax error: Encountered "ALTER" at line 5, column 1."

Such a sequence, like CREATE TABLE and ALTER TABLE immediately, is not
admitted?
I checked they work well when CREATE TABLE statement and ALTER TABLE
statement
are executed separately like below exsample.

Executes just CREATE TABLE first:

  CREATE TABLE test_table (
          aaa INTEGER NOT NULL,
          bbb CHAR NOT NULL
      )

Executes ALTER TABLE next:

  ALTER TABLE test_table ADD CONSTRAINT unq_bbb UNIQUE (bbb)

I gotta "Succeeded" message at each time.

Best regards,

Takehiro Hosokawa
VALWAY Technology Center, NEC Soft, Ltd.

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





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

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


Back to the top