When scanning for the matching parenthesis, string literals
were not taken into account, which would inevitably lead to
errors if one wanted to do a selection on a string containing
a parenthesis.
Now it uses a state-machine to skip the ones that are located
inside literals.
In the UI, a common pattern was to check if a query was
prefixed by an assignment and in that case, assign the result
to the given name.
This function puts this in a common place, so it can be used from
all the parts where it is needed.
This uses the CallableString object only in the final step and not
during all the intermediate ones.
Since str is a native object, it is faster to use than a normal
object.
This is a very marginal optimization that will not yield any
gains :)
When running a selection, compiling the expression into a code object
so that it does not need to be re-parsed per every iteration.
Since it saves one parse per iteration, the gains become more
noticeable as the size of the relations grow.
In case of multiple renames, all of the resulting relations will point
to the same data, so writing on one and marking its only known copy
as writable would be incorrect.
For this to work, all the references should be kown to all the other
instances.
It is probably not worth to implement it.
Implemented test for the update
In case of a rename, the original relation and the resulting relations
are pointing to the same set.
In case of functions that change the relation, such as insert, a copy is
created to be able to write on it. But when writing on the other relation
a new copy would have been made too.
This fixes it, now when changing one relation, the other is marked as
writable as well.
When running relational as an .exe file generated by
py2exe, that line might give an exception. Because of
reasons.
I don't know what the hell is going on and I don't care.
Outer joins add the placeholder '---' that is used as some sort of NULL
value.
However select operations on such relations would always fail, because
relations are supposed to only contain values of class rstring, and
the placeholder was added as a regular string.
As a consequence, automatic casting would always fail, and the select
would always raise an exception.
Added a new test case with this specific case in mind.
This introduces several advantages:
No longer rely on the cache to be able to contain as many as
needed. It works within relational but it is not assured to be so if it
is used within other projects.
Using compile flags allows slightly simpler expressions.
Adds some functions to store and load an entire session as a binary
blob.
In this way the user does not need to re-load all the relations from the
previous session.
This is more Pythonic and makes the code more readable.
Backwards compatibility is provided by giving an alias with the
previous name of the class.
It will not be broken until the next major release.