jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1583715 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java
Date Tue, 01 Apr 2014 15:33:38 GMT
Author: reschke
Date: Tue Apr  1 15:33:37 2014
New Revision: 1583715

URL: http://svn.apache.org/r1583715
Log:
OAK-1533 - add size column as debugging aid

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java?rev=1583715&r1=1583714&r2=1583715&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java
Tue Apr  1 15:33:37 2014
@@ -278,15 +278,15 @@ public class RDBDocumentStore implements
                     // the code below likely will need to be extended for new database types
                     if ("PostgreSQL".equals(dbtype)) {
                         stmt.execute("create table " + tableName
-                                + " (ID varchar(1000) not null primary key, MODIFIED bigint,
MODCOUNT bigint, DATA varchar(16384), BDATA bytea)");
+                                + " (ID varchar(1000) not null primary key, MODIFIED bigint,
MODCOUNT bigint, SIZE bigint, DATA varchar(16384), BDATA bytea)");
                     }
                     else if ("DB2".equals(dbtype) || (dbtype != null && dbtype.startsWith("DB2/")))
{
                         stmt.execute("create table " + tableName
-                                + " (ID varchar(1000) not null primary key, MODIFIED bigint,
MODCOUNT bigint, DATA varchar(16384), BDATA blob)");
+                                + " (ID varchar(1000) not null primary key, MODIFIED bigint,
MODCOUNT bigint, SIZE bigint, DATA varchar(16384), BDATA blob)");
                     }
                     else {
                         stmt.execute("create table " + tableName
-                                + " (ID varchar(1000) not null primary key, MODIFIED bigint,
MODCOUNT bigint, DATA varchar(16384), BDATA blob)");
+                                + " (ID varchar(1000) not null primary key, MODIFIED bigint,
MODCOUNT bigint, SIZE bigint, DATA varchar(16384), BDATA blob)");
                     }
                     stmt.close();
 
@@ -651,7 +651,7 @@ public class RDBDocumentStore implements
 
     private boolean dbUpdate(Connection connection, String tableName, String id, Long modified,
Long modcount, Long oldmodcount,
             String data) throws SQLException {
-        String t = "update " + tableName + " set MODIFIED = ?, MODCOUNT = ?, DATA = ?, BDATA
= ? where ID = ?";
+        String t = "update " + tableName + " set MODIFIED = ?, MODCOUNT = ?, SIZE = ?, DATA
= ?, BDATA = ? where ID = ?";
         if (oldmodcount != null) {
             t += " and MODCOUNT = ?";
         }
@@ -660,6 +660,7 @@ public class RDBDocumentStore implements
             int si = 1;
             stmt.setObject(si++, modified, Types.BIGINT);
             stmt.setObject(si++, modcount, Types.BIGINT);
+            stmt.setObject(si++, data.length(), Types.BIGINT);
 
             if (data.length() < DATALIMIT) {
                 stmt.setString(si++, data);
@@ -686,12 +687,13 @@ public class RDBDocumentStore implements
 
     private boolean dbInsert(Connection connection, String tableName, String id, Long modified,
Long modcount, String data)
             throws SQLException {
-        PreparedStatement stmt = connection.prepareStatement("insert into " + tableName +
" values(?, ?, ?, ?, ?)");
+        PreparedStatement stmt = connection.prepareStatement("insert into " + tableName +
" values(?, ?, ?, ?, ?, ?)");
         try {
             int si = 1;
             stmt.setString(si++, id);
             stmt.setObject(si++, modified, Types.BIGINT);
             stmt.setObject(si++, modcount, Types.BIGINT);
+            stmt.setObject(si++, data.length(), Types.BIGINT);
             if (data.length() < DATALIMIT) {
                 stmt.setString(si++, data);
                 stmt.setBinaryStream(si++, null, 0);



Mime
View raw message