diff options
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping')
20 files changed, 172 insertions, 160 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractFeatureMapTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractFeatureMapTableMapping.java index 1249a6870d..4da987ebc3 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractFeatureMapTableMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractFeatureMapTableMapping.java @@ -36,6 +36,7 @@ import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBType; import org.eclipse.net4j.db.DBUtil; import org.eclipse.net4j.db.IDBDatabase; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.db.ddl.IDBField; import org.eclipse.net4j.db.ddl.IDBIndex; @@ -319,7 +320,7 @@ public abstract class AbstractFeatureMapTableMapping extends AbstractBasicListTa String sql = sqlSelectChunksPrefix + sqlOrderByIndex; IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sql, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sql, ReuseProbability.HIGH); ResultSet resultSet = null; try @@ -395,7 +396,7 @@ public abstract class AbstractFeatureMapTableMapping extends AbstractBasicListTa String sql = builder.toString(); IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = chunkReader.getAccessor().getDBTransaction().prepareStatement(sql, ReuseProbability.LOW); + IDBPreparedStatement stmt = chunkReader.getAccessor().getDBConnection().prepareStatement(sql, ReuseProbability.LOW); ResultSet resultSet = null; try @@ -488,7 +489,7 @@ public abstract class AbstractFeatureMapTableMapping extends AbstractBasicListTa String columnName = getColumnName(tag); IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlInsert, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsert, ReuseProbability.HIGH); try { diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java index fd2e52a6de..df97a1d1bb 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java @@ -41,6 +41,7 @@ import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBType; import org.eclipse.net4j.db.DBUtil; import org.eclipse.net4j.db.IDBDatabase; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.db.ddl.IDBField; import org.eclipse.net4j.db.ddl.IDBIndex; @@ -604,7 +605,7 @@ public abstract class AbstractHorizontalClassMapping implements IClassMapping, I } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(builder.toString(), ReuseProbability.LOW); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(builder.toString(), ReuseProbability.LOW); ResultSet resultSet = null; try @@ -671,7 +672,7 @@ public abstract class AbstractHorizontalClassMapping implements IClassMapping, I } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(builder.toString(), ReuseProbability.LOW); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(builder.toString(), ReuseProbability.LOW); ResultSet resultSet = null; Set<CDOID> result = new HashSet<CDOID>(); @@ -857,7 +858,7 @@ public abstract class AbstractHorizontalClassMapping implements IClassMapping, I } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sql, ReuseProbability.MEDIUM); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sql, ReuseProbability.MEDIUM); ResultSet resultSet = null; try diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalMappingStrategy.java index 8cf3ada1f6..e353179a6f 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalMappingStrategy.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalMappingStrategy.java @@ -36,6 +36,7 @@ import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBUtil; import org.eclipse.net4j.db.DBUtil.DeserializeRowHandler; import org.eclipse.net4j.db.IDBAdapter; +import org.eclipse.net4j.db.IDBConnection; import org.eclipse.net4j.db.ddl.IDBTable; import org.eclipse.net4j.util.lifecycle.LifecycleUtil; import org.eclipse.net4j.util.om.monitor.OMMonitor; @@ -182,7 +183,7 @@ public abstract class AbstractHorizontalMappingStrategy extends AbstractMappingS builder.append(toCommitTime); String attrSuffix = builder.toString(); - Connection connection = accessor.getConnection(); + IDBConnection connection = accessor.getDBConnection(); Collection<IClassMapping> classMappings = getClassMappings(true).values(); out.writeInt(classMappings.size()); @@ -204,8 +205,8 @@ public abstract class AbstractHorizontalMappingStrategy extends AbstractMappingS objectTypeMapper.rawExport(connection, out, fromCommitTime, toCommitTime); } - protected void rawExportList(CDODataOutput out, Connection connection, IListMapping listMapping, IDBTable attrTable, - String attrSuffix) throws IOException + protected void rawExportList(CDODataOutput out, IDBConnection connection, IListMapping listMapping, + IDBTable attrTable, String attrSuffix) throws IOException { for (IDBTable table : listMapping.getDBTables()) { @@ -239,7 +240,7 @@ public abstract class AbstractHorizontalMappingStrategy extends AbstractMappingS try { - Connection connection = accessor.getConnection(); + IDBConnection connection = accessor.getDBConnection(); for (int i = 0; i < size; i++) { EClass eClass = (EClass)in.readCDOClassifierRefAndResolve(); @@ -283,18 +284,18 @@ public abstract class AbstractHorizontalMappingStrategy extends AbstractMappingS } } - protected void rawImportUnreviseNewRevisions(Connection connection, IDBTable table, long fromCommitTime, + protected void rawImportUnreviseNewRevisions(IDBConnection connection, IDBTable table, long fromCommitTime, long toCommitTime, OMMonitor monitor) { throw new UnsupportedOperationException("Must be overridden"); } - protected void rawImportReviseOldRevisions(Connection connection, IDBTable table, OMMonitor monitor) + protected void rawImportReviseOldRevisions(IDBConnection connection, IDBTable table, OMMonitor monitor) { throw new UnsupportedOperationException("Must be overridden"); } - protected void rawImportList(CDODataInput in, Connection connection, IListMapping listMapping, OMMonitor monitor) + protected void rawImportList(CDODataInput in, IDBConnection connection, IListMapping listMapping, OMMonitor monitor) throws IOException { Collection<IDBTable> tables = listMapping.getDBTables(); diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java index 5df8bcaf87..de73796897 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java @@ -31,6 +31,7 @@ import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBType; import org.eclipse.net4j.db.DBUtil; import org.eclipse.net4j.db.IDBDatabase; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.db.ddl.IDBField; import org.eclipse.net4j.db.ddl.IDBIndex; @@ -229,7 +230,7 @@ public abstract class AbstractListTableMapping extends AbstractBasicListTableMap } String sql = sqlSelectChunksPrefix + sqlOrderByIndex; - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sql, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sql, ReuseProbability.HIGH); ResultSet resultSet = null; try @@ -295,7 +296,7 @@ public abstract class AbstractListTableMapping extends AbstractBasicListTableMap builder.append(sqlOrderByIndex); String sql = builder.toString(); - PreparedStatement stmt = chunkReader.getAccessor().getDBTransaction().prepareStatement(sql, ReuseProbability.LOW); + IDBPreparedStatement stmt = chunkReader.getAccessor().getDBConnection().prepareStatement(sql, ReuseProbability.LOW); ResultSet resultSet = null; try @@ -379,7 +380,7 @@ public abstract class AbstractListTableMapping extends AbstractBasicListTableMap getFeature().getName(), idx, revision.getID(), revision.getVersion(), value); } - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlInsertEntry, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsertEntry, ReuseProbability.HIGH); try { @@ -431,7 +432,7 @@ public abstract class AbstractListTableMapping extends AbstractBasicListTableMap } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sql, ReuseProbability.MEDIUM); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sql, ReuseProbability.MEDIUM); ResultSet resultSet = null; try diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMapping.java index 2e5269cd53..a969bb5a99 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMapping.java @@ -22,6 +22,7 @@ import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy; import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBType; import org.eclipse.net4j.db.DBUtil; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.emf.ecore.EClass; @@ -84,7 +85,7 @@ public class AuditFeatureMapTableMapping extends AbstractFeatureMapTableMapping public void rawDeleted(IDBStoreAccessor accessor, CDOID id, CDOBranch branch, int version) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlClear, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlClear, ReuseProbability.HIGH); try { diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMappingWithRanges.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMappingWithRanges.java index 21ffa9ca7b..d1918b7e32 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMappingWithRanges.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditFeatureMapTableMappingWithRanges.java @@ -50,6 +50,7 @@ import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBType; import org.eclipse.net4j.db.DBUtil; import org.eclipse.net4j.db.IDBDatabase; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.db.ddl.IDBIndex.Type; import org.eclipse.net4j.db.ddl.IDBTable; @@ -61,7 +62,6 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.util.FeatureMap; -import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; @@ -405,7 +405,7 @@ public class AuditFeatureMapTableMappingWithRanges extends AbstractBasicListTabl String sql = sqlSelectChunksPrefix + sqlOrderByIndex; IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sql, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sql, ReuseProbability.HIGH); ResultSet resultSet = null; try @@ -483,7 +483,7 @@ public class AuditFeatureMapTableMappingWithRanges extends AbstractBasicListTabl String sql = builder.toString(); IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = chunkReader.getAccessor().getDBTransaction().prepareStatement(sql, ReuseProbability.LOW); + IDBPreparedStatement stmt = chunkReader.getAccessor().getDBConnection().prepareStatement(sql, ReuseProbability.LOW); ResultSet resultSet = null; try @@ -647,9 +647,9 @@ public class AuditFeatureMapTableMappingWithRanges extends AbstractBasicListTabl public void clearList(IDBStoreAccessor accessor, CDOID id, int oldVersion, int newVersion) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmtDeleteTemp = accessor.getDBTransaction().prepareStatement(sqlDeleteList, + IDBPreparedStatement stmtDeleteTemp = accessor.getDBConnection().prepareStatement(sqlDeleteList, ReuseProbability.HIGH); - PreparedStatement stmtClear = accessor.getDBTransaction().prepareStatement(sqlClearList, ReuseProbability.HIGH); + IDBPreparedStatement stmtClear = accessor.getDBConnection().prepareStatement(sqlClearList, ReuseProbability.HIGH); try { @@ -891,7 +891,7 @@ public class AuditFeatureMapTableMappingWithRanges extends AbstractBasicListTabl int endIndex) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); try { @@ -959,7 +959,7 @@ public class AuditFeatureMapTableMappingWithRanges extends AbstractBasicListTabl int endIndex) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); try { @@ -1039,7 +1039,7 @@ public class AuditFeatureMapTableMappingWithRanges extends AbstractBasicListTabl String columnName = getColumnName(tag); IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlInsert, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsert, ReuseProbability.HIGH); try { @@ -1087,7 +1087,7 @@ public class AuditFeatureMapTableMappingWithRanges extends AbstractBasicListTabl } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlDeleteEntry, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlDeleteEntry, ReuseProbability.HIGH); try { @@ -1118,7 +1118,7 @@ public class AuditFeatureMapTableMappingWithRanges extends AbstractBasicListTabl { // no temporary entry found, so mark the entry as removed DBUtil.close(stmt); - stmt = accessor.getDBTransaction().prepareStatement(sqlRemoveEntry, ReuseProbability.HIGH); + stmt = accessor.getDBConnection().prepareStatement(sqlRemoveEntry, ReuseProbability.HIGH); column = 1; stmt.setInt(column++, newVersion); @@ -1156,7 +1156,7 @@ public class AuditFeatureMapTableMappingWithRanges extends AbstractBasicListTabl private FeatureMap.Entry getValue(IDBStoreAccessor accessor, CDOID id, int index) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlGetValue, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlGetValue, ReuseProbability.HIGH); try { diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditListTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditListTableMapping.java index 121664a824..21aacc6531 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditListTableMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditListTableMapping.java @@ -21,6 +21,7 @@ import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy; import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBType; import org.eclipse.net4j.db.DBUtil; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.db.ddl.IDBTable; @@ -86,7 +87,7 @@ public class AuditListTableMapping extends AbstractListTableMapping public void rawDeleted(IDBStoreAccessor accessor, CDOID id, CDOBranch branch, int version) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlClear, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlClear, ReuseProbability.HIGH); try { diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditListTableMappingWithRanges.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditListTableMappingWithRanges.java index b222970db8..7e3d60b445 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditListTableMappingWithRanges.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AuditListTableMappingWithRanges.java @@ -46,6 +46,7 @@ import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBType; import org.eclipse.net4j.db.DBUtil; import org.eclipse.net4j.db.IDBDatabase; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.db.ddl.IDBIndex.Type; import org.eclipse.net4j.db.ddl.IDBTable; @@ -57,7 +58,6 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EStructuralFeature; -import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Collection; @@ -304,7 +304,7 @@ public class AuditListTableMappingWithRanges extends AbstractBasicListTableMappi String sql = sqlSelectChunksPrefix + sqlOrderByIndex; IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sql, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sql, ReuseProbability.HIGH); ResultSet resultSet = null; try @@ -370,7 +370,7 @@ public class AuditListTableMappingWithRanges extends AbstractBasicListTableMappi String sql = builder.toString(); IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = chunkReader.getAccessor().getDBTransaction().prepareStatement(sql, ReuseProbability.LOW); + IDBPreparedStatement stmt = chunkReader.getAccessor().getDBConnection().prepareStatement(sql, ReuseProbability.LOW); ResultSet resultSet = null; try @@ -479,9 +479,9 @@ public class AuditListTableMappingWithRanges extends AbstractBasicListTableMappi public void clearList(IDBStoreAccessor accessor, CDOID id, int oldVersion, int newVersion) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmtDeleteTemp = accessor.getDBTransaction().prepareStatement(sqlDeleteList, + IDBPreparedStatement stmtDeleteTemp = accessor.getDBConnection().prepareStatement(sqlDeleteList, ReuseProbability.HIGH); - PreparedStatement stmtClear = accessor.getDBTransaction().prepareStatement(sqlClearList, ReuseProbability.HIGH); + IDBPreparedStatement stmtClear = accessor.getDBConnection().prepareStatement(sqlClearList, ReuseProbability.HIGH); try { @@ -761,7 +761,7 @@ public class AuditListTableMappingWithRanges extends AbstractBasicListTableMappi int endIndex) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); try { @@ -829,7 +829,7 @@ public class AuditListTableMappingWithRanges extends AbstractBasicListTableMappi int endIndex) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); try { @@ -903,7 +903,7 @@ public class AuditListTableMappingWithRanges extends AbstractBasicListTableMappi } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlInsertEntry, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsertEntry, ReuseProbability.HIGH); try { @@ -938,7 +938,7 @@ public class AuditListTableMappingWithRanges extends AbstractBasicListTableMappi } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlDeleteEntry, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlDeleteEntry, ReuseProbability.HIGH); try { @@ -969,7 +969,7 @@ public class AuditListTableMappingWithRanges extends AbstractBasicListTableMappi { // no temporary entry found, so mark the entry as removed DBUtil.close(stmt); - stmt = accessor.getDBTransaction().prepareStatement(sqlRemoveEntry, ReuseProbability.HIGH); + stmt = accessor.getDBConnection().prepareStatement(sqlRemoveEntry, ReuseProbability.HIGH); column = 1; stmt.setInt(column++, newVersion); @@ -1008,7 +1008,7 @@ public class AuditListTableMappingWithRanges extends AbstractBasicListTableMappi private Object getValue(IDBStoreAccessor accessor, CDOID id, int index) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlGetValue, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlGetValue, ReuseProbability.HIGH); Object result = null; try @@ -1075,7 +1075,7 @@ public class AuditListTableMappingWithRanges extends AbstractBasicListTableMappi } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sql, ReuseProbability.MEDIUM); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sql, ReuseProbability.MEDIUM); ResultSet resultSet = null; try diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMapping.java index a36531dd31..6209e44e09 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMapping.java @@ -22,6 +22,7 @@ import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy; import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBType; import org.eclipse.net4j.db.DBUtil; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.emf.ecore.EClass; @@ -87,7 +88,7 @@ public class BranchingFeatureMapTableMapping extends AbstractFeatureMapTableMapp @Override public void rawDeleted(IDBStoreAccessor accessor, CDOID id, CDOBranch branch, int version) { - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlClear, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlClear, ReuseProbability.HIGH); try { diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMappingWithRanges.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMappingWithRanges.java index f4d6bee411..3d2aa629c4 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMappingWithRanges.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingFeatureMapTableMappingWithRanges.java @@ -48,6 +48,7 @@ import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBType; import org.eclipse.net4j.db.DBUtil; import org.eclipse.net4j.db.IDBDatabase; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.db.ddl.IDBIndex.Type; import org.eclipse.net4j.db.ddl.IDBTable; @@ -59,7 +60,6 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.util.FeatureMap; -import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; @@ -418,7 +418,7 @@ public class BranchingFeatureMapTableMappingWithRanges extends AbstractBasicList String sql = sqlSelectChunksPrefix + sqlOrderByIndex; IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sql, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sql, ReuseProbability.HIGH); ResultSet resultSet = null; IStoreChunkReader baseReader = null; @@ -536,7 +536,7 @@ public class BranchingFeatureMapTableMappingWithRanges extends AbstractBasicList String sql = builder.toString(); IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = chunkReader.getAccessor().getDBTransaction().prepareStatement(sql, ReuseProbability.LOW); + IDBPreparedStatement stmt = chunkReader.getAccessor().getDBConnection().prepareStatement(sql, ReuseProbability.LOW); ResultSet resultSet = null; IStoreChunkReader baseReader = null; @@ -802,7 +802,7 @@ public class BranchingFeatureMapTableMappingWithRanges extends AbstractBasicList } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlClearList, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlClearList, ReuseProbability.HIGH); try { @@ -1052,7 +1052,7 @@ public class BranchingFeatureMapTableMappingWithRanges extends AbstractBasicList int startIndex, int endIndex) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); try { @@ -1135,7 +1135,7 @@ public class BranchingFeatureMapTableMappingWithRanges extends AbstractBasicList int startIndex, int endIndex) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); try { @@ -1224,7 +1224,7 @@ public class BranchingFeatureMapTableMappingWithRanges extends AbstractBasicList String columnName = getColumnName(tag); IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlInsert, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsert, ReuseProbability.HIGH); try { @@ -1282,7 +1282,7 @@ public class BranchingFeatureMapTableMappingWithRanges extends AbstractBasicList String columnName = getColumnName(tag); IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlInsert, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsert, ReuseProbability.HIGH); try { @@ -1332,7 +1332,7 @@ public class BranchingFeatureMapTableMappingWithRanges extends AbstractBasicList } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlDeleteEntry, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlDeleteEntry, ReuseProbability.HIGH); try { @@ -1364,7 +1364,7 @@ public class BranchingFeatureMapTableMappingWithRanges extends AbstractBasicList { // no temporary entry found, so mark the entry as removed DBUtil.close(stmt); - stmt = accessor.getDBTransaction().prepareStatement(sqlRemoveEntry, ReuseProbability.HIGH); + stmt = accessor.getDBConnection().prepareStatement(sqlRemoveEntry, ReuseProbability.HIGH); column = 1; stmt.setInt(column++, newVersion); @@ -1412,7 +1412,7 @@ public class BranchingFeatureMapTableMappingWithRanges extends AbstractBasicList private FeatureMap.Entry getValue(IDBStoreAccessor accessor, CDOID id, int branchId, int index, boolean getFromBase) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlGetValue, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlGetValue, ReuseProbability.HIGH); FeatureMap.Entry result = null; try diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingListTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingListTableMapping.java index c51a1719db..79ed6f8572 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingListTableMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingListTableMapping.java @@ -22,6 +22,7 @@ import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy; import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBType; import org.eclipse.net4j.db.DBUtil; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.db.ddl.IDBTable; @@ -92,7 +93,7 @@ public class BranchingListTableMapping extends AbstractListTableMapping public void rawDeleted(IDBStoreAccessor accessor, CDOID id, CDOBranch branch, int version) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlClear, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlClear, ReuseProbability.HIGH); try { diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingListTableMappingWithRanges.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingListTableMappingWithRanges.java index 16b3a96d73..5baa748f4b 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingListTableMappingWithRanges.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/BranchingListTableMappingWithRanges.java @@ -49,6 +49,7 @@ import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBType; import org.eclipse.net4j.db.DBUtil; import org.eclipse.net4j.db.IDBDatabase; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.db.ddl.IDBIndex.Type; import org.eclipse.net4j.db.ddl.IDBTable; @@ -61,7 +62,6 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EStructuralFeature; -import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; @@ -323,7 +323,7 @@ public class BranchingListTableMappingWithRanges extends AbstractBasicListTableM String sql = sqlSelectChunksPrefix + sqlOrderByIndex; IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sql, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sql, ReuseProbability.HIGH); ResultSet resultSet = null; ArrayList<Pair<Integer, Integer>> toReadFromBase = null; // list of chunks to be read from base revision @@ -451,7 +451,7 @@ public class BranchingListTableMappingWithRanges extends AbstractBasicListTableM String sql = builder.toString(); IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = chunkReader.getAccessor().getDBTransaction().prepareStatement(sql, ReuseProbability.LOW); + IDBPreparedStatement stmt = chunkReader.getAccessor().getDBConnection().prepareStatement(sql, ReuseProbability.LOW); ResultSet resultSet = null; IStoreChunkReader baseReader = null; @@ -659,7 +659,7 @@ public class BranchingListTableMappingWithRanges extends AbstractBasicListTableM } } - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlClearList, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlClearList, ReuseProbability.HIGH); try { @@ -947,7 +947,7 @@ public class BranchingListTableMappingWithRanges extends AbstractBasicListTableM int startIndex, int endIndex) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); try { @@ -1031,7 +1031,7 @@ public class BranchingListTableMappingWithRanges extends AbstractBasicListTableM int startIndex, int endIndex) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); try { @@ -1121,7 +1121,7 @@ public class BranchingListTableMappingWithRanges extends AbstractBasicListTableM } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlInsertEntry, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsertEntry, ReuseProbability.HIGH); try { @@ -1161,7 +1161,7 @@ public class BranchingListTableMappingWithRanges extends AbstractBasicListTableM } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlInsertEntry, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsertEntry, ReuseProbability.HIGH); try { @@ -1198,7 +1198,7 @@ public class BranchingListTableMappingWithRanges extends AbstractBasicListTableM } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlDeleteEntry, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlDeleteEntry, ReuseProbability.HIGH); try { @@ -1230,7 +1230,7 @@ public class BranchingListTableMappingWithRanges extends AbstractBasicListTableM { // no temporary entry found, so mark the entry as removed DBUtil.close(stmt); - stmt = accessor.getDBTransaction().prepareStatement(sqlRemoveEntry, ReuseProbability.HIGH); + stmt = accessor.getDBConnection().prepareStatement(sqlRemoveEntry, ReuseProbability.HIGH); column = 1; stmt.setInt(column++, newVersion); @@ -1295,7 +1295,7 @@ public class BranchingListTableMappingWithRanges extends AbstractBasicListTableM private Object getValue(IDBStoreAccessor accessor, CDOID id, int branchId, int index, boolean getFromBase) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlGetValue, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlGetValue, ReuseProbability.HIGH); Object result = null; try @@ -1410,7 +1410,7 @@ public class BranchingListTableMappingWithRanges extends AbstractBasicListTableM } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sql, ReuseProbability.MEDIUM); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sql, ReuseProbability.MEDIUM); ResultSet resultSet = null; try diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditClassMapping.java index 62c7fe829d..7bcc01cf5c 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditClassMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditClassMapping.java @@ -43,6 +43,7 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta; import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBUtil; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.db.ddl.IDBField; import org.eclipse.net4j.util.ImplementationError; @@ -53,7 +54,6 @@ import org.eclipse.net4j.util.om.trace.ContextTracer; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EStructuralFeature; -import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.Map; @@ -203,21 +203,21 @@ public class HorizontalAuditClassMapping extends AbstractHorizontalClassMapping public boolean readRevision(IDBStoreAccessor accessor, InternalCDORevision revision, int listChunk) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = null; + IDBPreparedStatement stmt = null; try { long timeStamp = revision.getTimeStamp(); if (timeStamp != CDOBranchPoint.UNSPECIFIED_DATE) { - stmt = accessor.getDBTransaction().prepareStatement(sqlSelectAttributesByTime, ReuseProbability.MEDIUM); + stmt = accessor.getDBConnection().prepareStatement(sqlSelectAttributesByTime, ReuseProbability.MEDIUM); idHandler.setCDOID(stmt, 1, revision.getID()); stmt.setLong(2, timeStamp); stmt.setLong(3, timeStamp); } else { - stmt = accessor.getDBTransaction().prepareStatement(sqlSelectCurrentAttributes, ReuseProbability.HIGH); + stmt = accessor.getDBConnection().prepareStatement(sqlSelectCurrentAttributes, ReuseProbability.HIGH); idHandler.setCDOID(stmt, 1, revision.getID()); } @@ -245,7 +245,7 @@ public class HorizontalAuditClassMapping extends AbstractHorizontalClassMapping public boolean readRevisionByVersion(IDBStoreAccessor accessor, InternalCDORevision revision, int listChunk) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlSelectAttributesByVersion, + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlSelectAttributesByVersion, ReuseProbability.HIGH); try @@ -274,7 +274,7 @@ public class HorizontalAuditClassMapping extends AbstractHorizontalClassMapping } } - public PreparedStatement createResourceQueryStatement(IDBStoreAccessor accessor, CDOID folderId, String name, + public IDBPreparedStatement createResourceQueryStatement(IDBStoreAccessor accessor, CDOID folderId, String name, boolean exactMatch, CDOBranchPoint branchPoint) { EStructuralFeature nameFeature = EresourcePackage.eINSTANCE.getCDOResourceNode_Name(); @@ -324,7 +324,8 @@ public class HorizontalAuditClassMapping extends AbstractHorizontalClassMapping } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(builder.toString(), ReuseProbability.MEDIUM); + IDBPreparedStatement stmt = accessor.getDBConnection() + .prepareStatement(builder.toString(), ReuseProbability.MEDIUM); try { @@ -357,21 +358,21 @@ public class HorizontalAuditClassMapping extends AbstractHorizontalClassMapping } } - public PreparedStatement createObjectIDStatement(IDBStoreAccessor accessor) + public IDBPreparedStatement createObjectIDStatement(IDBStoreAccessor accessor) { if (TRACER.isEnabled()) { TRACER.format("Created ObjectID Statement : {0}", sqlSelectAllObjectIDs); //$NON-NLS-1$ } - return accessor.getDBTransaction().prepareStatement(sqlSelectAllObjectIDs, ReuseProbability.HIGH); + return accessor.getDBConnection().prepareStatement(sqlSelectAllObjectIDs, ReuseProbability.HIGH); } @Override protected final void writeValues(IDBStoreAccessor accessor, InternalCDORevision revision) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlInsertAttributes, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsertAttributes, ReuseProbability.HIGH); try { @@ -437,7 +438,7 @@ public class HorizontalAuditClassMapping extends AbstractHorizontalClassMapping OMMonitor mon) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlInsertAttributes, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsertAttributes, ReuseProbability.HIGH); try { @@ -490,8 +491,8 @@ public class HorizontalAuditClassMapping extends AbstractHorizontalClassMapping @Override protected void rawDeleteAttributes(IDBStoreAccessor accessor, CDOID id, CDOBranch branch, int version, OMMonitor fork) { - PreparedStatement stmt = accessor.getDBTransaction() - .prepareStatement(sqlRawDeleteAttributes, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlRawDeleteAttributes, + ReuseProbability.HIGH); try { @@ -513,7 +514,7 @@ public class HorizontalAuditClassMapping extends AbstractHorizontalClassMapping protected void reviseOldRevision(IDBStoreAccessor accessor, CDOID id, CDOBranch branch, long revised) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlReviseAttributes, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlReviseAttributes, ReuseProbability.HIGH); try { diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java index 218d75ed6e..f6acacf023 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java @@ -52,6 +52,7 @@ import org.eclipse.emf.cdo.spi.server.InternalRepository; import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBType; import org.eclipse.net4j.db.DBUtil; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.db.ddl.IDBField; import org.eclipse.net4j.db.ddl.IDBTable; @@ -63,7 +64,6 @@ import org.eclipse.net4j.util.om.trace.ContextTracer; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EStructuralFeature; -import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashSet; @@ -349,13 +349,13 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp int branchID = revision.getBranch().getID(); IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = null; + IDBPreparedStatement stmt = null; try { if (timeStamp != CDOBranchPoint.UNSPECIFIED_DATE) { - stmt = accessor.getDBTransaction().prepareStatement(sqlSelectAttributesByTime, ReuseProbability.MEDIUM); + stmt = accessor.getDBConnection().prepareStatement(sqlSelectAttributesByTime, ReuseProbability.MEDIUM); idHandler.setCDOID(stmt, 1, revision.getID()); stmt.setInt(2, branchID); stmt.setLong(3, timeStamp); @@ -363,7 +363,7 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp } else { - stmt = accessor.getDBTransaction().prepareStatement(sqlSelectCurrentAttributes, ReuseProbability.HIGH); + stmt = accessor.getDBConnection().prepareStatement(sqlSelectCurrentAttributes, ReuseProbability.HIGH); idHandler.setCDOID(stmt, 1, revision.getID()); stmt.setInt(2, branchID); } @@ -392,7 +392,7 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp public boolean readRevisionByVersion(IDBStoreAccessor accessor, InternalCDORevision revision, int listChunk) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlSelectAttributesByVersion, + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlSelectAttributesByVersion, ReuseProbability.HIGH); boolean success; @@ -423,7 +423,7 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp return success; } - public PreparedStatement createResourceQueryStatement(IDBStoreAccessor accessor, CDOID folderId, String name, + public IDBPreparedStatement createResourceQueryStatement(IDBStoreAccessor accessor, CDOID folderId, String name, boolean exactMatch, CDOBranchPoint branchPoint) { EStructuralFeature nameFeature = EresourcePackage.eINSTANCE.getCDOResourceNode_Name(); @@ -477,7 +477,8 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(builder.toString(), ReuseProbability.MEDIUM); + IDBPreparedStatement stmt = accessor.getDBConnection() + .prepareStatement(builder.toString(), ReuseProbability.MEDIUM); try { @@ -511,21 +512,21 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp } } - public PreparedStatement createObjectIDStatement(IDBStoreAccessor accessor) + public IDBPreparedStatement createObjectIDStatement(IDBStoreAccessor accessor) { if (TRACER.isEnabled()) { TRACER.format("Created ObjectID Statement : {0}", sqlSelectAllObjectIDs); //$NON-NLS-1$ } - return accessor.getDBTransaction().prepareStatement(sqlSelectAllObjectIDs, ReuseProbability.HIGH); + return accessor.getDBConnection().prepareStatement(sqlSelectAllObjectIDs, ReuseProbability.HIGH); } @Override protected final void writeValues(IDBStoreAccessor accessor, InternalCDORevision revision) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlInsertAttributes, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsertAttributes, ReuseProbability.HIGH); try { @@ -591,7 +592,7 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp OMMonitor mon) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlInsertAttributes, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsertAttributes, ReuseProbability.HIGH); try { @@ -646,8 +647,8 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp protected void rawDeleteAttributes(IDBStoreAccessor accessor, CDOID id, CDOBranch branch, int version, OMMonitor fork) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction() - .prepareStatement(sqlRawDeleteAttributes, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlRawDeleteAttributes, + ReuseProbability.HIGH); try { @@ -670,7 +671,7 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp protected void reviseOldRevision(IDBStoreAccessor accessor, CDOID id, CDOBranch branch, long revised) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlReviseAttributes, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlReviseAttributes, ReuseProbability.HIGH); try { @@ -838,7 +839,7 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp CDOBranchManager branchManager = repository.getBranchManager(); IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(builder.toString(), ReuseProbability.LOW); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(builder.toString(), ReuseProbability.LOW); ResultSet resultSet = null; try @@ -923,7 +924,7 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(builder.toString(), ReuseProbability.LOW); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(builder.toString(), ReuseProbability.LOW); ResultSet resultSet = null; Set<CDOID> result = new HashSet<CDOID>(); diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategy.java index de8ef13795..9a80699c5a 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategy.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategy.java @@ -18,6 +18,9 @@ import org.eclipse.emf.cdo.server.db.mapping.IListMapping; import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBUtil; +import org.eclipse.net4j.db.IDBConnection; +import org.eclipse.net4j.db.IDBPreparedStatement; +import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.db.ddl.IDBTable; import org.eclipse.net4j.util.om.monitor.OMMonitor; import org.eclipse.net4j.util.om.monitor.OMMonitor.Async; @@ -25,8 +28,6 @@ import org.eclipse.net4j.util.om.monitor.OMMonitor.Async; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EStructuralFeature; -import java.sql.Connection; -import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -102,7 +103,7 @@ public class HorizontalBranchingMappingStrategy extends AbstractHorizontalMappin } @Override - protected void rawImportReviseOldRevisions(Connection connection, IDBTable table, OMMonitor monitor) + protected void rawImportReviseOldRevisions(IDBConnection connection, IDBTable table, OMMonitor monitor) { String sqlUpdate = "UPDATE " + table + " SET " + ATTRIBUTES_REVISED + "=? WHERE " + ATTRIBUTES_ID + "=? AND " + ATTRIBUTES_BRANCH + "=? AND " + ATTRIBUTES_VERSION + "=?"; @@ -115,15 +116,13 @@ public class HorizontalBranchingMappingStrategy extends AbstractHorizontalMappin + ATTRIBUTES_REVISED + "=0"; IIDHandler idHandler = getStore().getIDHandler(); - PreparedStatement stmtUpdate = null; - PreparedStatement stmtQuery = null; + IDBPreparedStatement stmtUpdate = connection.prepareStatement(sqlUpdate, ReuseProbability.MEDIUM); + IDBPreparedStatement stmtQuery = connection.prepareStatement(sqlQuery, ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY, ReuseProbability.MEDIUM); ResultSet resultSet = null; try { - stmtUpdate = connection.prepareStatement(sqlUpdate); - stmtQuery = connection.prepareStatement(sqlQuery, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - resultSet = stmtQuery.executeQuery(); int size = DBUtil.getRowCount(resultSet); if (size == 0) @@ -148,6 +147,7 @@ public class HorizontalBranchingMappingStrategy extends AbstractHorizontalMappin } Async async = monitor.forkAsync(size); + try { stmtUpdate.executeBatch(); @@ -171,25 +171,23 @@ public class HorizontalBranchingMappingStrategy extends AbstractHorizontalMappin } @Override - protected void rawImportUnreviseNewRevisions(Connection connection, IDBTable table, long fromCommitTime, + protected void rawImportUnreviseNewRevisions(IDBConnection connection, IDBTable table, long fromCommitTime, long toCommitTime, OMMonitor monitor) { - String sqlUpdate = "UPDATE " + table + " SET " + ATTRIBUTES_REVISED + "=0 WHERE " + ATTRIBUTES_BRANCH + ">=0 AND " + String sql = "UPDATE " + table + " SET " + ATTRIBUTES_REVISED + "=0 WHERE " + ATTRIBUTES_BRANCH + ">=0 AND " + ATTRIBUTES_CREATED + "<=" + toCommitTime + " AND " + ATTRIBUTES_REVISED + ">" + toCommitTime + " AND " + ATTRIBUTES_VERSION + ">0"; - PreparedStatement stmtUpdate = null; + IDBPreparedStatement stmt = connection.prepareStatement(sql, ReuseProbability.MEDIUM); try { - stmtUpdate = connection.prepareStatement(sqlUpdate); - monitor.begin(); Async async = monitor.forkAsync(); try { - stmtUpdate.executeUpdate(); + stmt.executeUpdate(); } finally { @@ -202,7 +200,7 @@ public class HorizontalBranchingMappingStrategy extends AbstractHorizontalMappin } finally { - DBUtil.close(stmtUpdate); + DBUtil.close(stmt); monitor.done(); } } diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategyWithRanges.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategyWithRanges.java index d32d36e355..f038ac431c 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategyWithRanges.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingMappingStrategyWithRanges.java @@ -24,6 +24,9 @@ import org.eclipse.emf.cdo.server.db.mapping.IListMapping; import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBUtil; import org.eclipse.net4j.db.DBUtil.DeserializeRowHandler; +import org.eclipse.net4j.db.IDBConnection; +import org.eclipse.net4j.db.IDBPreparedStatement; +import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.db.ddl.IDBField; import org.eclipse.net4j.db.ddl.IDBTable; import org.eclipse.net4j.util.io.ExtendedDataInput; @@ -35,7 +38,6 @@ import org.eclipse.emf.ecore.EStructuralFeature; import java.io.IOException; import java.sql.Connection; -import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Collection; @@ -82,8 +84,8 @@ public class HorizontalBranchingMappingStrategyWithRanges extends HorizontalBran } @Override - protected void rawExportList(CDODataOutput out, Connection connection, IListMapping listMapping, IDBTable attrTable, - String attrSuffix) throws IOException + protected void rawExportList(CDODataOutput out, IDBConnection connection, IListMapping listMapping, + IDBTable attrTable, String attrSuffix) throws IOException { super.rawExportList(out, connection, listMapping, attrTable, attrSuffix); @@ -93,7 +95,7 @@ public class HorizontalBranchingMappingStrategyWithRanges extends HorizontalBran } } - private void rawExportListPostProcess(CDODataOutput out, Connection connection, IDBTable attrTable, + private void rawExportListPostProcess(CDODataOutput out, IDBConnection connection, IDBTable attrTable, String attrSuffix, IDBTable table) throws IOException { StringBuilder builder = new StringBuilder(); @@ -120,12 +122,12 @@ public class HorizontalBranchingMappingStrategyWithRanges extends HorizontalBran String sql = DBUtil.trace(builder.toString()); IIDHandler idHandler = getStore().getIDHandler(); - PreparedStatement stmt = null; + IDBPreparedStatement stmt = connection.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY, ReuseProbability.MEDIUM); ResultSet resultSet = null; try { - stmt = connection.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); resultSet = stmt.executeQuery(); // Write resultSet size for progress monitoring @@ -163,7 +165,7 @@ public class HorizontalBranchingMappingStrategyWithRanges extends HorizontalBran } @Override - protected void rawImportList(CDODataInput in, Connection connection, IListMapping listMapping, OMMonitor monitor) + protected void rawImportList(CDODataInput in, IDBConnection connection, IListMapping listMapping, OMMonitor monitor) throws IOException { Collection<IDBTable> tables = listMapping.getDBTables(); @@ -190,7 +192,7 @@ public class HorizontalBranchingMappingStrategyWithRanges extends HorizontalBran } } - private void rawImportListPostProcess(CDODataInput in, Connection connection, IDBTable table, OMMonitor monitor) + private void rawImportListPostProcess(CDODataInput in, IDBConnection connection, IDBTable table, OMMonitor monitor) throws IOException { int size = in.readInt(); @@ -216,13 +218,12 @@ public class HorizontalBranchingMappingStrategyWithRanges extends HorizontalBran String sql = DBUtil.trace(builder.toString()); IIDHandler idHandler = getStore().getIDHandler(); - PreparedStatement stmt = null; + IDBPreparedStatement stmt = connection.prepareStatement(sql, ReuseProbability.MEDIUM); monitor.begin(1 + 2 * size); try { - stmt = connection.prepareStatement(sql); monitor.worked(); for (int row = 0; row < size; row++) @@ -340,7 +341,7 @@ public class HorizontalBranchingMappingStrategyWithRanges extends HorizontalBran { private final IIDHandler idHandler = getStore().getIDHandler(); - private PreparedStatement stmt; + private IDBPreparedStatement stmt; public void handleRow(ExtendedDataInput in, Connection connection, IDBField[] fields, Object[] values) throws SQLException, IOException @@ -360,7 +361,7 @@ public class HorizontalBranchingMappingStrategyWithRanges extends HorizontalBran + " AND " + LIST_IDX + "=?" // + " AND " + LIST_REVISION_VERSION_ADDED + "<?" // + " AND " + LIST_REVISION_VERSION_REMOVED + " IS NULL"; - stmt = connection.prepareStatement(sql); + stmt = ((IDBConnection)connection).prepareStatement(sql, ReuseProbability.MEDIUM); } Object sourceID = values[0]; diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalNonAuditClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalNonAuditClassMapping.java index 912c554389..473725b3d3 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalNonAuditClassMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalNonAuditClassMapping.java @@ -41,6 +41,7 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta; import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBUtil; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.db.ddl.IDBField; import org.eclipse.net4j.util.ImplementationError; @@ -52,7 +53,6 @@ import org.eclipse.net4j.util.om.trace.ContextTracer; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EStructuralFeature; -import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; @@ -192,7 +192,7 @@ public class HorizontalNonAuditClassMapping extends AbstractHorizontalClassMappi protected void writeValues(IDBStoreAccessor accessor, InternalCDORevision revision) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlInsertAttributes, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsertAttributes, ReuseProbability.HIGH); try { @@ -252,17 +252,17 @@ public class HorizontalNonAuditClassMapping extends AbstractHorizontalClassMappi } } - public PreparedStatement createObjectIDStatement(IDBStoreAccessor accessor) + public IDBPreparedStatement createObjectIDStatement(IDBStoreAccessor accessor) { if (TRACER.isEnabled()) { TRACER.format("Created ObjectID Statement : {0}", sqlSelectAllObjectIDs); //$NON-NLS-1$ } - return accessor.getDBTransaction().prepareStatement(sqlSelectAllObjectIDs, ReuseProbability.HIGH); + return accessor.getDBConnection().prepareStatement(sqlSelectAllObjectIDs, ReuseProbability.HIGH); } - public PreparedStatement createResourceQueryStatement(IDBStoreAccessor accessor, CDOID folderId, String name, + public IDBPreparedStatement createResourceQueryStatement(IDBStoreAccessor accessor, CDOID folderId, String name, boolean exactMatch, CDOBranchPoint branchPoint) { long timeStamp = branchPoint.getTimeStamp(); @@ -300,7 +300,8 @@ public class HorizontalNonAuditClassMapping extends AbstractHorizontalClassMappi } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(builder.toString(), ReuseProbability.MEDIUM); + IDBPreparedStatement stmt = accessor.getDBConnection() + .prepareStatement(builder.toString(), ReuseProbability.MEDIUM); try { @@ -336,7 +337,7 @@ public class HorizontalNonAuditClassMapping extends AbstractHorizontalClassMappi } IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlSelectCurrentAttributes, + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlSelectCurrentAttributes, ReuseProbability.HIGH); try @@ -379,7 +380,7 @@ public class HorizontalNonAuditClassMapping extends AbstractHorizontalClassMappi OMMonitor monitor) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlDelete, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlDelete, ReuseProbability.HIGH); try { @@ -564,7 +565,7 @@ public class HorizontalNonAuditClassMapping extends AbstractHorizontalClassMappi private void updateAttributes() { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(buildUpdateStatement(), + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(buildUpdateStatement(), ReuseProbability.MEDIUM); try @@ -631,7 +632,7 @@ public class HorizontalNonAuditClassMapping extends AbstractHorizontalClassMappi return builder.toString(); } - private int setUpdateAttributeValues(List<Pair<ITypeMapping, Object>> attributeChanges, PreparedStatement stmt, + private int setUpdateAttributeValues(List<Pair<ITypeMapping, Object>> attributeChanges, IDBPreparedStatement stmt, int col) throws SQLException { for (Pair<ITypeMapping, Object> change : attributeChanges) @@ -664,7 +665,7 @@ public class HorizontalNonAuditClassMapping extends AbstractHorizontalClassMappi } private int setUpdateListSizeChanges(List<Pair<EStructuralFeature, Integer>> attributeChanges, - PreparedStatement stmt, int col) throws SQLException + IDBPreparedStatement stmt, int col) throws SQLException { for (Pair<EStructuralFeature, Integer> change : listSizeChanges) { diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditFeatureMapTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditFeatureMapTableMapping.java index 3c8d537503..2eb14aab85 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditFeatureMapTableMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditFeatureMapTableMapping.java @@ -34,6 +34,7 @@ import org.eclipse.emf.cdo.server.db.mapping.ITypeMapping; import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBUtil; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.util.ImplementationError; @@ -215,7 +216,7 @@ public class NonAuditFeatureMapTableMapping extends AbstractFeatureMapTableMappi public void clearList(IDBStoreAccessor accessor, CDOID id) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlClear, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlClear, ReuseProbability.HIGH); try { @@ -265,7 +266,7 @@ public class NonAuditFeatureMapTableMapping extends AbstractFeatureMapTableMappi String columnName = getColumnName(tag); IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlInsert, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsert, ReuseProbability.HIGH); try { @@ -339,7 +340,7 @@ public class NonAuditFeatureMapTableMapping extends AbstractFeatureMapTableMappi private void updateOneIndex(IDBStoreAccessor accessor, CDOID id, int oldIndex, int newIndex) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); try { @@ -381,7 +382,7 @@ public class NonAuditFeatureMapTableMapping extends AbstractFeatureMapTableMappi private void move1down(IDBStoreAccessor accessor, CDOID id, int index, int upperIndex) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement( + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement( upperIndex == UNBOUNDED_MOVE ? sqlMoveDown : sqlMoveDownWithLimit, ReuseProbability.HIGH); try @@ -412,7 +413,7 @@ public class NonAuditFeatureMapTableMapping extends AbstractFeatureMapTableMappi private void move1up(IDBStoreAccessor accessor, CDOID id, int index, int upperIndex) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement( + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement( upperIndex == UNBOUNDED_MOVE ? sqlMoveUp : sqlMoveUpWithLimit, ReuseProbability.HIGH); try @@ -439,7 +440,7 @@ public class NonAuditFeatureMapTableMapping extends AbstractFeatureMapTableMappi private void deleteItem(IDBStoreAccessor accessor, CDOID id, int index) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlDeleteItem, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlDeleteItem, ReuseProbability.HIGH); try { @@ -478,7 +479,7 @@ public class NonAuditFeatureMapTableMapping extends AbstractFeatureMapTableMappi String columnName = getColumnName(tag); IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlUpdateValue, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlUpdateValue, ReuseProbability.HIGH); try { diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditListTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditListTableMapping.java index 5f85862c16..fec07870f8 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditListTableMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditListTableMapping.java @@ -35,6 +35,7 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision; import org.eclipse.net4j.db.DBException; import org.eclipse.net4j.db.DBUtil; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.db.ddl.IDBTable; import org.eclipse.net4j.util.om.trace.ContextTracer; @@ -224,7 +225,7 @@ public class NonAuditListTableMapping extends AbstractListTableMapping implement public void clearList(IDBStoreAccessor accessor, CDOID id) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlClear, ReuseProbability.HIGH); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlClear, ReuseProbability.HIGH); try { @@ -250,7 +251,7 @@ public class NonAuditListTableMapping extends AbstractListTableMapping implement public int getCurrentIndexOffset(IDBStoreAccessor accessor, CDOID id) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlReadCurrentIndexOffset, + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlReadCurrentIndexOffset, ReuseProbability.HIGH); ResultSet rset = null; @@ -698,10 +699,10 @@ public class NonAuditListTableMapping extends AbstractListTableMapping implement private void writeResultToDatabase(IDBStoreAccessor accessor, CDOID id) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement deleteStmt = null; - PreparedStatement moveStmt = null; - PreparedStatement setValueStmt = null; - PreparedStatement insertStmt = null; + IDBPreparedStatement deleteStmt = null; + IDBPreparedStatement moveStmt = null; + IDBPreparedStatement setValueStmt = null; + IDBPreparedStatement insertStmt = null; int deleteCounter = 0; int moveCounter = 0; @@ -735,7 +736,7 @@ public class NonAuditListTableMapping extends AbstractListTableMapping implement if (deleteStmt == null) { - deleteStmt = accessor.getDBTransaction().prepareStatement(sqlDeleteItem, ReuseProbability.HIGH); + deleteStmt = accessor.getDBConnection().prepareStatement(sqlDeleteItem, ReuseProbability.HIGH); idHandler.setCDOID(deleteStmt, 1, id); } @@ -757,7 +758,7 @@ public class NonAuditListTableMapping extends AbstractListTableMapping implement */ if (moveStmt == null) { - moveStmt = accessor.getDBTransaction().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); + moveStmt = accessor.getDBConnection().prepareStatement(sqlUpdateIndex, ReuseProbability.HIGH); idHandler.setCDOID(moveStmt, 2, id); } @@ -825,7 +826,7 @@ public class NonAuditListTableMapping extends AbstractListTableMapping implement */ if (setValueStmt == null) { - setValueStmt = accessor.getDBTransaction().prepareStatement(sqlUpdateValue, ReuseProbability.HIGH); + setValueStmt = accessor.getDBConnection().prepareStatement(sqlUpdateValue, ReuseProbability.HIGH); idHandler.setCDOID(setValueStmt, 2, id); } @@ -847,7 +848,7 @@ public class NonAuditListTableMapping extends AbstractListTableMapping implement */ if (insertStmt == null) { - insertStmt = accessor.getDBTransaction().prepareStatement(sqlInsertValue, ReuseProbability.HIGH); + insertStmt = accessor.getDBConnection().prepareStatement(sqlInsertValue, ReuseProbability.HIGH); idHandler.setCDOID(insertStmt, 1, id); } @@ -993,7 +994,7 @@ public class NonAuditListTableMapping extends AbstractListTableMapping implement */ ListIterator<ShiftOperation> operationIt = shiftOperations.listIterator(); - PreparedStatement shiftDownStmt = null; + IDBPreparedStatement shiftDownStmt = null; int operationCounter = 0; try @@ -1005,7 +1006,7 @@ public class NonAuditListTableMapping extends AbstractListTableMapping implement { if (shiftDownStmt == null) { - shiftDownStmt = accessor.getDBTransaction().prepareStatement(sqlShiftDownIndex, ReuseProbability.HIGH); + shiftDownStmt = accessor.getDBConnection().prepareStatement(sqlShiftDownIndex, ReuseProbability.HIGH); idHandler.setCDOID(shiftDownStmt, 2, id); } @@ -1034,7 +1035,7 @@ public class NonAuditListTableMapping extends AbstractListTableMapping implement close(shiftDownStmt); } - PreparedStatement shiftUpStmt = null; + IDBPreparedStatement shiftUpStmt = null; operationCounter = 0; try @@ -1045,7 +1046,7 @@ public class NonAuditListTableMapping extends AbstractListTableMapping implement ShiftOperation operation = operationIt.previous(); if (shiftUpStmt == null) { - shiftUpStmt = accessor.getDBTransaction().prepareStatement(sqlShiftUpIndex, ReuseProbability.HIGH); + shiftUpStmt = accessor.getDBConnection().prepareStatement(sqlShiftUpIndex, ReuseProbability.HIGH); idHandler.setCDOID(shiftUpStmt, 2, id); } diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/ObjectTypeTable.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/ObjectTypeTable.java index 6b75d7cf5c..85e7fc26e1 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/ObjectTypeTable.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/ObjectTypeTable.java @@ -27,6 +27,7 @@ import org.eclipse.net4j.db.DBType; import org.eclipse.net4j.db.DBUtil; import org.eclipse.net4j.db.IDBDatabase; import org.eclipse.net4j.db.IDBDatabase.RunnableWithSchema; +import org.eclipse.net4j.db.IDBPreparedStatement; import org.eclipse.net4j.db.IDBPreparedStatement.ReuseProbability; import org.eclipse.net4j.db.ddl.IDBIndex; import org.eclipse.net4j.db.ddl.IDBSchema; @@ -37,7 +38,6 @@ import org.eclipse.emf.ecore.EClass; import java.io.IOException; import java.sql.Connection; -import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; @@ -63,7 +63,7 @@ public class ObjectTypeTable extends AbstractObjectTypeMapper implements IMappin public final CDOClassifierRef getObjectType(IDBStoreAccessor accessor, CDOID id) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlSelect, ReuseProbability.MAX); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlSelect, ReuseProbability.MAX); try { @@ -104,7 +104,7 @@ public class ObjectTypeTable extends AbstractObjectTypeMapper implements IMappin { IDBStore store = getMappingStrategy().getStore(); IIDHandler idHandler = store.getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlInsert, ReuseProbability.MAX); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlInsert, ReuseProbability.MAX); try { @@ -141,7 +141,7 @@ public class ObjectTypeTable extends AbstractObjectTypeMapper implements IMappin public final void removeObjectType(IDBStoreAccessor accessor, CDOID id) { IIDHandler idHandler = getMappingStrategy().getStore().getIDHandler(); - PreparedStatement stmt = accessor.getDBTransaction().prepareStatement(sqlDelete, ReuseProbability.MAX); + IDBPreparedStatement stmt = accessor.getDBConnection().prepareStatement(sqlDelete, ReuseProbability.MAX); try { |