first

* quote SQLSTATE
* handle null values from GET DIAGNOSTICS