Re: relational tables and objects

From: Dm. Arapov <darapov_at_cox.net>
Date: Sat, 02 Nov 2002 21:27:15 GMT
Message-ID: <TqXw9.83057$vq2.2467353_at_news1.east.cox.net>


"Jan Hidders" <hidders_at_REMOVE.THIS.uia.ua.ac.be> wrote in message news:3dc42970$1_at_news.uia.ac.be...
> Dm. Arapov wrote:
> >Jan Hidders wrote
> >> Dm. Arapove wrote:
> >> >
> >> >Result of this call will be object of class join_t_eq<TableA, TableB,
> >> >list_of_columns_to_be_equal>.
> >>
> >> Interesting. Why is the list of columns in the type? And if I do
> >> join(A,join(B,C)) will the result have the same type as
join(join(A,B),C)
> >> or not?
> >
> >Yes they will have the same type.
>
> Which type will that be? Let's say A has colums a1 and a2, B has b1 and b2
> and C has c1 and c2, and B and C are joined on b1 and c1 and A and B are
> joined on a1 and b2.

RTL requires that columns used in join must form prefixes of sort_lists of both tables.
if B and C are joined on b1,c1, then A and B can not be joined on a1, b2, because b2 is not a prefix
of sort_list.

To make such sort programmer needs to invert (change sort_list) table or create an index.

>
> >List of columns let us tell compiler which of join use
>
> What I meant was why is it a template variable and not simply an argument?

List of columns is just a type, it is not a value and therefore can not be passed as parameter to function.
Making it template parameter allows us to perform schema computations in C++ compile time,
and ensure type safety.

>
> >>So can you statically type the set union?
> >
> >Pardon me, I do not understand the question.
>
> If I call union(A,B) this should preferrably only be well typed if A and B
> have the same type. Is this decided at compile time?

Sure. RTL checks if a relational operation is valid in compile-time. All checks and schema computations
are done in comile-time. In compile time we calculate list of colums of
result, sort order, check if colums, on which relation is sorted, make a key.

Dm. Arapov Received on Sat Nov 02 2002 - 22:27:15 CET

Original text of this message