Detect wheter a query result is returned and transform it to array here.