Hi all,

I got the code to compile and run fine...  I am digging through the sql2xml
task, and think that there may be a bug with using the sql2xml task and DDL
exported from MS SQL Server using Enterprise Manager.  I am using SQL Server
2000 on Windows 2000 Advanced Server.

When I export my "Stores" table, my DDL looks like the:

CREATE TABLE dbo.STORES (
        STORE_ID int IDENTITY (1,1) NOT NULL,
        STORE_NAME varchar(50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON PRIMARY
GO

The differences between what MSSQL Server exports and what the
SQLToAppData.java expects are:

1) IDENTITY value.  The store_id column is the primary key, and is an
autoincrementing column.  The issue seems to be that the SQLToAppData class
in the Create_Table_Column(Table tbl) method expects the column to be either
the name of the column or PRIMARY/FOREIGN/UNIQUE.  However, it is none of
these, it is IDENTITY.  Now, from what I understand about IDENTITY columns,
they are a combination of PRIMARY and UNIQUE.  They have to be unique in the
database, and they are typically the primary key.  So what I am now doing is
when we run into an identity column in the method Create_Table_Column_Data I
set the col to be auto increment and to be the primary key.

2) COLLATE value.  We are using SQL Server's Natural Language Query
function, which I think creates the COLLATE SQL... columns.  I added then to
the tokens as something to just be consumed.

3) ON PRIMARY GO values.  I changed the Create_Table method for the while
loop to see if it finds either ";" or "ON" string.  Then if the token is
"ON" then it consumes the PRIMARY and GO values.

4) dbo.STORES value.  I changed what the tablename is set to to remove any
database owner/user information attached to the table name.

These changes made it product a schema.xml file that looks correct.  I am
going to try and write up my notes on what I did for other people who are
trying to integrate Turbine and Torque into existing MS SQL Server setups.
What is the best format to do this in?  I looked at the .xml versions of
some of the documentation, is that I how I should format my document?



Here is the diff between CVS and what I did:


cvs diff SQLToAppData.java (in directory
C:\java\temp\jakarta-turbine-torque\src\java\org\apache\torque\engine\databa
se\transform)
Index: SQLToAppData.java
===================================================================
RCS file:
/home/cvspublic/jakarta-turbine-torque/src/java/org/apache/torque/engine/dat
abase/transform/SQLToAppData.java,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 SQLToAppData.java
28,30c28,30
<  * 4. The names "Apache" and "Apache Software Foundation" and 
<  *    "Apache Turbine" must not be used to endorse or promote products 
<  *    derived from this software without prior written permission. For 
---
>  * 4. The names "Apache" and "Apache Software Foundation" and
>  *    "Apache Turbine" must not be used to endorse or promote products
>  *    derived from this software without prior written permission. For
34c34
<  *    "Apache Turbine", nor may "Apache" appear in their name, without 
---
>  *    "Apache Turbine", nor may "Apache" appear in their name, without
79c79
<  * 
---
>  *
149c149
<         throw new ParseException (name + " at [ line: " + token.getLine()
+ 
---
>         throw new ParseException (name + " at [ line: " + token.getLine()
+
182a183,185
>         if (tableName.indexOf(".") >= 0){
>           tableName = tableName.substring(tableName.lastIndexOf(".")+1);
>         }
185,186c188,189
<         //tbl.setIdMethod("none");
<         while (!token.getStr().equals(";"))
---
> 
>         while (!token.getStr().equals(";") &&
!token.getStr().equals("ON"))
190c193,198
<         
---
> 
>         if (token.getStr().equals("ON")){
>           next(); // eat PRIMARY
>           next(); // eat GO
>         }
> 

> 
437c448
<                     if (!token.getStr().toUpperCase().equals("NULL")) 
---
>                     if (!token.getStr().toUpperCase().equals("NULL"))
441a453,468
>                 else if(token.getStr().toUpperCase().equals("IDENTITY"))
// MS SQL Server specific
>                 {
>                   col.setAutoIncrement(true);
>                   col.setPrimaryKey(true);
>                   while (!token.getStr().equals(")"))
>                   {
>                       // skip until )
>                       next();
>                   }
>                   next();
>                 }
>                 else if(token.getStr().toUpperCase().equals("COLLATE"))
// MS SQL Server specific
>                 {
>                   next(); // eat the SQL_Latin1_General_CP1_CI_AS stuff
>                   next();
>                 }
445c472
<                     if (!token.getStr().toUpperCase().equals("KEY")) 
---
>                     if (!token.getStr().toUpperCase().equals("KEY"))
480a508
> 

*****CVS exited normally with code 1*****

-  

Thanks for all the help,
Eric



-----Original Message-----
From: Pugh, Eric [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 26, 2001 10:53 AM
To: '[EMAIL PROTECTED]'
Subject: Build Torque fails...


Hi,

I am trying to run the torque ant task sql2xml and for a simple table, it
seems to run forever, on my NT box the processor hits 90% utilization!  So I
am trying to build torque, and running into problems..  

I checked out the jakarta-turbine-torque library, and got all the src code
down.  In the readme file it mentions a build.properties.sample that I
should rename build.properties, but that doesn't seem to exist.  There also
is no build/ directory.  The build.xml and default.properties files are at
the root.

So I am creating my own, but where is the easiest place to get some of the
harder to find libs like commons-colletions.jar and
commons-util-0.1-dev.jar?  Should they have come when I downloaded the
source code?  I found the commons-util-0.1 in the path [Apache] /
jakarta-turbine-torque / lib / Attic .  The note from jvanzyl is that there
shouldn't be jars in CVs: "- no jars in cvs, even if it is a PITA right now.
we have to move in the right ... "   Why is that?  It seem to make building
the source harder for new bies?  

At any rate, i guess I will keep poking around trying to find the various
jars...

Thank you for putting up with all the newbie questions...

Eric

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to