Index: topia/src/java/org/codelutin/topia/persistence/PersistenceStorageJDBC.java diff -u topia/src/java/org/codelutin/topia/persistence/PersistenceStorageJDBC.java:1.13 topia/src/java/org/codelutin/topia/persistence/PersistenceStorageJDBC.java:1.14 --- topia/src/java/org/codelutin/topia/persistence/PersistenceStorageJDBC.java:1.13 Fri Aug 5 17:04:40 2005 +++ topia/src/java/org/codelutin/topia/persistence/PersistenceStorageJDBC.java Mon Aug 8 12:18:30 2005 @@ -23,9 +23,9 @@ * Created: 20 juillet 2005 15:25:06 CEST * * @author Benjamin POUSSIN - * @version $Revision: 1.13 $ + * @version $Revision: 1.14 $ * - * Last update: $Date: 2005/08/05 17:04:40 $ + * Last update: $Date: 2005/08/08 12:18:30 $ * by : $Author: thimel $ */ @@ -43,7 +43,6 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.sql.Types; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -144,7 +143,7 @@ SQL_DEFAULT.put(SQL_TABLE_EXISTS, "SELECT count(*) FROM management where id='' AND longdate=0"); SQL_DEFAULT.put(SQL_CREATE_TABLE_MANAGEMENT, - "CREATE TABLE management (id text, longdate bigin1t, class text, isNew boolean, isDeleted boolean, schemaVersion bigint, PRIMARY KEY (id, longdate))"); + "CREATE TABLE management (id text, longdate bigint, class text, isNew boolean, isDeleted boolean, schemaVersion bigint, PRIMARY KEY (id, longdate))"); // sans doute faire une suppression en cascade lors que la cle(id, date), n'existe plus dans management // si supporté par toutes les bases cibles SQL_DEFAULT.put(SQL_CREATE_TABLE_DATA, @@ -193,12 +192,12 @@ SQL_MYSQL.setProperty(SQL_CREATE_TABLE_MANAGEMENT, - "CREATE TABLE management (id varchar(100), longdate bigint, class text, isNew bool, isDeleted bool, schemaVersion bigint, PRIMARY KEY (id, longdate));"); + "CREATE TABLE management (id varchar(100), longdate bigint, class text, isNew bool, isDeleted bool, schemaVersion bigint, PRIMARY KEY (id, longdate))"); SQL_MYSQL.put(SQL_CREATE_TABLE_DATA, - "CREATE TABLE data (id varchar(100), longdate bigint, field varchar(100), value longblob, type text, PRIMARY KEY (id, longdate, field), FOREIGN KEY (id, longdate) REFERENCES management (id, longdate) ON DELETE CASCADE ON UPDATE CASCADE);"); + "CREATE TABLE data (id varchar(100), longdate bigint, field varchar(100), value longblob, type text, PRIMARY KEY (id, longdate, field), FOREIGN KEY (id, longdate) REFERENCES management (id, longdate) ON DELETE CASCADE ON UPDATE CASCADE)"); SQL_MCKOI.setProperty(SQL_CREATE_TABLE_DATA, - "CREATE TABLE data (id text, longdate bigint, field text, value longvarbinary, type text, PRIMARY KEY (id, longdate, field), FOREIGN KEY (id, longdate) REFERENCES management (id, longdate) ON DELETE CASCADE ON UPDATE CASCADE);"); + "CREATE TABLE data (id text, longdate bigint, field text, value longvarbinary, type text, PRIMARY KEY (id, longdate, field), FOREIGN KEY (id, longdate) REFERENCES management (id, longdate) ON DELETE CASCADE ON UPDATE CASCADE)"); SQL_ORACLE.setProperty(SQL_CREATE_TABLE_MANAGEMENT, "CREATE TABLE management (id varchar(100), longdate number(21), class varchar(255), isNew number(1), isDeleted number(1), schemaVersion number(21), constraint management_pk PRIMARY KEY (id, longdate))"); @@ -442,10 +441,12 @@ // transaction on recherche le plus recent des objet // commit pour cette transaction sta.close(); - sta = conn.prepareStatement(SQL.getProperty(SQL_LOAD_HISTORY)); + String query = SQL.getProperty(SQL_LOAD_HISTORY); + query = Util.setAllMultipleIds(query, context.getTransaction()); + sta = conn.prepareStatement(query); sta.setString(1, tpo.getManagement().getId()); sta.setLong(2, -context.getTransaction().getId()); - sta.setObject(3, context.getTransaction().getIds(), Types.ARRAY); +// sta.setObject(3, context.getTransaction().getIds(), Types.ARRAY); management = sta.executeQuery(); if(!management.next()){ // on a pas trouvé d'objet sattisfaisant la demande @@ -873,7 +874,6 @@ * leve l'exception UnsupportedOperationException */ public List find(TopiaContext context, TopiaQuery query) throws TopiaPersistenceException { - long time = System.currentTimeMillis(); //TODO Pour les tests de perfs, a supprimer TopiaJDBCQueryHelper queryHelper = new TopiaJDBCQueryHelper(); try { queryHelper.setQuery(query.getQueryString()); @@ -912,8 +912,6 @@ } catch (QueryHelperException eee) { throw new TopiaPersistenceException("Execution de la requete impossible, requete source mal formée", eee); } - tTime += System.currentTimeMillis() - time; //TODO Pour les tests de perfs, a supprimer - nb++; //TODO Pour les tests de perfs, a supprimer return results; } @@ -979,9 +977,6 @@ } return result; } - - public static int nb = 0; //TODO Pour les tests de perfs, a supprimer - public static long tTime = 0; //TODO Pour les tests de perfs, a supprimer } // PersistenceStorageJDBC Index: topia/src/java/org/codelutin/topia/persistence/TopiaJDBCQueryHelper.java diff -u topia/src/java/org/codelutin/topia/persistence/TopiaJDBCQueryHelper.java:1.5 topia/src/java/org/codelutin/topia/persistence/TopiaJDBCQueryHelper.java:1.6 --- topia/src/java/org/codelutin/topia/persistence/TopiaJDBCQueryHelper.java:1.5 Fri Aug 5 17:04:40 2005 +++ topia/src/java/org/codelutin/topia/persistence/TopiaJDBCQueryHelper.java Mon Aug 8 12:18:30 2005 @@ -23,9 +23,9 @@ * * @author Arnaud Thimel * Copyright Code Lutin - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ * - * Mise a jour: $Date: 2005/08/05 17:04:40 $ + * Mise a jour: $Date: 2005/08/08 12:18:30 $ * par : $Author: thimel $ */ package org.codelutin.topia.persistence; @@ -102,7 +102,7 @@ for (int i = 0; i < queryBuilder.getANDs().size(); i++) { request += ")"; } - request += ";"; +// request += ";"; // utiliser la transaction pour ajouter les valeurs des 5 "?". Il faut : // -transaction.getId(), transaction.getId(), -transaction.getId(), transaction.getId(), -transaction.getId()