[Opensource] searchAndRetrieveList() method of MultiDBObject.java

liuhey liuhey at neusoft.com
Mon Dec 15 21:06:10 PST 2003


Yes,I've made this change and it works well.

----- Original Message ----- 
From: "larry hamel" <expresso at codeguild.com>
To: <opensource at jcorporate.com>
Sent: Tuesday, December 16, 2003 2:19 AM
Subject: Re: [Opensource] searchAndRetrieveList() method of MultiDBObject.java


> hi Liuhey,
> 
> I'll be happy to check this in, but I would be more confident if you said "I've made this change and it works well."
> 
> Have you tried it?  (Perhaps you already have--you have been 100% correct in the past!)
> 
> BTW, I added a utility method to MultiDBObject recently, and also fixed a bug with it when using SecuredDBObjects as targets.  See CVS for those changes.
> 
> larry
> 
> At 09:04 PM 12/14/2003, you wrote:
> >There is a bug in the searchAndRetrieveList() method of MultiDBObject.java.
> >After executing the query, it ignores the offset property when it populates the MultiDBOBject objects from myConnection. 
> >I think it should do this like the searchAndRetrieveList() method of DBObject.
> >
> >//MultiDBObject
> > public synchronized List searchAndRetrieveList() throws DBException {
> >            ..............
> >            myConnection.execute(myStatement.toString());
> >
> >            int recordCount = 0;
> >
> >            while (myConnection.next()) {
> >                MultiDBObject myObj = getThisMultiDBObj();
> >                recordCount++;
> >
> >                if ((recordCount > maxRecords) && (maxRecords > 0)) {
> >                    break;
> >                }
> >
> >                int i = 1;
> >
> >                if (log.isDebugEnabled()) {
> >                    log.debug("Retrieved row " + recordCount);
> >                }
> >
> >                String oneFieldValue = null;
> >    ......}}
> >
> >//DBObject
> > public synchronized List searchAndRetrieveList() throws DBException {
> >            ..............
> >            myConnection = this.createAndExecuteSearch(retrievedFieldList);
> >
> >            int recordCount = 0;
> >            int retrieveCount = 0;
> >
> >            while (myConnection.next()) {
> >                recordCount++;
> >                retrieveCount++;
> >
> >                //If there's limitation syntax on, then the first record will be the
> >                //maximum record.
> >                if (retrieveCount < offsetRecord && offsetRecord > 0 &&
> >                        myConnection.getLimitationPosition() == DBConnection.LIMITATION_DISABLED) {
> >                    continue;
> >                } else if (retrieveCount == offsetRecord && offsetRecord > 0 &&
> >                        myConnection.getLimitationPosition() == DBConnection.LIMITATION_DISABLED) {
> >                    recordCount = 0; //Reset count for counting for max records.
> >                    continue; //Skip this record... next one, we will start loading.
> >                }
> >                if ((recordCount > maxRecords) && (maxRecords > 0)) {
> >                    this.setAttribute("More Records", "Y");
> >                    break;
> >                }
> >    ......}}
> >_______________________________________________
> >Opensource mailing list
> >Opensource at jcorporate.com
> >http://mail.jcorporate.com/mailman/listinfo/opensource
> >Archives: http://mail.jcorporate.com/pipermail/opensource/
> 
> _______________________________________________
> Opensource mailing list
> Opensource at jcorporate.com
> http://mail.jcorporate.com/mailman/listinfo/opensource
> Archives: http://mail.jcorporate.com/pipermail/opensource/
> 



More information about the Opensource mailing list