Execute query in pool.

        Returns future yielding closed cursor.
        You can get rows, lastrowid, etc from the cursor.
        :param cursor: cursor class(Cursor, DictCursor. etc.)

        :return: Future of cursor
        :rtype: Future
557485
def execute(self, query, params=None, cursor=None):
        
        conn = yield self._get_conn()
        try:
            cur = conn.cursor(cursor)
            yield cur.execute(query, params)
            yield cur.close()
        except:
            self._close_conn(conn)
            raise
        else:
            self._put_conn(conn)
        raise Return(cur)
1039901
async def fetchone(self):
        
        try:
            row = await self._cursor.fetchone()
        except AttributeError:
            self._non_result()
        else:
            if row is not None:
                return self._process_rows([row])[0]
            else:
                await self.close()
                return None
102688
def genrows(cursor: Cursor, arraysize: int = 1000) \
        -> Generator[List[Any], None, None]:
    
    # http://code.activestate.com/recipes/137270-use-generators-for-fetching-large-db-record-sets/  # noqa
    while True:
        results = cursor.fetchmany(arraysize)
        if not results:
            break
        for result in results:
            yield result
788381
def execute(query, data=None):
    
    connection = _State.connection()
    _State.new_transaction()

    if data is None:
        data = []

    result = connection.execute(query, data)

    _State.table = None
    _State.metadata = None
    try:
        del _State.table_pending
    except AttributeError:
        pass

    if not result.returns_rows:
        return {u'data': [], u'keys': []}

    return {u'data': result.fetchall(), u'keys': list(result.keys())}
333043
def get_result(self, cursor):
        ''''''
        title = headers = None

        # cursor.description is not None for queries that return result sets,
        # e.g. SELECT or SHOW.
        if cursor.description is not None:
            headers = [x[0] for x in cursor.description]
            rows = cursor.fetchall()
            status = '%d row%s in set' % (len(rows), '' if len(rows) == 1 else 's')
        else:
            logger.debug('No rows in result.')
            rows = None
            status = 'Query OK'
        return (title, rows, headers, status)
729187
def cursor():
    """"""
    try:
        cur = conn.cursor()
        yield cur
    except (db.Error, Exception) as e:
        cur.close()
        if conn:
            conn.rollback()
        print(e.message)
        raise
    else:
        conn.commit()
        cur.close()
803797
def _get_cursor(self):
        '''
        
        '''
        _options = self._get_options()
        conn = sqlcipher.connect(_options.get('database'),
                                 timeout=float(_options.get('timeout')))
        conn.execute('pragma key="{0}"'.format(_options.get('pass')))
        cursor = conn.cursor()
        try:
            yield cursor
        except sqlcipher.Error as err:
            log.exception('Error in ext_pillar SQLCipher: %s', err.args)
        finally:
            conn.close()
888036
def get_cursor(self, instance, db_key, db_name=None):
        '''
        
        '''
        conn_key = self._conn_key(instance, db_key, db_name)
        try:
            conn = self.connections[conn_key]['conn']
        except KeyError:
            # We catch KeyError to avoid leaking the auth info used to compose the key
            # FIXME: we should find a better way to compute unique keys to map opened connections other than
            # using auth info in clear text!
            raise SQLConnectionError("Cannot find an opened connection for host: {}".format(instance.get('host')))
        return conn.cursor()
270279
def _close_cursor_now(self, cursor_id, address=None):
        
        if not isinstance(cursor_id, integer_types):
            raise TypeError("cursor_id must be an instance of (int, long)")

        if self.__cursor_manager is not None:
            self.__cursor_manager.close(cursor_id, address)
        else:
            self._kill_cursors([cursor_id], address, self._get_topology())
339747
def next(self):
    
    out = self.peek()[self._headers.index(self._field)]
    self._cursor += 1
    if out is not None:
      self._lastValue = out
    return out
489557
async def fetchone(self) -> Optional[sqlite3.Row]:
        """"""
        return await self._execute(self._cursor.fetchone)
1216959
def get_cursor(self):
        """"""

        return self.grid.GetGridCursorRow(), self.grid.GetGridCursorCol(), \
            self.grid.current_table
1311741
def _fetchone(self, query, vars):
        
        cursor = self.get_db().cursor()
        self._log(cursor, query, vars)
        cursor.execute(query, vars)
        return cursor.fetchone()
1212945
def get_last_id(self, cur, table='reaction'):
        
        cur.execute("SELECT seq FROM sqlite_sequence WHERE name='{0}'"
                    .format(table))
        result = cur.fetchone()
        if result is not None:
            id = result[0]
        else:
            id = 0
        return id
144037
public static <T> List<T> getList(final Cursor cursor, final Class<T> klass) {
        try {
            return getObjectsFromCursor(cursor, klass);
        } catch (final Exception e) {
            Logger.ex(e);
            return null;
        }
    }
589324
def dictfetchall(cursor):
    
    desc = cursor.description
    return [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()]
488223
def show_wait_cursor(object):
    

    @functools.wraps(object)
    def show_wait_cursorWrapper(*args, **kwargs):
        """
        Shows a wait cursor while processing.

        :param \*args: Arguments.
        :type \*args: \*
        :param \*\*kwargs: Keywords arguments.
        :type \*\*kwargs: \*\*
        :return: Object.
        :rtype: object
        """

        QApplication.setOverrideCursor(Qt.WaitCursor)
        value = None
        try:
            value = object(*args, **kwargs)
        finally:
            QApplication.restoreOverrideCursor()
            return value

    return show_wait_cursorWrapper