Thanks John.  That's what I suspected.

Keep up the great work!

Fred

----- Original Message ----
From: John Siracusa <[EMAIL PROTECTED]>
To: Rose::DB::Object list <rose-db-object@lists.sourceforge.net>
Sent: Thursday, January 31, 2008 11:39:41 AM
Subject: Re: [RDBO] Candidate for RDBO?


On 
Jan 
30, 
2008 
9:23 
PM, 
Fred 
Cox 
<[EMAIL PROTECTED]> 
wrote:
> 
I've 
got 
a 
Postgresql 
DBI 
select:
>
> 
SELECT 
COUNT(*) 
AS 
voters, 
SUM(liked) 
AS 
liked, 
SUM(liked) 
/ 
CAST( 
COUNT(*) 
AS
> 
real 
) 
AS 
ratio 
FROM 
review_votes 
WHERE 
reviewid=?
>
> 
that 
works 
well, 
but 
I 
wasn't 
sure 
whether 
it 
would 
be 
practical 
to 
try 
to 
do
> 
this 
with 
RDBO.  
I 
know 
the 
query 
builder 
works 
well, 
but 
that 
seems 
to 
be
> 
oriented 
to 
the 
WHERE 
clause.

The 
Manager 
is 
not 
going 
to 
help 
you 
with 
any 
query 
that 
does 
not
return 
a 
set 
of 
rows 
that 
correspond 
to 
an 
interconnected 
tree 
of
uniquely 
identified 
rows 
in 
one 
or 
more 
tables.  
In 
particular, 
once
you 
add 
an 
aggregate 
function 
or 
group 
by 
clause, 
the 
resulting 
rows
no 
longer 
correspond 
to 
unique 
rows 
in 
a 
table 
and 
therefore 
cannot 
be
represented 
by 
Rose::DB::Object-derived 
objects.

The 
QueryBuilder 
may 
be 
of 
some 
use 
for 
building 
the 
actual 
SQL 
query,
but 
you 
will 
then 
need 
to 
run 
it 
using 
plain 
old 
DBI.  
I 
suggest
encapsulating 
such 
queries 
in 
custom 
Manager 
methods.  
That 
will 
hide
the 
DBI 
ugliness 
from 
calling 
code, 
and 
you 
can 
use 
(or 
not)
QueryBuilder 
internally 
depending 
on 
your 
needs.

-John

-------------------------------------------------------------------------
This 
SF.net 
email 
is 
sponsored 
by: 
Microsoft
Defy 
all 
challenges. 
Microsoft(R) 
Visual 
Studio 
2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Rose-db-object 
mailing 
list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object





      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to