You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Rodney Schneider <ro...@actf.com.au> on 2002/10/10 08:45:40 UTC

[PATCH] Bugs in tdk-2.2-b3 newapp generation

Hi all,

I downloaded and installed TDK-2.2-b3 (Redhat 7.2, MySQL 3.23.42).
After generating the sample newapp tdk project, I encountered some
errors during "ant init"

WEB-INF/conf/id-table-schema.xml is generated with no "name="
parameter in the <database> tag.

WEB-INF/src/sql/create-db.sql is then generated with the following
lines:
drop database if exists default;
create database default;

This causes SQLExceptions to occur while ant executes the create-db
target, so only 6 of 8 SQL statements end up being executed
successfully.  There is a patch to id-table-schema.xml that fixes
this problem below.

However, there is also a line in
jakarta-turbine-tdk/src/tdk/apps/2/build.properties that isn't
actually used in the build files anywhere, so I am not sure why it
is there:
idTableDatabase = @PROJECT@

Another issue is that two files are moved into the WEB-INF/conf
directory during newapp generation, second-schema.xml and 
third-schema.xml, which contain the following tags:
<database name="second">
<database name="third">

This causes create-db.sql to be generated with the following lines:
drop database if exists second;
create database second;
drop database if exists third;
create database third;

But, the insert-sql uses sqlInsert.databaseUrl...
----
<property name="sqlInsert.databaseUrl" value="${databaseUrl}"/>
<ant
  antfile="${torque.buildFile}"
  target="insert-sql">
</ant>
----
... and the above causes all the sql files to be inserted into the
same database. If we wanted the second and third schemas to be
inserted into separate databases, we would need to have a way to
filter the database names into the database urls used to insert the
sql files.  But, due to the fact that each different RDBMS uses a
different url format, this would be a bit tricky.  Is this what you
guys were planning?

Anyway, I have attached patches to these two schema files which
causes them to be inserted into the project's default database.
This stops the errors occurring during "ant init".

Is the intention to have the three schema files inserted into
separate databases and to allow the id-table to be in a separate
database too?

If so, I'll have a crack at finishing this off.

Regards,

-- Rodney


#########

Index: ./src/schema/id-table-schema.xml
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-torque/src/schema/id-table-schema.xml,v
retrieving revision 1.5
diff -u -r1.5 id-table-schema.xml
--- ./src/schema/id-table-schema.xml    18 Feb 2002 19:55:53 -0000      1.5
+++ ./src/schema/id-table-schema.xml    10 Oct 2002 06:13:26 -0000
@@ -14,7 +14,7 @@
 <!-- @version $Id: id-table-schema.xml,v 1.5 2002/02/18 19:55:53 jon Exp $ 
-->
 <!-- ==================================================================== -->

-<database>
+<database name="@DATABASE_DEFAULT@">
   <table name="ID_TABLE" idMethod="idbroker">
     <column name="ID_TABLE_ID" required="true" primaryKey="true" 
type="INTEGER"/>
     <column name="TABLE_NAME" required="true" size="255" type="VARCHAR"/>

#########

Index: ./src/tdk/apps/2/src/conf/second-schema.xml
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-tdk/src/tdk/apps/2/src/conf/second-schema.xml,v
retrieving revision 1.2
diff -u -r1.2 second-schema.xml
--- ./src/tdk/apps/2/src/conf/second-schema.xml 15 Feb 2002 11:00:08 -0000    
  1.2
+++ ./src/tdk/apps/2/src/conf/second-schema.xml 10 Oct 2002 06:14:49 -0000
@@ -9,7 +9,7 @@
 <!-- This is an example Turbine project schema.                           -->
 <!-- ==================================================================== -->

-<database name="second">
+<database name="@PROJECT@">
   <table name="RDF2" idMethod="idbroker">
     <column name="RDF_ID" required="true" primaryKey="true" type="INTEGER"/>
     <column name="TITLE" size="255" type="VARCHAR"/>

#########

Index: ./src/tdk/apps/2/src/conf/third-schema.xml
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-tdk/src/tdk/apps/2/src/conf/third-schema.xml,v
retrieving revision 1.2
diff -u -r1.2 third-schema.xml
--- ./src/tdk/apps/2/src/conf/third-schema.xml  15 Feb 2002 11:00:10 -0000    
  1.2
+++ ./src/tdk/apps/2/src/conf/third-schema.xml  10 Oct 2002 06:15:43 -0000
@@ -9,7 +9,7 @@
 <!-- This is an example Turbine project schema.                           -->
 <!-- ==================================================================== -->

-<database name="third">
+<database name="@PROJECT@">
   <table name="RDF3" idMethod="idbroker">
     <column name="RDF_ID" required="true" primaryKey="true" type="INTEGER"/>
     <column name="TITLE" size="255" type="VARCHAR"/>

#########

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>