Hi David,
this works:
WhereGroupAnd<Delete> and = delete
.from("table")
.where( "field1", "=", "value1")
.startWhereAnd();
int i = 1;
String[] orValues = new String[] {"one", "two", "three"};
for ( String valuen : orValues) {
if (1 == i) and.where( "field"+(++i), "=", valuen);
else and.whereOr( "field"+(++i), "=", valuen);
}
and.end();
System.out.println(delete.getSql());
Best regards,
Geert
On 5-apr-06, at 17:08, David Herbert wrote:
I am stuck creating the RIFE equivalent of an SQL query such as:
delete from table where X and ( P or Q or R )
I'm struggling with code like this which I think should work but
doesn't:
Delete delete = new Delete( source );
delete
.from( table )
.where( "field1", "=", value1 )
.startWhereAnd()
.startWhereOr();
for ( String valuen : orValues ) {
delete.whereOr( "fieldn", "=", valuen );
}
Anyone got an example of how to use the startWhereAnd()/startWhereOr
() methods of query manager to simulate bracketed SQL queries like
the above?
Thanks,
David Herbert.
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users
--
Geert Bevin Uwyn bvba GTalk: [EMAIL PROTECTED]
"Use what you need" Avenue de Scailmont 34 Skype: gbevin
http://www.uwyn.com 7170 Manage, Belgium AIM: geertbevin
gbevin at uwyn dot com Tel: +32 64 84 80 03 Mobile: +32 477 302 599
PGP Fingerprint : 4E21 6399 CD9E A384 6619 719A C8F4 D40D 309F D6A9
Public PGP key : available at servers pgp.mit.edu, wwwkeys.pgp.net
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users