Quoting G Tellez <[EMAIL PROTECTED]>:
- How's possible that Links fails to appropriately compile the
queries? How can I detect that? In any case it fails I would receive
an error, isn't it?, but I haven't so far. During the development
process I continuously checked the error log (under logs/links-errors)
but it seems that everything's good so far.
Hi Gabriel,
One particular thing that causes Links to go wrong, which I see in
your code, is the following pattern:
for (var x <- someTable)
where (someCondition)
[x.foo]
The problem here is that the contents of the result are not
record-typed: the foo field is some base type like Int or String.
Because it's not record-typed it can't exactly and directly be
expressed as an SQL query, and so Links fails catastrophically: it
fetches *all* of someTable and filters it in memory using the
condition someCondition. If you change the above to
for (var x <- someTable)
where (someCondition)
[(foo=x.foo)]
(and, of course, change uses of the result to project out the foo
member) then you'll find it goes much faster.
This is a pretty severe limitation, of course, but at least it can be
easily worked around.
Also note that you'll *never* get an error due to Links failing to
make a nice SQL query. In the worst case, it "succeeds" by silently
fetching *all* the relevant tables and doing all the processing
itself. Fixing this (so that you can actually get error messages) is
my project at the moment.
Ezra
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
_______________________________________________
links-users mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/links-users