mpoeschl 2002/11/27 03:31:00
Modified: src/java/org/apache/torque/task PackageAsPathTask.java
TorqueDataModelTask.java TorqueDataSQLTask.java
TorqueDocumentationTask.java
TorqueJDBCTransformTask.java TorqueSQLExec.java
TorqueSQLTask.java TorqueSQLTransformTask.java
src/java/org/apache/torque/util Criteria.java
LargeSelect.java Query.java SqlExpression.java
Log:
o javadocs
o checkstyle fixes
Revision Changes Path
1.3 +59 -5
jakarta-turbine-torque/src/java/org/apache/torque/task/PackageAsPathTask.java
Index: PackageAsPathTask.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/PackageAsPathTask.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PackageAsPathTask.java 14 Aug 2002 12:09:48 -0000 1.2
+++ PackageAsPathTask.java 27 Nov 2002 11:30:59 -0000 1.3
@@ -1,11 +1,65 @@
package org.apache.torque.task;
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Turbine", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
import org.apache.tools.ant.Task;
import org.apache.velocity.util.StringUtils;
/**
* Simple task to convert packages to paths.
- *
+ *
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen Haberman</a>
* @version $Id$
*/
@@ -19,12 +73,13 @@
protected String name;
/**
- * Executes the package to patch converstion and stores it
+ * Executes the package to patch converstion and stores it
* in the user property <code>value</code>.
*/
public void execute()
{
- super.getProject().setUserProperty(this.name,
StringUtils.getPackageAsPath(this.pckg));
+ super.getProject().setUserProperty(this.name,
+ StringUtils.getPackageAsPath(this.pckg));
}
/**
@@ -42,5 +97,4 @@
{
this.name = name;
}
-
}
1.22 +9 -10
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDataModelTask.java
Index: TorqueDataModelTask.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDataModelTask.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- TorqueDataModelTask.java 28 Sep 2002 01:18:51 -0000 1.21
+++ TorqueDataModelTask.java 27 Nov 2002 11:30:59 -0000 1.22
@@ -299,17 +299,16 @@
if (xmlFile == null && filesets.isEmpty())
{
- throw new BuildException("You must specify an XML schema or " +
- "fileset of XML schemas!");
+ throw new BuildException("You must specify an XML schema or "
+ + "fileset of XML schemas!");
}
if (xmlFile != null)
{
// Transform the XML database schema into
// data model object.
- xmlParser =
- new XmlToAppData(getTargetDatabase(), getTargetPackage(),
- getBasePathToDbProps());
+ xmlParser = new XmlToAppData(getTargetDatabase(),
+ getTargetPackage(), getBasePathToDbProps());
AppData ad = xmlParser.parseFile(xmlFile);
ad.setName(grokName(xmlFile));
dataModels.add(ad);
@@ -330,7 +329,7 @@
{
File f = new File(srcDir, dataModelFiles[j]);
xmlParser = new XmlToAppData(getTargetDatabase(),
- getTargetPackage(),
+ getTargetPackage(),
getBasePathToDbProps());
AppData ad = xmlParser.parseFile(f.toString());
ad.setName(grokName(f.toString()));
@@ -397,7 +396,7 @@
}
return name;
}
-
+
/**
* Override Texen's context properties to map the
* torque.xxx properties (including defaults set by the
@@ -413,10 +412,10 @@
public void setContextProperties(String file)
{
super.setContextProperties(file);
-
+
// Map the torque.xxx elements from the env to the contextProperties
Hashtable env = super.getProject().getProperties();
- for (Iterator i = env.keySet().iterator(); i.hasNext(); )
+ for (Iterator i = env.keySet().iterator(); i.hasNext();)
{
String key = (String) i.next();
if (key.startsWith("torque."))
@@ -434,5 +433,5 @@
contextProperties.setProperty(newKey, env.get(key));
}
}
- }
+ }
}
1.11 +4 -2
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDataSQLTask.java
Index: TorqueDataSQLTask.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDataSQLTask.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- TorqueDataSQLTask.java 29 Apr 2002 19:47:46 -0000 1.10
+++ TorqueDataSQLTask.java 27 Nov 2002 11:30:59 -0000 1.11
@@ -73,7 +73,9 @@
*/
public class TorqueDataSQLTask extends TorqueDataModelTask
{
+ /** the XML data file */
private String dataXmlFile;
+ /** the data dtd file */
private String dataDTD;
/**
@@ -147,7 +149,7 @@
* Set up the initialial context for generating the SQL from the XML schema.
*
* @return the context
- * @throws Exception
+ * @throws Exception If there is an error parsing the data xml.
*/
public Context initControlContext() throws Exception
{
1.6 +2 -2
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDocumentationTask.java
Index: TorqueDocumentationTask.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDocumentationTask.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TorqueDocumentationTask.java 29 Oct 2002 09:55:53 -0000 1.5
+++ TorqueDocumentationTask.java 27 Nov 2002 11:30:59 -0000 1.6
@@ -91,7 +91,7 @@
* Place our target package value into the context for use in the templates.
*
* @return the context
- * @throws Exception
+ * @throws Exception a generic exception
*/
public Context initControlContext() throws Exception
{
1.14 +15 -21
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueJDBCTransformTask.java
Index: TorqueJDBCTransformTask.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueJDBCTransformTask.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- TorqueJDBCTransformTask.java 27 Nov 2002 09:47:26 -0000 1.13
+++ TorqueJDBCTransformTask.java 27 Nov 2002 11:30:59 -0000 1.14
@@ -121,7 +121,7 @@
protected boolean sameJavaName;
- XMLSerializer xmlSerializer;
+ private XMLSerializer xmlSerializer;
public String getDbSchema()
{
@@ -184,18 +184,19 @@
log("schema : " + dbSchema);
DocumentTypeImpl docType = new DocumentTypeImpl(null, "database", null,
- "http://jakarta.apache.org/turbine/dtd/database.dtd");
+ "http://jakarta.apache.org/turbine/dtd/database.dtd");
doc = new DocumentImpl(docType);
- doc.appendChild(doc.createComment(" Autogenerated by JDBCToXMLSchema! "));
+ doc.appendChild(doc.createComment(
+ " Autogenerated by JDBCToXMLSchema! "));
try
{
generateXML();
log(xmlSchema);
xmlSerializer = new XMLSerializer(
- new PrintWriter(
- new FileOutputStream(xmlSchema)),
- new OutputFormat(Method.XML, null, true));
+ new PrintWriter(
+ new FileOutputStream(xmlSchema)),
+ new OutputFormat(Method.XML, null, true));
xmlSerializer.serialize(doc);
}
catch (Exception e)
@@ -203,7 +204,6 @@
log(e.toString());
e.printStackTrace();
}
-
log("\nTorque - JDBCToXMLSchema finished");
}
@@ -310,15 +310,13 @@
}
column.setAttribute("type", TypeMap.getTorqueType(type));
- if (size > 0 &&
- (type.intValue() == Types.CHAR ||
- type.intValue() == Types.VARCHAR ||
- type.intValue() == Types.LONGVARCHAR ||
- type.intValue() == Types.DECIMAL ||
- type.intValue() == Types.NUMERIC))
+ if (size > 0 && (type.intValue() == Types.CHAR
+ || type.intValue() == Types.VARCHAR
+ || type.intValue() == Types.LONGVARCHAR
+ || type.intValue() == Types.DECIMAL
+ || type.intValue() == Types.NUMERIC))
{
- column.setAttribute("size",
- new Integer(size).toString());
+ column.setAttribute("size", new Integer(size).toString());
}
if (nullType.intValue() == 0)
@@ -335,7 +333,6 @@
{
// trim out parens & quotes out of def value.
// makes sense for MSSQL. not sure about others.
-
if (defValue.startsWith("(") && defValue.endsWith(")"))
{
defValue = defValue.substring(1, defValue.length() - 1);
@@ -348,12 +345,11 @@
column.setAttribute("default", defValue);
}
-
table.appendChild(column);
}
// Foreign keys for this table.
- for (Iterator l = forgnKeys.iterator(); l.hasNext(); )
+ for (Iterator l = forgnKeys.iterator(); l.hasNext();)
{
Object[] forKey = (Object[]) l.next();
String foreignKeyTable = (String) forKey[0];
@@ -370,10 +366,8 @@
}
table.appendChild(fk);
}
-
databaseNode.appendChild(table);
}
-
doc.appendChild(databaseNode);
}
1.15 +19 -18
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueSQLExec.java
Index: TorqueSQLExec.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueSQLExec.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- TorqueSQLExec.java 11 Nov 2002 11:00:22 -0000 1.14
+++ TorqueSQLExec.java 27 Nov 2002 11:30:59 -0000 1.15
@@ -3,7 +3,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -18,21 +18,21 @@
* the documentation and/or other materials provided with the
* distribution.
*
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact [EMAIL PROTECTED]
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact [EMAIL PROTECTED]
*
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Turbine", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -328,7 +328,7 @@
/**
* Set the autocommit flag for the DB connection.
*
- * @param autocommit
+ * @param autocommit the autocommit flag
*/
public void setAutocommit(boolean autocommit)
{
@@ -432,8 +432,8 @@
if (sqldbmap == null || getSqlDbMap().exists() == false)
{
- throw new BuildException("You haven't provided an sqldbmap, or " +
- "the one you specified doesn't exist: " + sqldbmap);
+ throw new BuildException("You haven't provided an sqldbmap, or "
+ + "the one you specified doesn't exist: " + sqldbmap);
}
if (driver == null)
@@ -674,8 +674,8 @@
}
}
- log(goodSql + " of " + totalSql +
- " SQL statements executed successfully");
+ log(goodSql + " of " + totalSql
+ + " SQL statements executed successfully");
}
/**
@@ -806,6 +806,7 @@
*
* @param sql
* @param out
+ * @throws SQLException
*/
protected void execSQL(String sql, PrintStream out) throws SQLException
{
1.14 +17 -1
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueSQLTask.java
Index: TorqueSQLTask.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueSQLTask.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- TorqueSQLTask.java 20 Jun 2002 23:55:14 -0000 1.13
+++ TorqueSQLTask.java 27 Nov 2002 11:30:59 -0000 1.14
@@ -83,21 +83,37 @@
private String idTableXMLFile = null;
+ /**
+ *
+ * @param database
+ */
public void setDatabase(String database)
{
this.database = database;
}
+ /**
+ *
+ * @return
+ */
public String getDatabase()
{
return database;
}
+ /**
+ *
+ * @param suffix
+ */
public void setSuffix(String suffix)
{
this.suffix = suffix;
}
+ /**
+ *
+ * @return
+ */
public String getSuffix()
{
return suffix;
1.5 +23 -19
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueSQLTransformTask.java
Index: TorqueSQLTransformTask.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueSQLTransformTask.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TorqueSQLTransformTask.java 17 Apr 2002 18:23:26 -0000 1.4
+++ TorqueSQLTransformTask.java 27 Nov 2002 11:30:59 -0000 1.5
@@ -70,36 +70,38 @@
*/
public class TorqueSQLTransformTask extends Task
{
- /**
- * SQL input file.
- */
+ /** SQL input file. */
private String inputFile;
-
- /**
- * XML descriptor output file.
- */
+
+ /** XML descriptor output file. */
private String outputFile;
/**
* Get the current input file
+ *
+ * @return the input file
*/
- public String getInputFile ()
+ public String getInputFile()
{
return inputFile;
}
/**
* Set the sql input file. This file must exist
+ *
+ * @param v the input file
*/
- public void setInputFile (String v)
+ public void setInputFile(String v)
{
inputFile = v;
}
/**
* Get the current output file.
+ *
+ * @return the output file
*/
- public String getOutputFile ()
+ public String getOutputFile()
{
return outputFile;
}
@@ -108,6 +110,8 @@
* Set the current output file. If the file does not
* exist it will be created. If the file exists all
* it's contents will be replaced.
+ *
+ * @param v the output file
*/
public void setOutputFile (String v)
{
@@ -117,25 +121,25 @@
/**
* Execute the task.
*
- * @throws BuildException
+ * @throws BuildException Any exceptions caught during procssing will be
+ * rethrown wrapped into a BuildException
*/
- public void execute()
- throws BuildException
+ public void execute() throws BuildException
{
try
{
- System.out.println ("Parsing SQL Schema");
+ System.out.println("Parsing SQL Schema");
SQLToAppData sqlParser = new SQLToAppData(inputFile);
AppData app = sqlParser.execute();
- System.out.println ("Preparing to write xml schema");
- FileWriter fr = new FileWriter (outputFile);
+ System.out.println("Preparing to write xml schema");
+ FileWriter fr = new FileWriter(outputFile);
BufferedWriter br = new BufferedWriter (fr);
- br.write (app.toString());
+ br.write(app.toString());
- System.out.println ("Writing xml schema");
+ System.out.println("Writing xml schema");
br.flush();
br.close();
1.33 +10 -9
jakarta-turbine-torque/src/java/org/apache/torque/util/Criteria.java
Index: Criteria.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/util/Criteria.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- Criteria.java 14 Oct 2002 01:44:08 -0000 1.32
+++ Criteria.java 27 Nov 2002 11:31:00 -0000 1.33
@@ -193,8 +193,8 @@
private boolean useTransaction = false;
/** Log4j category used for logging. */
- private static Category category =
- Category.getInstance(Criteria.class.getName());
+ private static Category category
+ = Category.getInstance(Criteria.class.getName());
/**
* Creates a new instance with the default capacity.
@@ -395,7 +395,7 @@
* be done with the useTransaction() method.
*/
public boolean containsObjectColumn(String databaseMapName)
- throws TorqueException
+ throws TorqueException
{
// Peer or application may have noted the existence of a blob
// so we can save the lookup.
@@ -406,7 +406,7 @@
DatabaseMap map = Torque.getDatabaseMap(databaseMapName);
StringStack tables = new StringStack();
- for (Iterator it = super.values().iterator(); it.hasNext(); )
+ for (Iterator it = super.values().iterator(); it.hasNext();)
{
Criterion co = (Criterion) it.next();
String tableName = co.getTable();
@@ -525,8 +525,8 @@
*/
public Criteria add(Criterion c)
{
- StringBuffer sb = new StringBuffer(c.getTable().length() +
- c.getColumn().length() + 1);
+ StringBuffer sb = new StringBuffer(c.getTable().length()
+ + c.getColumn().length() + 1);
sb.append(c.getTable());
sb.append('.');
sb.append(c.getColumn());
@@ -947,9 +947,11 @@
*/
public Object put(Object key, Object value)
{
- if (! (key instanceof String))
+ if (!(key instanceof String))
+ {
throw new NullPointerException(
"Criteria: Key must be a String object.");
+ }
return add((String) key, value);
}
@@ -1259,7 +1261,6 @@
*
* @param column The column to run the comparison on
* @param value A float.
- *
* @return A modified Criteria object.
*/
public Criteria add(String column, float value)
1.8 +15 -17
jakarta-turbine-torque/src/java/org/apache/torque/util/LargeSelect.java
Index: LargeSelect.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/util/LargeSelect.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- LargeSelect.java 27 Sep 2002 16:09:20 -0000 1.7
+++ LargeSelect.java 27 Nov 2002 11:31:00 -0000 1.8
@@ -65,8 +65,6 @@
import org.apache.log4j.Category;
import org.apache.torque.Torque;
import org.apache.torque.TorqueException;
-import org.apache.torque.util.BasePeer;
-import org.apache.torque.util.Criteria;
import com.workingdogs.village.QueryDataSet;
import com.workingdogs.village.DataSetException;
@@ -178,14 +176,14 @@
private int pageSize;
/** The maximum number of records to maintain in memory. */
private int memoryLimit;
-
+
/** The record number of the first record in memory. */
private int blockBegin = 0;
/** The record number of the last record in memory. */
private int blockEnd;
/** How much of the memory block is currently occupied with result data. */
private volatile int currentlyFilledTo = -1;
-
+
/** The SQL query that this <code>LargeSelect</code> represents. */
private String query;
/** The database name to get from Torque. */
@@ -215,7 +213,7 @@
* their final values.
*/
private boolean totalsFinalized = false;
-
+
/** The cursor position in the result set. */
private int position;
/** The total number of pages known to exist. */
@@ -225,19 +223,19 @@
/** The number of the page that was last retrieved. */
private int currentPageNumber = 0;
- /** The criteria used for the query. */
+ /** The criteria used for the query. */
private Criteria criteria = null;
/** The last page of results that were returned. */
private List lastResults;
- /**
- * The class that is possibly used to construct the criteria and used
- * to transform the Village Records into the desired OM or business objects.
+ /**
+ * The class that is possibly used to construct the criteria and used
+ * to transform the Village Records into the desired OM or business objects.
*/
- private Class returnBuilderClass = null;
+ private Class returnBuilderClass = null;
/**
- * A reference to the method in the return builder class that will
- * convert the Village Records to the desired class.
+ * A reference to the method in the return builder class that will
+ * convert the Village Records to the desired class.
*/
private Method populateObjectsMethod = null;
@@ -559,7 +557,7 @@
* @throws TorqueException if invoking the <code>populateObjects()<code>
* method runs into problems or a sleep is unexpectedly interrupted.
*/
- synchronized private List getResults(int start, int size)
+ private synchronized List getResults(int start, int size)
throws IllegalArgumentException, TorqueException
{
log.debug("getResults(start: " + start
@@ -753,7 +751,7 @@
}
qds.clearRecords();
}
-
+
log.debug("run(): While loop terminated because either:");
log.debug("run(): 1. qds.allRecordsRetrieved(): "
+ qds.allRecordsRetrieved());
@@ -1115,8 +1113,8 @@
position = 0;
totalPages = -1;
totalRecords = 0;
- // todo Perhaps store the oldPageNumber and immediately restart the query.
- // oldPageNumber = currentPageNumber;
+ // todo Perhaps store the oldPageNumber and immediately restart the
+ // query. oldPageNumber = currentPageNumber;
currentPageNumber = 0;
queryCompleted = false;
totalsFinalized = false;
1.8 +8 -8
jakarta-turbine-torque/src/java/org/apache/torque/util/Query.java
Index: Query.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/util/Query.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Query.java 7 May 2002 05:57:19 -0000 1.7
+++ Query.java 27 Nov 2002 11:31:00 -0000 1.8
@@ -236,7 +236,7 @@
public String toString()
{
StringBuffer stmt = new StringBuffer();
- if ( rowcount != null )
+ if (rowcount != null)
{
stmt.append(ROWCOUNT)
.append(rowcount)
@@ -247,32 +247,32 @@
.append(selectColumns.toString(", "))
.append(FROM)
.append(fromTables.toString(", "));
- if ( !whereCriteria.empty() )
+ if (!whereCriteria.empty())
{
stmt.append(WHERE)
.append(whereCriteria.toString( AND ));
}
- if ( !groupByColumns.empty() )
+ if (!groupByColumns.empty())
{
stmt.append(GROUP_BY)
.append(groupByColumns.toString(", "));
}
- if ( having != null )
+ if (having != null)
{
stmt.append(HAVING)
.append(having);
}
- if ( !orderByColumns.empty() )
+ if (!orderByColumns.empty())
{
stmt.append(ORDER_BY)
.append(orderByColumns.toString(", "));
}
- if ( limit != null )
+ if (limit != null)
{
stmt.append(LIMIT)
.append(limit);
}
- if ( rowcount != null )
+ if (rowcount != null)
{
stmt.append(ROWCOUNT)
.append("0");
1.19 +25 -28
jakarta-turbine-torque/src/java/org/apache/torque/util/SqlExpression.java
Index: SqlExpression.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/util/SqlExpression.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- SqlExpression.java 11 Sep 2002 17:23:41 -0000 1.18
+++ SqlExpression.java 27 Nov 2002 11:31:00 -0000 1.19
@@ -93,8 +93,7 @@
* @return A join expression, e.g. UPPER(table_a.column_a) =
* UPPER(table_b.column_b).
*/
- public static String buildInnerJoin(String column,
- String relatedColumn)
+ public static String buildInnerJoin(String column, String relatedColumn)
{
// 'db' can be null because 'ignoreCase' is false.
return buildInnerJoin(column, relatedColumn, false, null);
@@ -118,8 +117,8 @@
DB db)
{
int addlength = (ignoreCase) ? 25 : 1;
- StringBuffer sb = new StringBuffer(column.length() +
- relatedColumn.length() + addlength);
+ StringBuffer sb = new StringBuffer(column.length()
+ + relatedColumn.length() + addlength);
buildInnerJoin(column, relatedColumn, ignoreCase, db, sb);
return sb.toString();
}
@@ -144,17 +143,15 @@
{
if (ignoreCase)
{
- whereClause
- .append(db.ignoreCase(column))
- .append('=')
- .append(db.ignoreCase(relatedColumn));
+ whereClause.append(db.ignoreCase(column))
+ .append('=')
+ .append(db.ignoreCase(relatedColumn));
}
else
{
- whereClause
- .append(column)
- .append('=')
- .append(relatedColumn);
+ whereClause.append(column)
+ .append('=')
+ .append(relatedColumn);
}
}
@@ -243,7 +240,7 @@
if (criteria != null && criteria instanceof ObjectKey)
{
- if (((ObjectKey)criteria).getValue() == null)
+ if (((ObjectKey) criteria).getValue() == null)
{
criteria = null;
}
@@ -271,8 +268,7 @@
}
else
{
- if (criteria instanceof String ||
- criteria instanceof StringKey)
+ if (criteria instanceof String || criteria instanceof StringKey)
{
criteria = quoteAndEscapeText(criteria.toString(), db);
}
@@ -288,18 +284,18 @@
}
else if (criteria instanceof Boolean)
{
- criteria = db.getBooleanString((Boolean)criteria);
+ criteria = db.getBooleanString((Boolean) criteria);
}
}
- if (comparison.equals(Criteria.LIKE) ||
- comparison.equals(Criteria.NOT_LIKE))
+ if (comparison.equals(Criteria.LIKE)
+ || comparison.equals(Criteria.NOT_LIKE))
{
- buildLike(columnName, (String)criteria, comparison,
+ buildLike(columnName, (String) criteria, comparison,
ignoreCase, db, whereClause);
}
- else if (comparison.equals(Criteria.IN) ||
- comparison.equals(Criteria.NOT_IN))
+ else if (comparison.equals(Criteria.IN)
+ || comparison.equals(Criteria.NOT_IN))
{
buildIn(columnName, criteria, comparison,
ignoreCase, db, whereClause);
@@ -308,11 +304,11 @@
{
// Do not put the upper/lower keyword around IS NULL
// or IS NOT NULL
- if (comparison.equals(Criteria.ISNULL) ||
- comparison.equals(Criteria.ISNOTNULL))
+ if (comparison.equals(Criteria.ISNULL)
+ || comparison.equals(Criteria.ISNOTNULL))
{
whereClause.append(columnName)
- .append(comparison);
+ .append(comparison);
}
else
{
@@ -323,8 +319,8 @@
columnValue = db.ignoreCase(columnValue);
}
whereClause.append(columnName)
- .append(comparison)
- .append(columnValue);
+ .append(comparison)
+ .append(columnValue);
}
}
}
@@ -513,7 +509,7 @@
StringStack inClause = new StringStack();
if (criteria instanceof List)
{
- Iterator iter = ((List)criteria).iterator();
+ Iterator iter = ((List) criteria).iterator();
while (iter.hasNext())
{
Object value = iter.next();
@@ -578,6 +574,7 @@
* escaped.
*
* @param rawText The <i>unquoted</i>, <i>unescaped</i> text to process.
+ * @param db
* @return Quoted and escaped text.
*/
public static String quoteAndEscapeText(String rawText, DB db)
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>