• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Fetching record counts.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fetching record counts.


  • Subject: Re: Fetching record counts.
  • From: PA <email@hidden>
  • Date: Tue, 1 Feb 2005 20:45:51 +0100


On Feb 01, 2005, at 20:10, Chuck Hill wrote:

Here are some other counting implementation that I have gleaned from the list. Perhaps they are of interest?

Perhaps... or perhaps you could use the hidden power of raw <gasp>JDBC</gasp> instead:


public class EFCount extends EFSelect
{

// ======================================================================== ===
// Constant(s)
// ------------------------------------------------------------------------ ---


        private static final String             Count = "COUNT(*)";

// ======================================================================== ===
// Class variable(s)
// ------------------------------------------------------------------------ ---


// ======================================================================== ===
// Instance variable(s)
// ------------------------------------------------------------------------ ---


// ======================================================================== ===
// Constructor method(s)
// ------------------------------------------------------------------------ ---


public EFCount(final DataSource aDataSource, final Class anEntity, final SZQualifier aQualifier)
{
super( aDataSource, anEntity, aQualifier, null );
}


// ======================================================================== ===
// Class method(s)
// ------------------------------------------------------------------------ ---


// ======================================================================== ===
// Instance method(s)
// ------------------------------------------------------------------------ ---


// ======================================================================== ===
// EFAction method(s)
// ------------------------------------------------------------------------ ---


        protected String attributesDescription()
        {
                return EFCount.Count;
        }

        public int count() throws SQLException
        {
                Iterator        anIterator = this.execute();
                int             aCount = 0;

if ( anIterator.hasNext() == true )
{
Map someValues = (Map) anIterator.next();
Number aNumber = (Number) someValues.values().iterator().next();


                        if ( aNumber.intValue() > 0 )
                        {
                                aCount = aNumber.intValue();
                        }
                }

                this.close();

                return aCount;
        }

}


Cheers

--
PA, Onnay Equitursay
http://alt.textdrive.com/

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Fetching record counts. (From: Chuck Hill <email@hidden>)
 >Re: Fetching record counts. (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Fetching record counts.
  • Next by Date: Re: Status of Windows support
  • Previous by thread: Re: Fetching record counts.
  • Next by thread: Re: Fetching record counts.
  • Index(es):
    • Date
    • Thread