NOODB: Remember it?

August 5, 2010

It’s been a month since the last update. I’ve been very busy with the kids (Ellie is now 2 months old), work, and just other stuff. The next task on the list was tedious, so I wasn’t in a huge rush to get to it.

The last major task I was working on was returning flat results sets instead of objects. This is good when you’re interested in data, not objects.

I once posted that it was working with the exception of the rendering on the page. I’ve since learned that there was a bug, but I don’t recall if I posted it.

It works just fine as long as the fields in the SELECT are also in the WHERE or the ORDER BY. If it’s not, then it’s not in the CTE, so it all blows up.

That’s an unacceptable restriction. The fix is, when flat, to include the select fields when building the CTE. Sounds straight forward enough.

Unfortunately, the field objects for SELECT and WHERE/ORDER BY are different objects. The particular difference that affects this is that WHERE/ORDER has a single CHILD object. The SELECT has a CHILD collection. The SELECT field is the more robust and efficient version; it was also necessary for the property drilling capabilities. The WHERE/ORDER BY are simpler and were done earlier.

As is, I can write some awkward code to deal with the differences between the two while generating the CTE. But, I’m not a big fan of awkward code. The right thing to do is to eliminate the older field object.

FIELD and FIELDCOLLECTION have been eliminated. SELECTFIELD and SELECTFIELDCOLLECTION are now used for where, orderby and select. Of course, the name is now incorrect, but that’s an easy change that I’ll get to shortly.

Now that the field objects are all the same, the code to generate the CTE only needs to deal with one type of object. The conversion to the new field isn’t complete; the primary difference between the OLD and new is that the OLD was essentially a linked list and the NEW is essentially a tree. While everything now uses the tree like object, the code that populates it for the ORDER BY and WHERE is using it like a linked list. That’s ok for now; it has no adverse affects. Everything is fully functional. But, it should be brought up to date to use the the object to its full potential.

There are a couple quirky things that I’m going to have to deal with to get the select fields in the CTE. The quirky things are the things that resulted in it having its own objects to begin with. But, the dust has settled. It’ll be ok. There’s one field now to represent the Sql field name. I’ll have to change that to a couple properties; SELECT vs WHERE/ORDER BY.

In conclusion: The field object problem has been eliminated. I can now fix the SELECT bug. Hopefully I can do that within the next couple nights and get this thing back on track.