incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1044644 [1/3] - in /incubator/lcf/branches/release-0.1-branch: ./ framework/core/src/main/java/org/apache/manifoldcf/core/database/ framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ framework/pull-agent/src/main/java/org/...
Date Sat, 11 Dec 2010 12:43:01 GMT
Author: kwright
Date: Sat Dec 11 12:43:00 2010
New Revision: 1044644

URL: http://svn.apache.org/viewvc?rev=1044644&view=rev
Log:
Pull up removal of quoteSQLString from trunk

Modified:
    incubator/lcf/branches/release-0.1-branch/   (props changed)
    incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/BaseTable.java
    incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
    incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
    incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
    incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
    incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IDBInterface.java
    incubator/lcf/branches/release-0.1-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/HopCount.java
    incubator/lcf/branches/release-0.1-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/IntrinsicLink.java
    incubator/lcf/branches/release-0.1-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
    incubator/lcf/branches/release-0.1-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobQueue.java
    incubator/lcf/branches/release-0.1-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java

Propchange: incubator/lcf/branches/release-0.1-branch/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Dec 11 12:43:00 2010
@@ -1 +1 @@
-/incubator/lcf/trunk:1039159,1041674,1041679,1041763,1041885,1041968,1042383,1042836-1042837,1042896,1042898,1043728,1044276,1044287,1044294
+/incubator/lcf/trunk:1039159,1041674,1041679,1041763,1041885,1041968,1042383,1042836-1042837,1042896,1042898,1043728,1044276,1044287,1044294,1044641

Modified: incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/BaseTable.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/BaseTable.java?rev=1044644&r1=1044643&r2=1044644&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/BaseTable.java
(original)
+++ incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/BaseTable.java
Sat Dec 11 12:43:00 2010
@@ -347,28 +347,6 @@ public class BaseTable
     return dbInterface.constructDistinctOnClause(outputParameters,baseQuery,baseParameters,distinctFields,otherFields);
   }
 
