db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From olegn...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/util/batch BatchConnection.java
Date Sun, 18 Jan 2004 16:47:01 GMT
olegnitz    2004/01/18 08:47:01

  Modified:    src/java/org/apache/ojb/broker/util/batch
                        BatchConnection.java
  Log:
  Additional restriction on the reordering of statements
  
  Revision  Changes    Path
  1.15      +11 -2     db-ojb/src/java/org/apache/ojb/broker/util/batch/BatchConnection.java
  
  Index: BatchConnection.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/batch/BatchConnection.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- BatchConnection.java	13 Jan 2004 21:51:48 -0000	1.14
  +++ BatchConnection.java	18 Jan 2004 16:47:01 -0000	1.15
  @@ -107,6 +107,7 @@
       private HashMap _fkInfo;
       private HashSet _deleted;
       private HashSet _dontInsert;
  +    private HashSet _touched = new HashSet();
       private int count = 0;
   	private JdbcConnectionDescriptor m_jcd;
   
  @@ -193,7 +194,7 @@
               Class extClass = (Class) it.next();
               ClassDescriptor extDesc = repos.getDescriptorFor(extClass);
               tableName = extDesc.getFullTableName();
  -            if (tableName != null) 
  +            if (tableName != null)
               {
                   tableNamesSet.add(tableName);
               }
  @@ -225,6 +226,12 @@
           String tableName = rest.substring(0, rest.indexOf(' '));
           HashSet fkTables = (HashSet) _fkInfo.get(tableName);
   
  +        // we should not change order of INSERT/DELETE/UPDATE
  +        // statements for the same table
  +        if (_touched.contains(tableName))
  +        {
  +            executeBatch();
  +        }
           if (sqlCmd.equals("INSERT "))
           {
               if (_dontInsert != null && _dontInsert.contains(tableName))
  @@ -262,6 +269,7 @@
   
           _order.add(sql);
   
  +        _touched.add(tableName);
           if (sqlCmd.equals("INSERT "))
           {
               if (fkTables != null)
  @@ -392,6 +400,7 @@
               {
                   _deleted.clear();
               }
  +            _touched.clear();
               count = 0;
           }
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message