NOODB: New Operators, Count

In order for a query to do anything useful, it really needs to be able to support more than just the = operator.

These operators are now supported in the NOODB queries:

  1. ==
  2. !=
  3. >
  4. <
  5. >=
  6. <=

Nothing shocking there; i don’t think I’m exceeding anyone’s expectations with the ability to do fundamental things. I changed = to ==, which is more LINQish.

All of my query tests query the database, then assert on the count. That inspired me to add a count method. You pass it the same query, and it returns an integer with the number of rows that match the query.

Assert.AreEqual(4, client.Count<IMovie>("from m in movie where m.ReleaseYear >= 2005"));

Behind the scenes, it’s mostly the same query. But, instead of selecting fields, it just does “select count(1) from …”. It runs against the same CTE as the regular query.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: