Author: tolusha
Date: 2011-09-01 05:31:23 -0400 (Thu, 01 Sep 2011)
New Revision: 4824
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
Log:
EXOJCR-1482: revert changes
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2011-09-01
07:12:32 UTC (rev 4823)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2011-09-01
09:31:23 UTC (rev 4824)
@@ -166,6 +166,8 @@
protected PreparedStatement findPropertiesByParentId;
+ protected PreparedStatement insertItem;
+
protected PreparedStatement insertNode;
protected PreparedStatement insertProperty;
@@ -174,11 +176,20 @@
protected PreparedStatement insertValue;
+ protected PreparedStatement updateItem;
+
+ protected PreparedStatement updateItemPath;
+
protected PreparedStatement updateNode;
protected PreparedStatement updateProperty;
protected PreparedStatement deleteItem;
+
+ protected PreparedStatement deleteNode;
+
+ protected PreparedStatement deleteProperty;
+
protected PreparedStatement deleteReference;
protected PreparedStatement deleteValue;
@@ -475,6 +486,11 @@
findPropertiesByParentId.close();
}
+ if (insertItem != null)
+ {
+ insertItem.close();
+ }
+
if (insertNode != null)
{
insertNode.close();
@@ -495,6 +511,16 @@
insertValue.close();
}
+ if (updateItem != null)
+ {
+ updateItem.close();
+ }
+
+ if (updateItemPath != null)
+ {
+ updateItemPath.close();
+ }
+
if (updateNode != null)
{
updateNode.close();
@@ -510,6 +536,16 @@
deleteItem.close();
}
+ if (deleteNode != null)
+ {
+ deleteNode.close();
+ }
+
+ if (deleteProperty != null)
+ {
+ deleteProperty.close();
+ }
+
if (deleteReference != null)
{
deleteReference.close();
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2011-09-01
07:12:32 UTC (rev 4823)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2011-09-01
09:31:23 UTC (rev 4824)
@@ -153,8 +153,6 @@
protected Statement findNodesByParentIdAndComplexPatternCQ;
- protected final boolean allowBatching;
-
/**
* JDBCStorageConnection constructor.
*
@@ -178,7 +176,6 @@
throws SQLException
{
super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize,
swapDirectory, swapCleaner);
- this.allowBatching = dbConnection.getMetaData().supportsBatchUpdates();
}
/**
@@ -508,7 +505,7 @@
{
List<ValueData> vdata = data.getValues();
- for (int i = 0, length = vdata.size(); i < length; i++)
+ for (int i = 0; i < vdata.size(); i++)
{
ValueData vd = vdata.get(i);
ValueIOChannel channel = valueStorageProvider.getApplicableChannel(data, i);
@@ -564,11 +561,11 @@
}
if (i < totalOldValues)
{
- updateValueData(cid, i, stream, streamLength, storageId, i == length - 1 || i
== totalOldValues - 1);
+ updateValueData(cid, i, stream, streamLength, storageId);
}
else
{
- addValueData(cid, i, stream, streamLength, storageId, i == length - 1);
+ addValueData(cid, i, stream, streamLength, storageId);
}
}
}
@@ -1243,9 +1240,6 @@
protected abstract int deleteValueDataByOrderNum(String id, int orderNum) throws
SQLException;
- protected abstract int updateValueData(String cid, int i, InputStream stream, int
streamLength, String storageId,
- boolean lastValue) throws SQLException;
-
- protected abstract int addValueData(String cid, int orderNumber, InputStream stream,
int streamLength,
- String storageId, boolean lastValue) throws SQLException;
+ protected abstract int updateValueData(String cid, int i, InputStream stream, int
streamLength, String storageId)
+ throws SQLException;
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2011-09-01
07:12:32 UTC (rev 4823)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2011-09-01
09:31:23 UTC (rev 4824)
@@ -667,17 +667,6 @@
protected int addValueData(String cid, int orderNumber, InputStream stream, int
streamLength, String storageDesc)
throws SQLException
{
- throw new UnsupportedOperationException("This method is not supported, use the
mehod of the same name with lastValue");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected int addValueData(String cid, int orderNumber, InputStream stream, int
streamLength, String storageDesc,
- boolean lastValue) throws SQLException
- {
-
if (insertValue == null)
{
insertValue = dbConnection.prepareStatement(INSERT_VALUE);
@@ -701,15 +690,6 @@
insertValue.setInt(2, orderNumber);
insertValue.setString(3, cid);
- if (allowBatching)
- {
- insertValue.addBatch();
- if (lastValue)
- {
- insertValue.executeBatch();
- }
- return 1;
- }
return insertValue.executeUpdate();
}
@@ -905,8 +885,8 @@
return findPropertyById.executeQuery();
}
- protected int updateValueData(String cid, int orderNumber, InputStream stream, int
streamLength, String storageDesc,
- boolean lastValue) throws SQLException
+ protected int updateValueData(String cid, int orderNumber, InputStream stream, int
streamLength, String storageDesc)
+ throws SQLException
{
if (updateValue == null)
@@ -932,15 +912,6 @@
updateValue.setString(3, cid);
updateValue.setInt(4, orderNumber);
- if (allowBatching)
- {
- updateValue.addBatch();
- if (lastValue)
- {
- updateValue.executeBatch();
- }
- return 1;
- }
return updateValue.executeUpdate();
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2011-09-01
07:12:32 UTC (rev 4823)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2011-09-01
09:31:23 UTC (rev 4824)
@@ -520,17 +520,6 @@
protected int addValueData(String cid, int orderNumber, InputStream stream, int
streamLength, String storageDesc)
throws SQLException
{
- throw new UnsupportedOperationException("This method is not supported, use the
mehod of the same name with lastValue");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected int addValueData(String cid, int orderNumber, InputStream stream, int
streamLength, String storageDesc,
- boolean lastValue) throws SQLException
- {
-
if (insertValue == null)
insertValue = dbConnection.prepareStatement(INSERT_VALUE);
else
@@ -550,15 +539,6 @@
insertValue.setInt(2, orderNumber);
insertValue.setString(3, cid);
- if (allowBatching)
- {
- insertValue.addBatch();
- if (lastValue)
- {
- insertValue.executeBatch();
- }
- return 1;
- }
return insertValue.executeUpdate();
}
@@ -844,8 +824,8 @@
}
@Override
- protected int updateValueData(String cid, int orderNumber, InputStream stream, int
streamLength, String storageDesc,
- boolean lastValue) throws SQLException
+ protected int updateValueData(String cid, int orderNumber, InputStream stream, int
streamLength, String storageDesc)
+ throws SQLException
{
if (updateValue == null)
@@ -867,15 +847,6 @@
updateValue.setString(3, cid);
updateValue.setInt(4, orderNumber);
- if (allowBatching)
- {
- updateValue.addBatch();
- if (lastValue)
- {
- updateValue.executeBatch();
- }
- return 1;
- }
return updateValue.executeUpdate();
}