SQLxD Part 6 — FROM

This is the sixth part of the SQLxD series. For your convenience you can find other parts in the table of contents in Part 1 – XML Transformation

We already know how to transform XML nodes into SQL-like rows. Now it is time to execute DQL queries. For now I will just describe operators implementation, I will handle parsing later in this series.

Today we describe basic construct: FROM.


FROM implementation is straightforward: we assume that we already parsed the XML document (so we have strongly typed model), we have logic for building row, and we have mechanisms for extracting nodes using multi-segment identifiers. All we need to do is connect them together:

We create FROM, pass selector and alias and we can call CreateRelation. The missing piece is what exactly is a Relation:

As we can see, Relation is just a bag of rows and columns, that’s all.

In the next part we will handle filtering using WHERE clause.