Add missing check_conn when running SQL statements
Intermittent errors from the DB can cause the connection to be reset and
not re-established for the next statement to be executed, leading to
segfaults.
fixes#742
Change-Id: I1ed5b75457ab7167a70df5e04a964d37f98e60f7