-  /** Quote a sql string.
-  * This method quotes a sql string in the proper manner for the database in question.
-  *@param string is the input string.
-  *@return the properly quoted (and escaped) output string.
-  */
-  protected String quoteSQLString(String string)
-  {
-    return dbInterface.quoteSQLString(string);
-  }
-
-  /** Prepare a sql date for use in a query.
-  * This method prepares a query constant using the sql date string passed in.
-  * The date passed in is presumed to be in "standard form", or something that might have
-  * come back from a resultset of a query.
-  *@param date is the date in standard form.
-  *@return the sql date expression to use for date comparisons.
-  */
-  protected String prepareSQLDate(String date)
-  {
-    return dbInterface.prepareSQLDate(date);
-  }
-
   /** Obtain the maximum number of individual items that should be
   * present in an IN clause.  Exceeding this amount will potentially cause the query performance
   * to drop.

Modified: incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java?rev=1044644&r1=1044643&r2=1044644&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
(original)
+++ incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
Sat Dec 11 12:43:00 2010
@@ -954,41 +954,6 @@ public class DBInterfaceDerby extends Da
     return sb.toString();
   }
 
-  /** Quote a sql string.
-  * This method quotes a sql string in the proper manner for the database in question.
-  *@param string is the input string.
-  *@return the properly quoted (and escaped) output string.
-  */
-  public String quoteSQLString(String string)
-  {
-    StringBuffer rval = new StringBuffer();
-    char quoteChar = '\'';
-    rval.append(quoteChar);
-    int i = 0;
-    while (i < string.length())
-    {
-      char x = string.charAt(i++);
-      if (x == quoteChar)
-        rval.append(quoteChar);
-      rval.append(x);
-    }
-    rval.append(quoteChar);
-    return rval.toString();
-  }
-
-  /** Prepare a sql date for use in a query.
-  * This method prepares a query constant using the sql date string passed in.
-  * The date passed in is presumed to be in "standard form", or something that might have
-  * come back from a resultset of a query.
-  *@param date is the date in standard form.
-  *@return the sql date expression to use for date comparisons.
-  */
-  public String prepareSQLDate(String date)
-  {
-    // MHL
-    return null;
-  }
-
   /** Obtain the maximum number of individual items that should be
   * present in an IN clause.  Exceeding this amount will potentially cause the query performance
   * to drop.

Modified: incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java?rev=1044644&r1=1044643&r2=1044644&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
(original)
+++ incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
Sat Dec 11 12:43:00 2010
@@ -524,28 +524,6 @@ public class DBInterfaceHSQLDB extends D
   public void createUserAndDatabase(String adminUserName, String adminPassword, StringSet
invalidateKeys)
     throws ManifoldCFException
   {
-    /*
-    // Database name is already fully expanded, so we don't need to do it again.
-    // Create a connection to the master database, using the credentials supplied
-    Database masterDatabase = new Database(context,_url+databaseName,_driver,databaseName,adminUserName,adminPassword);
-    try
-    {
-      // Create user
-      ArrayList params = new ArrayList();
-      params.add(userName);
-      IResultSet set = masterDatabase.executeQuery("SELECT * FROM INFORMATION_SCHEMA.SYSTEM_USERS
WHERE USER_NAME=?",params,null,null,null,true,-1,null,null);
-      if (set.getRowCount() == 0)
-      {
-	masterDatabase.executeQuery("CREATE USER \""+userName+"\" PASSWORD "+
-	  quoteSQLString(password),null,null,invalidateKeys,null,false,0,null,null);
-      }
-      
-    }
-    catch (ManifoldCFException e)
-    {
-      throw reinterpretException(e);
-    }
-    */
   }
 
   /** Drop user and database.
@@ -860,7 +838,7 @@ public class DBInterfaceHSQLDB extends D
   */
   public String constructRegexpClause(String column, String regularExpression, boolean caseInsensitive)
   {
-    return "REGEXP_MATCHES("+column+","+quoteSQLString(regularExpression)+")";
+    return "REGEXP_MATCHES("+column+","+regularExpression+")";
   }
 
   /** Construct a regular-expression substring clause.
@@ -948,41 +926,6 @@ public class DBInterfaceHSQLDB extends D
     return sb.toString();
   }
 
-  /** Quote a sql string.
-  * This method quotes a sql string in the proper manner for the database in question.
-  *@param string is the input string.
-  *@return the properly quoted (and escaped) output string.
-  */
-  public String quoteSQLString(String string)
-  {
-    StringBuffer rval = new StringBuffer();
-    char quoteChar = '\'';
-    rval.append(quoteChar);
-    int i = 0;
-    while (i < string.length())
-    {
-      char x = string.charAt(i++);
-      if (x == quoteChar)
-        rval.append(quoteChar);
-      rval.append(x);
-    }
-    rval.append(quoteChar);
-    return rval.toString();
-  }
-
-  /** Prepare a sql date for use in a query.
-  * This method prepares a query constant using the sql date string passed in.
-  * The date passed in is presumed to be in "standard form", or something that might have
-  * come back from a resultset of a query.
-  *@param date is the date in standard form.
-  *@return the sql date expression to use for date comparisons.
-  */
-  public String prepareSQLDate(String date)
-  {
-    // MHL
-    return null;
-  }
-
   /** Obtain the maximum number of individual items that should be
   * present in an IN clause.  Exceeding this amount will potentially cause the query performance
   * to drop.

Modified: incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java?rev=1044644&r1=1044643&r2=1044644&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
(original)
+++ incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
Sat Dec 11 12:43:00 2010
@@ -387,14 +387,18 @@ public class DBInterfaceMySQL extends Da
   {
     // Connect to super database
     Database masterDatabase = new Database(context,_url+"mysql",_driver,"mysql",adminUserName,adminPassword);
-    masterDatabase.executeQuery("CREATE DATABASE "+databaseName+" CHARACTER SET "+
-      quoteSQLString("utf8"),null,null,invalidateKeys,null,false,0,null,null);
+    ArrayList list = new ArrayList();
+    list.add("utf8");
+    masterDatabase.executeQuery("CREATE DATABASE "+databaseName+" CHARACTER SET ?",list,
+      null,invalidateKeys,null,false,0,null,null);
     if (userName != null)
     {
-      masterDatabase.executeQuery("GRANT ALL ON "+databaseName+".* TO "+
-        quoteSQLString(userName)+"@"+
-        quoteSQLString("localhost")+" IDENTIFIED BY "+
-        quoteSQLString(password),null,null,invalidateKeys,null,false,0,null,null);
+      list.clear();
+      list.add(userName);
+      list.add("localhost");
+      list.add(password);
+      masterDatabase.executeQuery("GRANT ALL ON "+databaseName+".* TO ?@? IDENTIFIED BY ?",list,
+        null,invalidateKeys,null,false,0,null,null);
     }
   }
 
@@ -560,7 +564,7 @@ public class DBInterfaceMySQL extends Da
   public String constructSubstringClause(String column, String regularExpression, boolean
caseInsensitive)
   {
     // MHL for mysql
-    return quoteSQLString("");
+    return regularExpression;
   }
 
   /** Construct an offset/limit clause.
@@ -619,41 +623,6 @@ public class DBInterfaceMySQL extends Da
     return sb.toString();
   }
 
-  /** Quote a sql string.
-  * This method quotes a sql string in the proper manner for the database in question.
-  *@param string is the input string.
-  *@return the properly quoted (and escaped) output string.
-  */
-  public String quoteSQLString(String string)
-  {
-    StringBuffer rval = new StringBuffer();
-    char quoteChar = '\'';
-    rval.append(quoteChar);
-    int i = 0;
-    while (i < string.length())
-    {
-      char x = string.charAt(i++);
-      if (x == quoteChar)
-        rval.append(quoteChar);
-      rval.append(x);
-    }
-    rval.append(quoteChar);
-    return rval.toString();
-  }
-
-  /** Prepare a sql date for use in a query.
-  * This method prepares a query constant using the sql date string passed in.
-  * The date passed in is presumed to be in "standard form", or something that might have
-  * come back from a resultset of a query.
-  *@param date is the date in standard form.
-  *@return the sql date expression to use for date comparisons.
-  */
-  public String prepareSQLDate(String date)
-  {
-    // MHL
-    return null;
-  }
-
   /** Obtain the maximum number of individual items that should be
   * present in an IN clause.  Exceeding this amount will potentially cause the query performance
   * to drop.

Modified: incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java?rev=1044644&r1=1044643&r2=1044644&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
(original)
+++ incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
Sat Dec 11 12:43:00 2010
@@ -514,21 +514,27 @@ public class DBInterfacePostgreSQL exten
       // Create user
       ArrayList params = new ArrayList();
       params.add(userName);
-      IResultSet set = masterDatabase.executeQuery("SELECT * FROM pg_user WHERE usename=?",params,null,null,null,true,-1,null,null);
+      IResultSet set = masterDatabase.executeQuery("SELECT * FROM pg_user WHERE usename=?",params,
+        null,null,null,true,-1,null,null);
       if (set.getRowCount() == 0)
       {
-	masterDatabase.executeQuery("CREATE USER "+userName+" PASSWORD "+
-	  quoteSQLString(password),null,null,invalidateKeys,null,false,0,null,null);
+        params.clear();
+        params.add(password);
+	masterDatabase.executeQuery("CREATE USER "+userName+" PASSWORD ?",params,
+          null,invalidateKeys,null,false,0,null,null);
       }
       
       // Create database
-      params = new ArrayList();
+      params.clear();
       params.add(databaseName);
-      set = masterDatabase.executeQuery("SELECT * FROM pg_database WHERE datname=?",params,null,null,null,true,-1,null,null);
+      set = masterDatabase.executeQuery("SELECT * FROM pg_database WHERE datname=?",params,
+        null,null,null,true,-1,null,null);
       if (set.getRowCount() == 0)
       {
+        params.clear();
+        params.add("utf8");
 	masterDatabase.executeQuery("CREATE DATABASE "+databaseName+" OWNER="+
-	  userName+" ENCODING="+quoteSQLString("utf8"),null,null,invalidateKeys,null,false,0,null,null);
+	  userName+" ENCODING=?",params,null,invalidateKeys,null,false,0,null,null);
       }
     }
     catch (ManifoldCFException e)
@@ -624,6 +630,7 @@ public class DBInterfacePostgreSQL exten
     throws ManifoldCFException
   {
     StringBuffer query = new StringBuffer();
+    ArrayList list = new ArrayList();
     query.append("SELECT pg_attribute.attname AS \"Field\",");
     query.append("CASE pg_type.typname WHEN 'int2' THEN 'smallint' WHEN 'int4' THEN 'int'");
     query.append(" WHEN 'int8' THEN 'bigint' WHEN 'varchar' THEN 'varchar(' || pg_attribute.atttypmod-4
|| ')'");
@@ -634,10 +641,11 @@ public class DBInterfacePostgreSQL exten
     query.append("CASE pg_type.typname WHEN 'varchar' THEN substring(pg_attrdef.adsrc from
'^(.*).*$') ELSE pg_attrdef.adsrc END AS Default ");
     query.append("FROM pg_class INNER JOIN pg_attribute ON (pg_class.oid=pg_attribute.attrelid)
INNER JOIN pg_type ON (pg_attribute.atttypid=pg_type.oid) ");
     query.append("LEFT JOIN pg_attrdef ON (pg_class.oid=pg_attrdef.adrelid AND pg_attribute.attnum=pg_attrdef.adnum)
");
-    query.append("WHERE pg_class.relname=").append(quoteSQLString(tableName)).append(" AND
pg_attribute.attnum>=1 AND NOT pg_attribute.attisdropped ");
+    query.append("WHERE pg_class.relname=? AND pg_attribute.attnum>=1 AND NOT pg_attribute.attisdropped
");
     query.append("ORDER BY pg_attribute.attnum");
+    list.add(tableName);
 
-    IResultSet set = performQuery(query.toString(),null,cacheKeys,queryClass);
+    IResultSet set = performQuery(query.toString(),list,cacheKeys,queryClass);
     if (set.getRowCount() == 0)
       return null;
     // Digest the result
@@ -669,9 +677,11 @@ public class DBInterfacePostgreSQL exten
 
     String query = "SELECT pg_catalog.pg_get_indexdef(i.indexrelid, 0, true) AS indexdef
"+
       "FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i "+
-      "WHERE c.relname = '"+tableName+"' AND c.oid = i.indrelid AND i.indexrelid = c2.oid";
-
-    IResultSet result = performQuery(query,null,cacheKeys,queryClass);
+      "WHERE c.relname = ? AND c.oid = i.indrelid AND i.indexrelid = c2.oid";
+    ArrayList list = new ArrayList();
+    list.add(tableName);
+    
+    IResultSet result = performQuery(query,list,cacheKeys,queryClass);
     int i = 0;
     while (i < result.getRowCount())
     {
@@ -929,41 +939,6 @@ public class DBInterfacePostgreSQL exten
     return sb.toString();
   }
 
-  /** Quote a sql string.
-  * This method quotes a sql string in the proper manner for the database in question.
-  *@param string is the input string.
-  *@return the properly quoted (and escaped) output string.
-  */
-  public String quoteSQLString(String string)
-  {
-    StringBuffer rval = new StringBuffer();
-    char quoteChar = '\'';
-    rval.append(quoteChar);
-    int i = 0;
-    while (i < string.length())
-    {
-      char x = string.charAt(i++);
-      if (x == quoteChar)
-        rval.append(quoteChar);
-      rval.append(x);
-    }
-    rval.append(quoteChar);
-    return rval.toString();
-  }
-
-  /** Prepare a sql date for use in a query.
-  * This method prepares a query constant using the sql date string passed in.
-  * The date passed in is presumed to be in "standard form", or something that might have
-  * come back from a resultset of a query.
-  *@param date is the date in standard form.
-  *@return the sql date expression to use for date comparisons.
-  */
-  public String prepareSQLDate(String date)
-  {
-    // MHL
-    return null;
-  }
-
   /** Obtain the maximum number of individual items that should be
   * present in an IN clause.  Exceeding this amount will potentially cause the query performance
   * to drop.

Modified: incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IDBInterface.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IDBInterface.java?rev=1044644&r1=1044643&r2=1044644&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IDBInterface.java
(original)
+++ incubator/lcf/branches/release-0.1-branch/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IDBInterface.java
Sat Dec 11 12:43:00 2010
@@ -297,22 +297,6 @@ public interface IDBInterface
   */
   public String constructDistinctOnClause(ArrayList outputParameters, String baseQuery, ArrayList
baseParameters, String[] distinctFields, Map otherFields);
   
