ca-shell.c: Flush stdout before leaving main

We're using a stack allocated buffer for stdout, so we need to flush the
buffers before leaving the function, lest the output become corrupted.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Added support for CSV output

To support this, some new SQL syntax was added:

  SET OUTPUT FORMAT CSV;

A function pointer for either plain or CSV formatting is passed to the LLVM
code generator, so that we can support multiple formats with no per-value or
per-row conditional branching.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
query-lexer.l: Make strtolower() three lines shorter

... simply by converting a while loop into a for loop.

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