@staticmethod
def _collect_records(stmt, cur, single, records):
    """ Collect the records to return in the :func:`execute` method.

        :param str stmt: the SQL statement executed in the cursor object.
        :param Cursor cur: the database connection cursor object.
        :param bool single: True if the first record is to be returned,
            otherwise all records will be retrieved from the cursor.
        :param list records: the bucket list to fill. This is the
            output object.
        """
    if stmt.upper().startswith('DELETE'):
        records.append(cur.rowcount)
    if stmt.upper().startswith('SELECT') or stmt.upper().startswith('SHOW'):
        rows = []
        if single:
            row = cur.fetchone()
            if row:
                rows.append(row)
        else:
            rows = cur.fetchall()
        for row in rows:
            records.append(dict(row))
