Base SQL handler fixed

Still to come: improved functionality