SQLite Forum

select in order
Login
> And even if all you have is pipes connected to the input and output streams of a process running the SQLite shell program, you can always delimit the result set with "guard queries", e.g.:

> ```
> select 'BEGIN_QUERY_1';
> <your query>
> select 'END_QUERY_1';
> ```

I have done something else (for use with Node.js): `sqlite3 -quote -batch -cmd '.explain off'` And then after each query, use the dot command: `.print *` (My program also parses host parameters and substitutes their values, quoted properly for use in SQL.)

I should think that would work much better, because in the other case, there is the possibility that one of the result of the query is `END_QUERY_1`, so then it will be confused. Also, `-quote` mode allows the external program to use the data types properly, too.

But, while the above works in Node.js, it does not work in Ghostscript, whose `%pipe%` device is only a one way pipe (like `popen()` normally is), not two ways like in Node.js. So, now the other thing I would want to have is to be able to access SQLite from PostScript programs too, somehow.