From do-not-reply at jboss.org Thu Mar 22 05:48:43 2012 Content-Type: multipart/mixed; boundary="===============5793751390330507618==" MIME-Version: 1.0 From: do-not-reply at jboss.org To: exo-jcr-commits at lists.jboss.org Subject: [exo-jcr-commits] exo-jcr SVN: r5937 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: core/lock and 1 other directories. Date: Thu, 22 Mar 2012 05:48:40 -0400 Message-ID: <201203220948.q2M9meMg021207@svn01.web.mwc.hst.phx2.redhat.com> --===============5793751390330507618== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: tolusha Date: 2012-03-22 05:48:39 -0400 (Thu, 22 Mar 2012) New Revision: 5937 Removed: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/= jcr/impl/checker/InspectionQueryFilteredMultivaluedProperties.java Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/= jcr/impl/checker/InspectionQuery.java jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/= jcr/impl/core/lock/AbstractLockTableHandler.java jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/= jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java Log: EXOJCR-1754: testing on DB, fix for DB2 Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/se= rvices/jcr/impl/checker/InspectionQuery.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services= /jcr/impl/checker/InspectionQuery.java 2012-03-22 09:21:04 UTC (rev 5936) +++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services= /jcr/impl/checker/InspectionQuery.java 2012-03-22 09:48:39 UTC (rev 5937) @@ -18,9 +18,6 @@ */ package org.exoplatform.services.jcr.impl.checker; = -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; = /** * @author Andrey Plotniko= v @@ -78,19 +75,4 @@ { return repair; } - - /** - * Creates a PreparedStatement object for sending parameterized SQL sta= tements to the database. = - * = - * @param connection - * connection to workspace storage - * @return - * a new default PreparedStatement object containing the pre-c= ompiled SQL statement = - * @throws SQLException - * if a database access error occurs or this method is called= on a closed connection - */ - public PreparedStatement prepareStatement(Connection connection) throws= SQLException - { - return connection.prepareStatement(statement); - } } Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/ser= vices/jcr/impl/checker/InspectionQueryFilteredMultivaluedProperties.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services= /jcr/impl/checker/InspectionQueryFilteredMultivaluedProperties.java 2012-03= -22 09:21:04 UTC (rev 5936) +++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services= /jcr/impl/checker/InspectionQueryFilteredMultivaluedProperties.java 2012-03= -22 09:48:39 UTC (rev 5937) @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2012 eXo Platform SAS. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.exoplatform.services.jcr.impl.checker; - - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -/** - * @author Andrey Plotniko= v - * @version $Id: InspectionQueryFilteredMultivaluedProperties.java 34360 1= 6.02.2012 andrew.plotnikov $ - */ -public class InspectionQueryFilteredMultivaluedProperties extends Inspecti= onQuery -{ - - /** - * {@inheritDoc} - */ - public InspectionQueryFilteredMultivaluedProperties(String statement, S= tring[] fieldNames, String headerMessage, - InconsistencyRepair repair) - { - super(statement, fieldNames, headerMessage, repair); - } - - /** - * {@inheritDoc} - */ - public PreparedStatement prepareStatement(Connection connection) throws= SQLException - { - PreparedStatement preparedStatement =3D super.prepareStatement(conne= ction); - preparedStatement.setBoolean(1, false); - - return preparedStatement; - } - -} Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/se= rvices/jcr/impl/core/lock/AbstractLockTableHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services= /jcr/impl/core/lock/AbstractLockTableHandler.java 2012-03-22 09:21:04 UTC (= rev 5936) +++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services= /jcr/impl/core/lock/AbstractLockTableHandler.java 2012-03-22 09:48:39 UTC (= rev 5937) @@ -71,7 +71,7 @@ { InspectionQuery query =3D getSelectQuery(); = - preparedStatement =3D query.prepareStatement(jdbcConnection); + preparedStatement =3D jdbcConnection.prepareStatement(query.getSt= atement()); resultSet =3D preparedStatement.executeQuery(); = while (resultSet.next()) @@ -103,7 +103,7 @@ { InspectionQuery query =3D getDeleteQuery(nodeId); = - preparedStatement =3D query.prepareStatement(jdbcConnection); + preparedStatement =3D jdbcConnection.prepareStatement(query.getSt= atement()); preparedStatement.executeUpdate(); } finally Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/se= rvices/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services= /jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java 2012-03-22 09= :21:04 UTC (rev 5936) +++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services= /jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java 2012-03-22 09= :48:39 UTC (rev 5937) @@ -31,7 +31,6 @@ import org.exoplatform.services.jcr.impl.checker.DummyRepair; import org.exoplatform.services.jcr.impl.checker.EarlierVersionsRemover; import org.exoplatform.services.jcr.impl.checker.InspectionQuery; -import org.exoplatform.services.jcr.impl.checker.InspectionQueryFilteredMu= ltivaluedProperties; import org.exoplatform.services.jcr.impl.checker.InspectionReport; import org.exoplatform.services.jcr.impl.checker.NodeRemover; import org.exoplatform.services.jcr.impl.checker.PropertyRemover; @@ -122,7 +121,7 @@ try { jdbcConnection =3D jdbcDataContainer.getConnectionFactory().getJd= bcConnection(); - preparedStatement =3D lockInspectionQuery.prepareStatement(jdbcCo= nnection); + preparedStatement =3D jdbcConnection.prepareStatement(lockInspect= ionQuery.getStatement()); resultSet =3D preparedStatement.executeQuery(); = Set lockedInJCRITEM =3D new HashSet(); @@ -236,7 +235,7 @@ ResultSet resultSet =3D null; try { - st =3D query.prepareStatement(jdbcConn); + st =3D jdbcConn.prepareStatement(query.getStatement()); = resultSet =3D st.executeQuery(); if (resultSet.next()) @@ -300,7 +299,7 @@ try { connection =3D jdbcDataContainer.getConnectionFactory().getJdbcCo= nnection(); - st =3D vsInspectionQuery.prepareStatement(connection); + st =3D connection.prepareStatement(vsInspectionQuery.getStatement= ()); resultSet =3D st.executeQuery(); = if (resultSet.next()) @@ -505,13 +504,29 @@ DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.C= OLUMN_NAME, DBConstants.COLUMN_CLASS}, "Items that do not have parent nodes", new RootAsParentAssigner(j= dbcDataContainer.getConnectionFactory()))); = - itemsInspectionQuery.add(new InspectionQueryFilteredMultivaluedPrope= rties(singleDatabase ? "select * from " - + itemTable + " P where P.CONTAINER_NAME=3D'" + jdbcDataContainer= .containerConfig.containerName - + "' and P.I_CLASS=3D2" + " and P.P_MULTIVALUED=3D? and NOT EXIST= S( select * from " + valueTable - + " V where V.PROPERTY_ID=3DP.ID)" : "select * from " + itemTable - + " P where P.I_CLASS=3D2 and P.P_MULTIVALUED=3D? and NOT EXISTS(= select * from " + valueTable + " V " - + "where V.PROPERTY_ID=3DP.ID)", new String[]{DBConstants.COLUMN_= ID, DBConstants.COLUMN_PARENTID, - DBConstants.COLUMN_NAME}, + String statement =3D + singleDatabase ? "select * from " + itemTable + " P where P.CONTA= INER_NAME=3D'" + + jdbcDataContainer.containerConfig.containerName + "' and P.I= _CLASS=3D2" + + " and P.P_MULTIVALUED=3D? and NOT EXISTS( select * from " + = valueTable + " V where V.PROPERTY_ID=3DP.ID)" + : "select * from " + itemTable + + " P where P.I_CLASS=3D2 and P.P_MULTIVALUED=3D? and NOT E= XISTS( select * from " + valueTable + " V " + + "where V.PROPERTY_ID=3DP.ID)"; + + if (jdbcDataContainer.containerConfig.dbDialect.equalsIgnoreCase(DBC= onstants.DB_DIALECT_PGSQL)) + { + statement =3D statement.replace("?", "'f'"); + } + else if (jdbcDataContainer.containerConfig.dbDialect.equalsIgnoreCas= e(DBConstants.DB_DIALECT_HSQLDB)) + { + statement =3D statement.replace("?", "FALSE"); + } + else + { + statement =3D statement.replace("?", "0"); + } + + itemsInspectionQuery.add(new InspectionQuery(statement, new String[]= {DBConstants.COLUMN_ID, + DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME}, "A node that has a single valued properties with nothing declared= in the VALUE table.", new PropertyRemover( jdbcDataContainer.getConnectionFactory(), nodeTypeManager))); = @@ -535,7 +550,6 @@ jdbcDataContainer.containerConfig.containerName, jdbcDataConta= iner.containerConfig.dbStructureType.isMultiDatabase()))); = // The differences in the queries by DB dialect. - String statement; if (jdbcDataContainer.containerConfig.dbDialect.equalsIgnoreCase(DBC= onstants.DB_DIALECT_SYBASE)) { statement =3D --===============5793751390330507618==--