On Thu, Feb 08, 2001 at 02:22:21PM +0800, fanyun wrote:
> The line: addSelectColumns ( criteria ); will bring all the
> columns into select clause. This cause the problem.
> I think it should be
> if(criteria.getSelectColumns().size() == 0)
> addSelectColumns ( criteria );
Doh - I saw this and thought "that looks great" and went ahead and
committed it before even reading the rest of your mail. That'll teach me
to get precipitous. (commit now reversed).
> ***********Problem 2: the return vector**********************
> the line: results.add (row2Object (row,1,Class.forName
> (className)));
> And the row2Object function is just for a select (*) from abc clause. Other
> sql clause can not use that function.
>
> For this problem I think there should be 2 solution:
> 1. add another doRawSelect() function which will only return the vector
> returned from BasePeer.doSelect().
> User should normalize the result by themselvs. This solution brings flexible
> for users.
I think this addition would be extremely useful...
> 3. add a getCount() function will get the count for user. This should used
> with solution 1. Something like:
>
> int static getCount()
>
>
> crit.addSelectColumn("count(" + AbcPeer.Id + ")");
> Vector row = AbcPeer.doRawSelect(crit);
> int count = row.getValue(offset+0).asInt()
> return count;
> }
.. because it could be used to implement this...
>
> This is most convenient solution. But this solution only solve the count(*)
> problem. May need max, min .....
...and these if the desire exists.
> Please give me advise which will be the best solution. After get your feed
> back, I will try to make a change in TDK om templates, and submit the
> change back to turbine group.
So I'm +1 on a doRawSelect, and would like to see a getCount along the
lines that Oskar is working on - thread: 'Peer code extensions ?'
(By the way, while you're there I noticed that the doSelect that takes a
class name doesn't set the database name in the criteria. I assume that
your patch to add a doRawSelect would also amend doSelect to use it. In
that case the critieria.setDbName call should (IMO) be in doRawSelect to
ensure that any entry point into the Peer's select routines sets the
database name.)
--
Sean Legassick
[EMAIL PROTECTED]
homo sum: humani nihil a me alienum puto
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]