implemented sql queryhandler