-  /** Quote a sql string.
-  * This method quotes a sql string in the proper manner for the database in question.
-  *@param string is the input string.
-  *@return the properly quoted (and escaped) output string.
-  */
-  public String quoteSQLString(String string);
-
-  /** Prepare a sql date for use in a query.
-  * This method prepares a query constant using the sql date string passed in.
-  * The date passed in is presumed to be in "standard form", or something that might have
-  * come back from a resultset of a query.
-  *@param date is the date in standard form.
-  *@return the sql date expression to use for date comparisons.
-  */
-  public String prepareSQLDate(String date);
-
   /** Obtain the maximum number of individual items that should be
   * present in an IN clause.  Exceeding this amount will potentially cause the query performance
   * to drop.

Modified: incubator/lcf/branches/release-0.1-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/HopCount.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.1-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/HopCount.java?rev=1044644&r1=1044643&r2=1044644&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.1-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/HopCount.java
(original)
+++ incubator/lcf/branches/release-0.1-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/HopCount.java
Sat Dec 11 12:43:00 2010
@@ -510,7 +510,9 @@ public class HopCount extends org.apache
   */
   public void deleteMatchingDocuments(Long jobID, String[] legalLinkTypes,
     String sourceTableName,
-    String sourceTableIDColumn, String sourceTableJobColumn, String sourceTableCriteria,
int hopcountMethod)
+    String sourceTableIDColumn, String sourceTableJobColumn,
+    String sourceTableCriteria, ArrayList sourceTableParams,
+    int hopcountMethod)
     throws ManifoldCFException
   {
     // This should work similarly to deleteDocumentIdentifiers() except that the identifiers
@@ -523,7 +525,7 @@ public class HopCount extends org.apache
       {
         doDeleteInvalidation(jobID,legalLinkTypes,false,null,sourceTableName,
           sourceTableIDColumn,sourceTableJobColumn,
-          sourceTableCriteria);
+          sourceTableCriteria,sourceTableParams);
       }
 
     }
