db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject cvs commit: jakarta-turbine-torque/src/java/org/apache/torque/util LargeSelect.java
Date Tue, 28 Jan 2003 00:59:11 GMT
seade       2003/01/27 16:59:11

  Modified:    src/java/org/apache/torque/util LargeSelect.java
  Log:
  Minor corrections to LargeSelect (no functional changes).
  PR: TRQS124
  
  Revision  Changes    Path
  1.10      +22 -9     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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- LargeSelect.java	9 Jan 2003 17:46:21 -0000	1.9
  +++ LargeSelect.java	28 Jan 2003 00:59:11 -0000	1.10
  @@ -185,8 +185,6 @@
       private String query;
       /** The database name to get from Torque. */
       private String dbName;
  -    /** The connection to the database. */
  -    private Connection db = null;
       /** Used to retrieve query results from Village. */
       private QueryDataSet qds = null;
   
  @@ -672,6 +670,9 @@
       public void run()
       {
           int size = pageSize;
  +        /* The connection to the database. */
  +        Connection conn = null;
  +
           try
           {
               // Add 1 to memory limit to check if the query ends on a page break.
  @@ -685,14 +686,14 @@
               query = BasePeer.createQueryString(criteria);
   
               // Get a connection to the db.
  -            db = Torque.getConnection(dbName);
  +            conn = Torque.getConnection(dbName);
   
               // Execute the query.
               log.debug("run(): query = " + query);
               log.debug("run(): memoryLimit = " + memoryLimit);
               log.debug("run(): blockBegin = " + blockBegin);
               log.debug("run(): blockEnd = " + blockEnd);
  -            qds = new QueryDataSet(db, query);
  +            qds = new QueryDataSet(conn, query);
   
               // Continue getting rows one page at a time until the memory limit
               // is reached, all results have been retrieved, or the rest
  @@ -784,7 +785,7 @@
                   {
                       qds.close();
                   }
  -                db.close();
  +                Torque.closeConnection(conn);
               }
               catch (SQLException e)
               {
  @@ -932,7 +933,7 @@
        *
        * @param moreIndicator the indicator to use in place of the default
        * (">").
  -      */
  +     */
       public static void setMoreIndicator(String moreIndicator)
       {
           LargeSelect.moreIndicator = moreIndicator;
  @@ -940,7 +941,7 @@
   
       /**
        * Retrieve the more pages/records indicator.
  -      */
  +     */
       public static String getMoreIndicator()
       {
           return LargeSelect.moreIndicator;
  @@ -1115,7 +1116,8 @@
           totalPages = -1;
           totalRecords = 0;
           // todo Perhaps store the oldPageNumber and immediately restart the
  -        // query. oldPageNumber = currentPageNumber;
  +        // query. 
  +        // oldPageNumber = currentPageNumber;
           currentPageNumber = 0;
           queryCompleted = false;
           totalsFinalized = false;
  @@ -1157,6 +1159,17 @@
           {
               params.put(name, value);
           }
  +    }
  +
  +    /**
  +     * Provide something useful for debugging purposes.
  +     * 
  +     * @return some basic information about this instance of LargeSelect.
  +     */
  +    public String toString()
  +    {
  +        return "LargeSelect - TotalRecords: " + getTotalRecords() 
  +                + " TotalsFinalised: " + getTotalsFinalized();
       }
   
   }
  
  
  

Mime
View raw message