db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter riegersperger <r...@subnet.at>
Subject Re: Count(*) and criteria
Date Mon, 03 Feb 2003 09:53:22 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 02 February 2003 23:50, Scott Eade wrote:
[...]
> Can you not build the criteria in two parts (i.e. everything but the
> desired columns) and clone it prior to adding the desired columns?

maybe i'm doing something wrong here (not very fluent with java), but i've 
tried the following:

Criteria crit = new Criteria();
[add some conditional expressions with criteria.add(...)]
Criteria myCrit = (Criteria)crit.clone();
List myList = MyPeer.doSelect(crit);

myCrit.addSelectColumn("SELECT Count(ID)");
List myCountList = MyPeer.doSelect(crit);

this will not work because for some reason (maybe some sort of initalization 
in the peer?), the selectColumns are filled with all the column names as soon 
as i do anything with the peer, and count(*) just gets appended to them.
i have to admit that i did not closely look at the Peer-code, because it 
wasn't quite easy for me to figure out what's going on in there (as i said 
before, i'm not very fluent with java).

[...]
> LargeSelect may obviate the need to do the count(*) as it provides an
> indication of the length of the result set as the query progresses, e.g. it
> might say that it is displaying page 1 of > 25 indicating that there are
> more than 25 pages of data available.

i looked at the javadoc, and it sounds like what i need.
in the doc, it is stated that LargeSelect should be stored in the session. How 
big is the performance impact of re-creating it each time (and then hopping 
to the requested page)?
personally, i hate putting anything in the session and i try to avoid it as 
much as i can.

many thanks for your help,

rick

- -- 
|-
| peter riegersperger  <rick@subnet.at>
|-
| ein windows switcher tagebuch:
| http://forum.subnet.at/viewforum.php?f=22
|-
| subnet
| platform for media art and experimental technologies
|-
| http://www.subnet.at/
|-
| muehlbacherhofweg 5 // 5020 salzburg // austria
|-
| fon/fax +43/662/842 897
|- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+PjwWIMP39JYOy9IRAjV0AKDbl2Yv3jPKnXtErCDT5E32NzhWpgCfUUkw
jkIab3wmZnjljyVkoOw9kJA=
=TkFv
-----END PGP SIGNATURE-----


Mime
View raw message