@@ -566,7 +568,7 @@ public class HopCount extends org.apache
 
       // This also removes the links themselves...
       if (hopcountMethod == IJobDescription.HOPCOUNT_ACCURATE)
-        doDeleteInvalidation(jobID,legalLinkTypes,false,sourceDocumentHashes,null,null,null,null);
+        doDeleteInvalidation(jobID,legalLinkTypes,false,sourceDocumentHashes,null,null,null,null,null);
 
     }
     catch (ManifoldCFException e)
@@ -1024,7 +1026,7 @@ public class HopCount extends org.apache
 
 
         // Invalidate all links with the given source documents that match the common expression
-        doDeleteInvalidation(jobID,legalLinkTypes,true,sourceDocumentHashes,null,null,null,null);
+        doDeleteInvalidation(jobID,legalLinkTypes,true,sourceDocumentHashes,null,null,null,null,null);
       }
       // Make all new and existing links become just "base" again.
       intrinsicLinkManager.restoreLinks(jobID,sourceDocumentHashes);
@@ -1052,13 +1054,19 @@ public class HopCount extends org.apache
   * still connected to the root. */
   protected void doDeleteInvalidation(Long jobID, String[] legalLinkTypes, boolean existingOnly,
     String[] sourceDocumentHashes, String sourceTableName,
-    String sourceTableIDColumn, String sourceTableJobColumn, String sourceTableCriteria)
+    String sourceTableIDColumn, String sourceTableJobColumn,
+    String sourceTableCriteria, ArrayList sourceTableParams)
     throws ManifoldCFException
   {
 
     String commonNewExpression = null;
+    ArrayList commonNewList = null;
     if (existingOnly)
-      commonNewExpression = intrinsicLinkManager.newField+"="+quoteSQLString(intrinsicLinkManager.statusToString(intrinsicLinkManager.LINKSTATUS_BASE));
+    {
+      commonNewList = new ArrayList();
+      commonNewList.add(intrinsicLinkManager.statusToString(intrinsicLinkManager.LINKSTATUS_BASE));
+      commonNewExpression = intrinsicLinkManager.newField+"=?";
+    }
 
     // Clear up hopcount table
     if (sourceDocumentHashes == null || sourceDocumentHashes.length > 0)
@@ -1112,7 +1120,7 @@ public class HopCount extends org.apache
         {
           if (k == maxClause)
           {
-            markForDelete(sb.toString(),list,commonNewExpression);
+            markForDelete(sb.toString(),list,commonNewExpression,commonNewList);
             sb.setLength(0);
             list.clear();
             k = 0;
@@ -1128,7 +1136,7 @@ public class HopCount extends org.apache
           k++;
         }
         if (k > 0)
-          markForDelete(sb.toString(),list,commonNewExpression);
+          markForDelete(sb.toString(),list,commonNewExpression,commonNewList);
         noteModifications(0,sourceDocumentHashes.length,0);
       }
       else
@@ -1146,6 +1154,7 @@ public class HopCount extends org.apache
         list.add(jobID);
         list.add(jobID);
         list.add(jobID);
+        list.addAll(sourceTableParams);
         sb.append(idField).append(" IN(SELECT t0.").append(deleteDepsManager.ownerIDField).append("
FROM ")
           .append(deleteDepsManager.getTableName()).append(" t0,").append(sourceTableName).append(",")
           .append(intrinsicLinkManager.getTableName()).append(" t1 WHERE ")
@@ -1173,9 +1182,12 @@ public class HopCount extends org.apache
         Logging.hopcount.debug("Done setting hopcount rows for job "+jobID+" to initial distances");
 
       // Remove the intrinsic links that we said we would - BEFORE we evaluate the queue.
-      intrinsicLinkManager.removeLinks(jobID,commonNewExpression,sourceDocumentHashes,
-        sourceTableName,sourceTableIDColumn,sourceTableJobColumn,
-        sourceTableCriteria);
+      intrinsicLinkManager.removeLinks(jobID,
+        commonNewExpression,commonNewList,
+        sourceDocumentHashes,
+        sourceTableName,
+        sourceTableIDColumn,sourceTableJobColumn,
+        sourceTableCriteria,sourceTableParams);
 
       // Remove the delete dependencies of the nodes marked as being queued, with distance
infinity.
       ArrayList queryList = new ArrayList();
@@ -1200,9 +1212,11 @@ public class HopCount extends org.apache
 
   }
 
-  protected void markForDelete(String query, ArrayList list, String commonNewExpression)
+  protected void markForDelete(String query, ArrayList list, String commonNewExpression,
ArrayList commonNewList)
     throws ManifoldCFException
   {
+    ArrayList thisList = new ArrayList();
+    thisList.addAll(list);
     StringBuffer sb = new StringBuffer("WHERE ");
     sb.append(idField).append(" IN(SELECT ").append(deleteDepsManager.ownerIDField).append("
FROM ")
       .append(deleteDepsManager.getTableName()).append(" t0 WHERE (").append(query).append(")
AND EXISTS(SELECT 'x' FROM ")
@@ -1214,14 +1228,17 @@ public class HopCount extends org.apache
       .append(deleteDepsManager.parentIDHashField).append(" AND t1.").append(intrinsicLinkManager.childIDHashField)
       .append("=t0.").append(deleteDepsManager.childIDHashField);
     if (commonNewExpression != null)
+    {
       sb.append(" AND t1.").append(commonNewExpression);
+      thisList.addAll(commonNewList);
+    }
     sb.append("))");
 
     HashMap map = new HashMap();
     // These are whacked back to "infinity" to avoid infinite looping in a cut-off graph.
     map.put(distanceField,new Long(-1L));
     map.put(markForDeathField,markToString(MARK_DELETING));
-    performUpdate(map,sb.toString(),list,null);
+    performUpdate(map,sb.toString(),thisList,null);
   }
 
   /** Get document's children.

Modified: incubator/lcf/branches/release-0.1-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/IntrinsicLink.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.1-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/IntrinsicLink.java?rev=1044644&r1=1044643&r2=1044644&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.1-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/IntrinsicLink.java
(original)
+++ incubator/lcf/branches/release-0.1-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/IntrinsicLink.java
Sat Dec 11 12:43:00 2010
@@ -306,9 +306,12 @@ public class IntrinsicLink extends org.a
   /** Remove all target links of the specified source documents that are not marked as "new"
or "existing", and
   * return the others to their base state.
   */
-  public void removeLinks(Long jobID, String commonNewExpression, String[] sourceDocumentIDHashes,
+  public void removeLinks(Long jobID,
+    String commonNewExpression, ArrayList commonNewParams,
+    String[] sourceDocumentIDHashes,
     String sourceTableName,
-    String sourceTableIDColumn, String sourceTableJobColumn, String sourceTableCriteria)
+    String sourceTableIDColumn, String sourceTableJobColumn,
+    String sourceTableCriteria, ArrayList sourceTableParams)
     throws ManifoldCFException
   {
     beginTransaction();
@@ -325,7 +328,7 @@ public class IntrinsicLink extends org.a
         {
           if (k == maxClause)
           {
-            performRemoveLinks(sb.toString(),list,commonNewExpression);
+            performRemoveLinks(sb.toString(),list,commonNewExpression,commonNewParams);
             sb.setLength(0);
             list.clear();
             k = 0;
@@ -341,13 +344,14 @@ public class IntrinsicLink extends org.a
         }
 
         if (k > 0)
-          performRemoveLinks(sb.toString(),list,commonNewExpression);
+          performRemoveLinks(sb.toString(),list,commonNewExpression,commonNewParams);
         noteModifications(0,0,sourceDocumentIDHashes.length);
       }
       else
       {
         ArrayList list = new ArrayList();
         list.add(jobID);
+        list.addAll(sourceTableParams);
         StringBuffer sb = new StringBuffer("WHERE EXISTS(SELECT 'x' FROM ");
         sb.append(sourceTableName).append(" WHERE ").append(sourceTableJobColumn).append("=?
AND ")
           .append(sourceTableIDColumn).append("=").append(getTableName()).append(".").append(childIDHashField)
@@ -373,14 +377,20 @@ public class IntrinsicLink extends org.a
 
   }
 
-  protected void performRemoveLinks(String query, ArrayList list, String commonNewExpression)
+  protected void performRemoveLinks(String query, ArrayList list, String commonNewExpression,
+    ArrayList commonNewParams)
     throws ManifoldCFException
   {
+    ArrayList thisList = new ArrayList();
+    thisList.addAll(list);
     StringBuffer sb = new StringBuffer("WHERE (");
     sb.append(query).append(")");
     if (commonNewExpression != null)
+    {
+      thisList.addAll(commonNewParams);
       sb.append(" AND ").append(commonNewExpression);
-    performDelete(sb.toString(),list,null);
+    }
+    performDelete(sb.toString(),thisList,null);
   }
 
   /** Return all target links of the specified source documents to their base state.



Mime
View raw message