Return non-zero exit code on error in batch mode
Description
In batch mode, an exit code of 0 is returned even when an exception is raised during query parsing, validation and execution. It would be more useful for applications if a non-zero code were returned in these cases.
Proposal
Roughly put: When catching exceptions raised by the query parser, schema validator, and database engine, check whether we are running in batch mode and, if yes, exit with a non-zero code to signal that an error has occurred.
Edited by Paolo Guagliardo