added new function to return the last sql query run