Operations are possible even when the order of the attributes is
not the same. Because ordering is just an implementation detail and
not an actual part of relational algebra.
A _rearrange() function exists to convert relations to have a similar
format and be able to operate on them.
The function would perform a projection in any case, which would cause
the creation of a new temporary relation, even when the relations where
already using the same order of attributes.
This commit fixes the issue by making it return an identity if the
operation is not necessary.
When doing a selection, a new context (in the form of a dictionary)
is created.
Instead of re-using the same dictionary re-assigning the values, now
use a comprehension to avoid redundant reads.
In this way, checks are performed automatically on every tuple
and code is simplified.
This should make it safer to raise exceptions on files that are
not relations.
Rather than having a header class that contains a list of header,
change it to directly be an immutable tuple.
This simplifies the code because header can now be compared and
indexed like any other tuple.
Code had to be changed all over the place to cope with this new
datatype.
rstring now has an autocast() function that returns the automatic casting
for that value.
The casting is cached so is really performed only once, at most, during
the lifetime of the object.
Since rstrings are faster and provide some caching features,
keep the same rstring objects from the beginning rather than
continuously casting strings.
During a selection operation, each value is matched against a regular
expression and then casting might be performed, depending on the results.
This commit caches the result of the match so that a value is not matched
multiple times in its lifetime.
The symbols previously used were a Canadian script, and were looking
good enough, but they might not be installed in every machine.
Besides, all this is to workaround a Qt5 bug that prevents from
rendering those symbols at times.
This converts the GUI code to use Qt5 and Python3
The GUI is still somewhat buggy, and it can't open files yet,
but seems to be mostly working, extensive testing will
be needed before this can be released.