jvanzyl 01/10/31 18:23:01
Modified: src/conf build-torque.xml build.properties build.xml
Log:
- added database creation task
- added sql insertion
the database creation tasks are starting to use SQL to create
the databases so the creation of a shell script is gone. i've
only tried this with mysql and postgres but i imagine it will
work for the others as we've discussed on the lists.
Revision Changes Path
1.4 +78 -2 jakarta-turbine-torque/src/conf/build-torque.xml
Index: build-torque.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/conf/build-torque.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- build-torque.xml 2001/10/28 19:39:35 1.3
+++ build-torque.xml 2001/11/01 02:23:01 1.4
@@ -78,12 +78,88 @@
controlTemplate="${SQLControlTemplate}"
outputDirectory="${torque.home}/${outputDirectory}/sql"
templatePath="${templatePath}"
+ sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
outputFile="report.${project}.sql.generation"
- xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
+ targetDatabase="${database}">
+ <fileset dir="${torque.home}/${schemaDirectory}">
+ <include name="*-schema.xml"/>
+ </fileset>
+ </torque-sql>
+
+ </target>
+
+ <!-- ================================================================ -->
+ <!-- C R E A T E T A R G E T D A T A B A S E -->
+ <!-- ================================================================ -->
+ <!-- Create the target database by executing a generated script -->
+ <!-- that is capable of performing the task. -->
+ <!-- ================================================================ -->
+
+ <target
+ name="project-create-db"
+ unless="database.manual.creation"
+ description="--> generates the target database">
+
+ <taskdef
+ name="torque-create-db"
+ classname="org.apache.torque.task.TorqueCreateDatabase">
+ <classpath refid="classpath"/>
+ </taskdef>
+
+ <torque-create-db
+ controlTemplate="sql/db-init/Control.vm"
+ outputDirectory="${torque.home}/${outputDirectory}/sql"
+ templatePath="${templatePath}"
+ outputFile="create-db.sql"
+ targetPlatform="${platform}"
targetDatabase="${database}"
- />
+ databaseUser="${databaseUser}"
+ databasePassword="${databasePassword}"
+ databaseHost="${databaseHost}">
+ <fileset dir="${torque.home}/${schemaDirectory}">
+ <include name="*-schema.xml"/>
+ </fileset>
+ </torque-create-db>
+
+ <sql
+ driver="${databaseDriver}"
+ url="${createDatabaseUrl}"
+ userid="${databaseUser}"
+ password="${databasePassword}"
+ src="${torque.home}/${outputDirectory}/sql/create-db.sql"
+ autocommit="true"
+ onerror="continue">
+ <classpath refid="classpath"/>
+ </sql>
+
+ </target>
+
+ <!-- ================================================================ -->
+ <!-- I N S E R T S I N G L E S Q L F I L E S -->
+ <!-- ================================================================ -->
+
+ <target
+ name="project-insert-sql">
+ <taskdef
+ name="torque-insert-sql"
+ classname="org.apache.torque.task.TorqueSQLExec">
+ <classpath refid="classpath"/>
+ </taskdef>
+
+ <torque-insert-sql
+ driver="${databaseDriver}"
+ url="${databaseUrl}"
+ userid="${databaseUser}"
+ password="${databasePassword}"
+ autocommit="true"
+ onerror="continue"
+ sqldbmap="${basedir}/${outputDirectory}/sql/sqldb.map"
+ srcDir="${basedir}/${outputDirectory}/sql">
+ <classpath refid="classpath"/>
+ </torque-insert-sql>
</target>
+
<!-- ================================================================ -->
<!-- J D B C TO X M L -->
1.7 +6 -5 jakarta-turbine-torque/src/conf/build.properties
Index: build.properties
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/conf/build.properties,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- build.properties 2001/10/29 18:48:00 1.6
+++ build.properties 2001/11/01 02:23:01 1.7
@@ -45,7 +45,7 @@
# Default: none
# -------------------------------------------------------------------
-database = mysql
+database = postgresql
# -------------------------------------------------------------------
#
@@ -85,10 +85,11 @@
# Turbine system with the generated SQL.
# -------------------------------------------------------------------
-databaseUrl = jdbc:mysql://127.0.0.1/bookstore
-databaseDriver = org.gjt.mm.mysql.Driver
-databaseUser = user
-databasePassword = password
+createDatabaseUrl = jdbc:postgresql://127.0.0.1:5432/template1
+databaseUrl = jdbc:postgresql://127.0.0.1:5432/bookstore
+databaseDriver = org.postgresql.Driver
+databaseUser = jvanzyl
+databasePassword =
databaseHost = 127.0.0.1
# Tells JDBC task that javaName attribute for the tables and columns
1.11 +78 -3 jakarta-turbine-torque/src/conf/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/conf/build.xml,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- build.xml 2001/10/29 04:07:26 1.10
+++ build.xml 2001/11/01 02:23:01 1.11
@@ -78,13 +78,89 @@
controlTemplate="${SQLControlTemplate}"
outputDirectory="${torque.home}/${outputDirectory}/sql"
templatePath="${templatePath}"
+ sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
outputFile="report.${project}.sql.generation"
- xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
+ targetDatabase="${database}">
+ <fileset dir="${torque.home}/${schemaDirectory}">
+ <include name="*-schema.xml"/>
+ </fileset>
+ </torque-sql>
+
+ </target>
+
+ <!-- ================================================================ -->
+ <!-- C R E A T E T A R G E T D A T A B A S E -->
+ <!-- ================================================================ -->
+ <!-- Create the target database by executing a generated script -->
+ <!-- that is capable of performing the task. -->
+ <!-- ================================================================ -->
+
+ <target
+ name="project-create-db"
+ unless="database.manual.creation"
+ description="--> generates the target database">
+
+ <taskdef
+ name="torque-create-db"
+ classname="org.apache.torque.task.TorqueCreateDatabase">
+ <classpath refid="classpath"/>
+ </taskdef>
+
+ <torque-create-db
+ controlTemplate="sql/db-init/Control.vm"
+ outputDirectory="${torque.home}/${outputDirectory}/sql"
+ templatePath="${templatePath}"
+ outputFile="create-db.sql"
+ targetPlatform="${platform}"
targetDatabase="${database}"
- />
+ databaseUser="${databaseUser}"
+ databasePassword="${databasePassword}"
+ databaseHost="${databaseHost}">
+ <fileset dir="${torque.home}/${schemaDirectory}">
+ <include name="*-schema.xml"/>
+ </fileset>
+ </torque-create-db>
+
+ <sql
+ driver="${databaseDriver}"
+ url="${createDatabaseUrl}"
+ userid="${databaseUser}"
+ password="${databasePassword}"
+ src="${torque.home}/${outputDirectory}/sql/create-db.sql"
+ autocommit="true"
+ onerror="continue">
+ <classpath refid="classpath"/>
+ </sql>
+
+ </target>
+
+ <!-- ================================================================ -->
+ <!-- I N S E R T S I N G L E S Q L F I L E S -->
+ <!-- ================================================================ -->
+
+ <target
+ name="project-insert-sql">
+ <taskdef
+ name="torque-insert-sql"
+ classname="org.apache.torque.task.TorqueSQLExec">
+ <classpath refid="classpath"/>
+ </taskdef>
+
+ <torque-insert-sql
+ driver="${databaseDriver}"
+ url="${databaseUrl}"
+ userid="${databaseUser}"
+ password="${databasePassword}"
+ autocommit="true"
+ onerror="continue"
+ sqldbmap="${basedir}/${outputDirectory}/sql/sqldb.map"
+ srcDir="${basedir}/${outputDirectory}/sql">
+ <classpath refid="classpath"/>
+ </torque-insert-sql>
</target>
+
<!-- ================================================================ -->
<!-- J D B C TO X M L -->
<!-- ================================================================ -->
@@ -254,7 +330,6 @@
outputFile="report.${project}.om.generation"
targetPackage="${targetPackage}.om"
xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
- targetDatabase="${database}"
/>
</target>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>