Operator overloading
Era Scarecrow
rtcvb32 at yahoo.com
Wed Dec 24 10:16:41 PST 2008
dennis luehring Wrote:
> Uno schrieb:
> >> the ultimate++ solution just works for very very simple statements
> > it works for every query. You can write for example:
> > Select(PRODUCTS[ID], CUSTOMER[NAME])
> > .From(PRODUCTS)
> > .InnerJoin(CUSTOMERS)
> > .On(CUSTOMERS[PRODUCT_ID] == PRODUCTS[ID] && Like(PRODUCTS[NAME], "BOOK%"))
> > .Where(PRODUCTS[ID] > 10);
> >
> > You can have another statement in where or even in select..
>
> and "from select"
>
> btw: i don't want to say: "its not possible" - i want
> to say: "it is even clear to handle in D" without going the
> no-other-way-in-c++ solution
>
I suppose you could do it that way, at least it would definately be readable rather than what i've seen in java (and ASP) before.
query = "Select * from persons where firstname='"+fname+" and lastname='"+lname+" and age="+age+... ect.ect
Recently i've started reading about lex and yacc (or flex and bison) and as a comment in there, it wouldn't be too hard to use substitution and have a pre-processor convert it into pure D code.
SQLQuery("
Select * from persons
where firstname=%fname%
and lastname=%lname%
and age=%age%")
Just a thought.
More information about the Digitalmars-d
mailing list