More Squiggle
[java]
Table person = new Table(“person”);
return select(person.star())
.from(person)
.where(person.column(“startDate”).greaterThan(“2005-01-01”)
.and(person.column(“numberOfFriends”).greaterThan(100))
.and(person.column(“age”).greaterThan(21)));
[/java]
[java]
Table person = new Table(“person”);
Column startDate = person.column(“startDate”);
Column numberOfFriends = person.column(“numberOfFriends”);
return select(person.star())
.from(person)
.where(startDate.greaterThan(“2005-01-01”)
.and(numberOfFriends.greaterThan(100)
.or(numberOfFriends.lessThan(50))));
[/java]
[java]
Table person = new Table(“person”);
return select(star())
.from(person)
.where(person.column(“psnId”).notIn(new String[] { “1”, “2” }));
[/java]
From the Squiggle acceptance tests…
This entry was posted on Monday, April 24th, 2006 at 8:46 pm and is filed under Java. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
One Response to “More Squiggle”
greaterThan(x) looks like a flex point to me. I think I would prefer to see methods called is(Condition) and isNot(Condition) as methods on whatever-startDate-is, so I could say:
startDate.is(greaterThan(today()) or startDate.isNot(null) or startDate.is(between(yesterday(), yesterday()+days(3)) or something. Basically that I can define my own Conditions and maybe use a bunch of standard syntactic sugar Conditions and other utility methods that squiggle provides. Or something.
Have your say
Fields in bold are required. Email addresses are never published or distributed.
Some HTML code is allowed:
URIs must be fully qualified (eg: http://www.domainname.com) and all tags must be properly closed.
Line breaks and paragraphs are automatically converted.
Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.