[Ils-source] r1402 - trunk/webapp

scribe at crosswire.org scribe at crosswire.org
Wed Mar 2 10:45:37 MST 2016


Author: scribe
Date: 2016-03-02 10:45:37 -0700 (Wed, 02 Mar 2016)
New Revision: 1402

Modified:
   trunk/webapp/SQL.jsp
Log:
Added output levels to show dups and summaries


Modified: trunk/webapp/SQL.jsp
===================================================================
--- trunk/webapp/SQL.jsp	2016-02-29 23:30:08 UTC (rev 1401)
+++ trunk/webapp/SQL.jsp	2016-03-02 17:45:37 UTC (rev 1402)
@@ -225,6 +225,9 @@
         importDupCheck = replaceSessionTags(session, importDupCheck);
       }
       int retVal = 0;
+	int goodCount = 0;
+	int badCount = 0;
+	int skipCount = 0;
 	for (boolean more = fin.begin(); more; more = fin.next()) {
 		retVal++;
 		String colVals = "";
@@ -281,23 +284,31 @@
 		Object dummy = null;
 		for (; ((useVerseKey && myKey.getHashNumber() <= loopEnd && myKey.popError()==0) || (!useVerseKey && loopStart <= loopEnd)); myKey.increment(),loopStart = (useVerseKey)? myKey.getHashNumber() : loopStart + 1) {
 			if (loopEnd != -1) fields.set(0, loopValues != null ? loopValues.get(loopStart) : Integer.toString(loopStart));
-		      boolean execute = true;
-		      if (importDupCheck != null) {
-		          MessageFormat format = new MessageFormat(importDupCheck);
-		          String dcSQL = format.format(fields.toArray());
-				  execute = (runSQL(dcSQL, linkColumn, num, i + 1, null) == 0);
-		      }
-	          if (execute) {
+			boolean execute = true;
+			String dcSQL = null;
+			if (importDupCheck != null) {
+				MessageFormat format = new MessageFormat(importDupCheck);
+				dcSQL = format.format(fields.toArray());
+				execute = (runSQL(dcSQL, linkColumn, num, i + 1, null) == 0);
+			}
+			if (execute) {
 				String rSQL = specialFunctions(insertSQL, fields.toArray());
 				MessageFormat format = new MessageFormat(rSQL);
 				rSQL  = format.format(fields.toArray());
-				runSQL(rSQL, linkColumn, num, i + 1, out);
-	          }
+				int result = runSQL(rSQL, linkColumn, num, i + 1, out);
+				if (result > 0) ++goodCount;
+				else ++badCount;
+			}
+			else {
+				if (outputLevel >= 2) out.write("<table border=\"1\"> <tr> <th>Duplicate entry determined from SQL: </th> <td>" + dcSQL + "</td> </tr></table>");
+				++skipCount;
+			}
 		}
 		if (error != 0) {
 			out.write("<h2>ERROR: Verse Out Of Bounds: "+loopEnd+"</h2><p>" + insertSQL + "</p>");
 		}
 	}
+	if (outputLevel >= 3) out.write("<table border=\"1\"> <tr> <th>Total Records</th><td>" + (goodCount + badCount + skipCount) + "</td> </tr><tr><td>Good</td><td>"+goodCount+"</td></td></tr><tr><td>Skipped</td><td>"+skipCount+"</td></td></tr><tr><td>Bad</td><td>"+badCount+"</td></td></tr></table>");
   }
   catch (Exception e) { e.printStackTrace(); }
 
@@ -314,7 +325,7 @@
     }
     try {
 		int rows = importSQL(sourceSQL, iSQL, importDupCheck, out, outputLevel, ignoreException);
-		if (outputLevel >= 1) out.println("<h3>Total Records: " + rows + "</h3>");
+		if (outputLevel >= 3) out.println("<h3>Total Records: " + rows + "</h3>");
     }
     catch (Exception e) { e.printStackTrace(); }
 
@@ -337,7 +348,7 @@
     }
     try {
 		int rows = import2LSQL(sourceSQL, source2SQL, iSQL, importDupCheck, out, outputLevel, ignoreException);
-		if (outputLevel >= 1) out.println("<h3>Total Records: " + rows + "</h3>");
+		if (outputLevel >= 3) out.println("<h3>Total Records: " + rows + "</h3>");
     }
     catch (Exception e) { e.printStackTrace(); }
 




More information about the Ils-source mailing list