private void JoinClause()
{
// Large set of defaults for joins.
// This is where we start to think about moving some
// parsing into the individual elements, esp. since
// the responsibility for executing the query is
// delegated to the executive.
do
{
Join j = null;
Join.OrientationType orientation = Join.OrientationType.Left;
if (tokenizer.Token == "LEFT")
{
orientation = Join.OrientationType.Left;
tokenizer.Match("LEFT");
}
if (tokenizer.Token == "RIGHT")
{
orientation = Join.OrientationType.Right;
tokenizer.Match("RIGHT");
}
if (tokenizer.Token == "JOIN")
{
tokenizer.Match("JOIN");
j = new InnerJoin();
}
if (tokenizer.Token == "INNER")
{
tokenizer.Match("INNER");
tokenizer.Match("JOIN");
j = new InnerJoin();
}
if (tokenizer.Token == "OUTER")
{
tokenizer.Match("OUTER");
tokenizer.Match("JOIN");
j = new OuterJoin();
}
j.Orientation = orientation;
j.TableName = tokenizer.Token;
tokenizer.GetToken();
tokenizer.Match("ON");
j.LeftField = tokenizer.Token;
tokenizer.GetToken();
tokenizer.Match("=");
j.RightField = tokenizer.Token;
tokenizer.GetToken();
((SelectQuery)this.Query).Joins.Add(j);
} while (tokenizer.Token == "JOIN" ||
tokenizer.Token == "LEFT" ||
tokenizer.Token == "RIGHT" ||
tokenizer.Token == "INNER" ||
tokenizer.Token == "OUTER");
}