Move some DB handling from server to DB module
Fix forgetting to send final OK after handshake
Definition list -> table