def query (&block)

      rs = do_query(&block)
      a = rs.to_a

      return a

    ensure
      rs && rs.free
    end
def query (&block)

      rs = do_query(&block)
      a = rs.to_a

      return a

    ensure
      rs && rs.free
    end
Prepares and runs a query, returns an array of hashes (all Ruby)
 (takes care of freeing the query and the result set structures)