query-parser.y: Report error if ca_areana_calloc fails

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
query-parser.y: Assume 0 offset rather than -1, if none is given

The code in select.c will behave the same either way, but 0 does make more
sense.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Buffer statements before executing them

This is needed to support stored functions in the future.

One problem with the current implementation is that it will parse an entire
script before executing it, which may consume a lot of memory.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>