Update _dynamicBindResults function to determine query type

Function first determines the query type, and returns
an array of results (for a SELECT query) or number of
affected rows (for an INSERT/UPDATE/DELETE query).