henning 2004/10/20 15:13:34
Modified: . Tag: TORQUE_3_1_BRANCH project-base.xml
src/generator/src/templates/sql/base/oracle Tag:
TORQUE_3_1_BRANCH drop.vm foreignkey.vm index.vm
primarykey.vm sequence.vm table.vm
src/generator/src/templates/sql/id-table Tag:
TORQUE_3_1_BRANCH idtable.oracle
src/generator/src/templates/sql/load/oracle Tag:
TORQUE_3_1_BRANCH row.vm
xdocs Tag: TORQUE_3_1_BRANCH changes.xml oracle-howto.xml
Log:
Apply Oracle Patch from thierry lach. Thanks a lot!
Revision Changes Path
No revision
No revision
1.9.2.8 +4 -0 db-torque/project-base.xml
Index: project-base.xml
===================================================================
RCS file: /home/cvs/db-torque/project-base.xml,v
retrieving revision 1.9.2.7
retrieving revision 1.9.2.8
diff -u -r1.9.2.7 -r1.9.2.8
--- project-base.xml 20 Oct 2004 14:13:58 -0000 1.9.2.7
+++ project-base.xml 20 Oct 2004 22:13:34 -0000 1.9.2.8
@@ -237,6 +237,10 @@
<email>[EMAIL PROTECTED]</email>
</contributor>
<contributor>
+ <name>Thierry Lach</name>
+ <email>[EMAIL PROTECTED]</email>
+ </contributor>
+ <contributor>
<name>Markus M. May</name>
<email>[EMAIL PROTECTED]</email>
</contributor>
No revision
No revision
1.1.2.1 +19 -2 db-torque/src/generator/src/templates/sql/base/oracle/drop.vm
Index: drop.vm
===================================================================
RCS file: /home/cvs/db-torque/src/generator/src/templates/sql/base/oracle/drop.vm,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- drop.vm 10 Feb 2003 13:18:47 -0000 1.1
+++ drop.vm 20 Oct 2004 22:13:34 -0000 1.1.2.1
@@ -1,4 +1,21 @@
-DROP TABLE $table.Name CASCADE CONSTRAINTS;
+DECLARE
+ TABLE_DOES_NOT_EXIST EXCEPTION;
+ PRAGMA EXCEPTION_INIT(TABLE_DOES_NOT_EXIST, -942);
+BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE $table.Name CASCADE CONSTRAINTS';
+EXCEPTION
+ WHEN TABLE_DOES_NOT_EXIST THEN NULL;
+END;
+/
#if ($table.IdMethod == "native")
-DROP SEQUENCE $table.SequenceName;
+
+DECLARE
+ TABLE_DOES_NOT_EXIST EXCEPTION;
+ PRAGMA EXCEPTION_INIT(TABLE_DOES_NOT_EXIST, -942);
+BEGIN
+ EXECUTE IMMEDIATE 'DROP SEQUENCE $table.SequenceName';
+EXCEPTION
+ WHEN TABLE_DOES_NOT_EXIST THEN NULL;
+END;
+/
#end
1.1.2.1 +1 -1
db-torque/src/generator/src/templates/sql/base/oracle/foreignkey.vm
Index: foreignkey.vm
===================================================================
RCS file:
/home/cvs/db-torque/src/generator/src/templates/sql/base/oracle/foreignkey.vm,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- foreignkey.vm 10 Feb 2003 13:18:47 -0000 1.1
+++ foreignkey.vm 20 Oct 2004 22:13:34 -0000 1.1.2.1
@@ -8,6 +8,6 @@
#if ($fk.hasOnDelete())
ON DELETE $fk.OnDelete
#end
-;
+/
#end
1.1.2.1 +2 -1 db-torque/src/generator/src/templates/sql/base/oracle/index.vm
Index: index.vm
===================================================================
RCS file: /home/cvs/db-torque/src/generator/src/templates/sql/base/oracle/index.vm,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- index.vm 10 Feb 2003 13:18:47 -0000 1.1
+++ index.vm 20 Oct 2004 22:13:34 -0000 1.1.2.1
@@ -1,3 +1,4 @@
#foreach ($index in $table.Indices)
-CREATE#if ($index.Unique)UNIQUE#end INDEX $index.Name ON $table.Name
($index.ColumnList);
+CREATE#if ($index.Unique)UNIQUE#end INDEX $index.Name ON $table.Name
($index.ColumnList)
+/
#end
1.1.2.1 +2 -1
db-torque/src/generator/src/templates/sql/base/oracle/primarykey.vm
Index: primarykey.vm
===================================================================
RCS file:
/home/cvs/db-torque/src/generator/src/templates/sql/base/oracle/primarykey.vm,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- primarykey.vm 10 Feb 2003 13:18:47 -0000 1.1
+++ primarykey.vm 20 Oct 2004 22:13:34 -0000 1.1.2.1
@@ -3,5 +3,6 @@
#if ($table.hasPrimaryKey())
ALTER TABLE $table.Name
ADD CONSTRAINT ${table.Name.substring(0,$length)}_PK
-PRIMARY KEY ($table.printPrimaryKey());
+PRIMARY KEY ($table.printPrimaryKey())
+/
#end
1.1.2.1 +2 -1
db-torque/src/generator/src/templates/sql/base/oracle/sequence.vm
Index: sequence.vm
===================================================================
RCS file:
/home/cvs/db-torque/src/generator/src/templates/sql/base/oracle/sequence.vm,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- sequence.vm 10 Feb 2003 13:18:47 -0000 1.1
+++ sequence.vm 20 Oct 2004 22:13:34 -0000 1.1.2.1
@@ -1,3 +1,4 @@
#if ($table.IdMethod == "native")
-CREATE SEQUENCE $table.SequenceName INCREMENT BY 1 START WITH 1 NOMAXVALUE NOCYCLE
NOCACHE ORDER;
+CREATE SEQUENCE $table.SequenceName INCREMENT BY 1 START WITH 1 NOMAXVALUE NOCYCLE
NOCACHE ORDER
+/
#end
1.1.2.1 +2 -1 db-torque/src/generator/src/templates/sql/base/oracle/table.vm
Index: table.vm
===================================================================
RCS file: /home/cvs/db-torque/src/generator/src/templates/sql/base/oracle/table.vm,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- table.vm 10 Feb 2003 13:18:47 -0000 1.1
+++ table.vm 20 Oct 2004 22:13:34 -0000 1.1.2.1
@@ -10,7 +10,8 @@
#if($strings.allEmpty([$unique]))$strings.chop($cols,2)#else$cols#end
#if($unique.length()>0)$strings.chop($unique,2)#end
-);
+)
+/
#set ( $pk = $generator.parse("$basepath/primarykey.vm", "", "table", $tbl) )
#if($pk.length()>0)$pk#end
No revision
No revision
1.2.2.1 +2 -1
db-torque/src/generator/src/templates/sql/id-table/idtable.oracle
Index: idtable.oracle
===================================================================
RCS file:
/home/cvs/db-torque/src/generator/src/templates/sql/id-table/idtable.oracle,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- idtable.oracle 16 Jul 2003 09:47:33 -0000 1.2
+++ idtable.oracle 20 Oct 2004 22:13:34 -0000 1.2.2.1
@@ -1,4 +1,5 @@
#foreach ($tbl in $tables)
-insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES
($initialID, '$tbl.Name', $initialIDValue, $initialIDStep);
+insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES
($initialID, '$tbl.Name', $initialIDValue, $initialIDStep)
+/
#set ( $initialID = $initialID + 1 )
#end
No revision
No revision
1.1.2.1 +2 -1 db-torque/src/generator/src/templates/sql/load/oracle/row.vm
Index: row.vm
===================================================================
RCS file: /home/cvs/db-torque/src/generator/src/templates/sql/load/oracle/row.vm,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- row.vm 10 Feb 2003 13:18:50 -0000 1.1
+++ row.vm 20 Oct 2004 22:13:34 -0000 1.1.2.1
@@ -1,3 +1,4 @@
INSERT INTO $row.Table.Name (##
#set ($comma="")#foreach($col in
$row.ColumnValues)$comma${col.Column.Name}#set($comma=",")#end)
- VALUES (#set ($comma="")#foreach($col in
$row.ColumnValues)$comma${generator.parse("sql/load/oracle/val.vm", "", "column",
$col)}#set ($comma=",")#end);
+ VALUES (#set ($comma="")#foreach($col in
$row.ColumnValues)$comma${generator.parse("sql/load/oracle/val.vm", "", "column",
$col)}#set ($comma=",")#end)
+/
No revision
No revision
1.140.2.12 +6 -0 db-torque/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/db-torque/xdocs/changes.xml,v
retrieving revision 1.140.2.11
retrieving revision 1.140.2.12
diff -u -r1.140.2.11 -r1.140.2.12
--- changes.xml 20 Oct 2004 21:54:30 -0000 1.140.2.11
+++ changes.xml 20 Oct 2004 22:13:34 -0000 1.140.2.12
@@ -50,6 +50,12 @@
For everyone else, this change might actually make
<code>doDelete(object)</code> work if your
object contains a binary column.
</action>
+ <action type="update" dev="henning" issue="TRQS222">
+ Add Oracle Update patch from Thierry Lach. I don't use Oracle so
+ I rely on Thierry that he knows what he is doing. Ant users:
+ please not the changes mentioned in the <a
+ href="oracle-howto.html">Oracle Howto</a>.
+ </action>
</release>
<release version="3.1.1-RC3" date="2004-10-16">
<action type="update" dev="henning">
1.2.2.3 +23 -0 db-torque/xdocs/oracle-howto.xml
Index: oracle-howto.xml
===================================================================
RCS file: /home/cvs/db-torque/xdocs/oracle-howto.xml,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -u -r1.2.2.2 -r1.2.2.3
--- oracle-howto.xml 19 Aug 2004 02:25:06 -0000 1.2.2.2
+++ oracle-howto.xml 20 Oct 2004 22:13:34 -0000 1.2.2.3
@@ -24,6 +24,29 @@
Patched for Oracle LOBs - For use with Torque 3.1</a>
</p>
+<p>
+Thierry Lach changed the generated SQL code for Oracle to no longer
+fail when the tables that should be dropped do not exist. He added the
+following note:<br/>
+
+As the Oracle database does not have a "drop table if
+exists" clause, the normally created schema creation sql script
+usually fails on the first run as the tables do not exist and the drop
+table command errors off.<br/>
+
+These changes uses Oracle's procedural language PL/SQL to trap this
+error.<br/>
+
+The drawback to this approach is that PL/SQL uses the semicolon (;) as
+its own statement delimiter, so if the scripts are run using Ant, the
+sql task must include an additional argument:
+
+<source><![CDATA[
+ delimiter="/"
+]]>
+</source>
+</p>
+
</section>
<section name="Oracle Howto">
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]