Please note: this project is inactive since early 2006

4.5.7 How much objects will a query fetch?

If you manipulate a big database and wants to bind the result of a query which is built e.g. using your application GUI, you certainly do not want to allow the users to fetch a whole table into memory just because they type '*' instead of 'B*' in the query string.

In that case, you want to have the number of objects that would be retrieved using a given FetchSpecification, while not actually fetching the objects.

The EditingContext provides a dedicated method for that purpose:

    nb_of_objects=ec.fetchCount('Book', qualifier='...')
returns the number of objects that would be returned if the method fetch() is triggered with the very same argument.

Comments are welcome: Sebastien Bigaret / Modeling Home Page
Hosted Logo