You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Age Mooy <am...@home.nl> on 2002/03/01 18:40:40 UTC
{PATCH] TorqueSQLExec.java order of file execution (fixes idtable-init problem)
Hi,
This is a patch for the problem discussed in my mail on the turbine-user list posted earlier today (RE: TDK
snapshot incl. decoupled torque (buglist)). It makes the TorqueSQLExec task execute sql files in alphabetical
order (though still with the *-schema.sql files before all other files). This is the order in which they were
generated with the TorqueSQL task.
This stops different idtable-init.sql files from deleting each other's entries.
Regards,
Age
Index: TorqueSQLExec.java
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueSQLExec.java,v
retrieving revision 1.3
diff -u -r1.3 TorqueSQLExec.java
--- TorqueSQLExec.java 16 Feb 2002 16:58:38 -0000 1.3
+++ TorqueSQLExec.java 1 Mar 2002 17:30:33 -0000
@@ -72,6 +72,8 @@
import java.util.StringTokenizer;
import java.util.Vector;
import java.util.Properties;
+import java.util.TreeSet;
+import java.util.Iterator;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.Driver;
@@ -463,10 +465,11 @@
}
Hashtable h = new Hashtable();
+ TreeSet keys = new TreeSet(p.keySet());
- for (Enumeration e = p.propertyNames(); e.hasMoreElements();)
+ for (Iterator e = keys.iterator(); e.hasNext();)
{
- String sqlfile = (String) e.nextElement();
+ String sqlfile = (String) e.next();
String database = p.getProperty(sqlfile);
ArrayList x = (ArrayList) h.get(database);
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: {PATCH] TorqueSQLExec.java order of file execution (fixes idtable-init problem)
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Committed to CVS HEAD.
"Age Mooy" <am...@home.nl> writes:
> This is a patch for the problem discussed in my mail on the
> turbine-user list posted earlier today (RE: TDK snapshot
> incl. decoupled torque (buglist)). It makes the TorqueSQLExec task
> execute sql files in alphabetical order (though still with the
> *-schema.sql files before all other files). This is the order in
> which they were generated with the TorqueSQL task.
>
> This stops different idtable-init.sql files from deleting each
> other's entries.
>
> Index: TorqueSQLExec.java
> ===================================================================
> RCS file: /home/cvspublic/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueSQLExec.java,v
> retrieving revision 1.3
> diff -u -r1.3 TorqueSQLExec.java
> --- TorqueSQLExec.java 16 Feb 2002 16:58:38 -0000 1.3
> +++ TorqueSQLExec.java 1 Mar 2002 17:30:33 -0000
> @@ -72,6 +72,8 @@
> import java.util.StringTokenizer;
> import java.util.Vector;
> import java.util.Properties;
> +import java.util.TreeSet;
> +import java.util.Iterator;
> import java.sql.Connection;
> import java.sql.DatabaseMetaData;
> import java.sql.Driver;
> @@ -463,10 +465,11 @@
> }
>
> Hashtable h = new Hashtable();
> + TreeSet keys = new TreeSet(p.keySet());
>
> - for (Enumeration e = p.propertyNames(); e.hasMoreElements();)
> + for (Iterator e = keys.iterator(); e.hasNext();)
> {
> - String sqlfile = (String) e.nextElement();
> + String sqlfile = (String) e.next();
> String database = p.getProperty(sqlfile);
>
> ArrayList x = (ArrayList) h.get(database);
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>