def __init__(self, connection, statement, *types, **kwargs):
        global statement_number
        if connection == None or connection.c == None:
            raise InterfaceError("connection not provided")
        try:
            statement_number_lock.acquire()
            self._statement_number = statement_number
            statement_number += 1
        finally:
            statement_number_lock.release()
        self.c = connection.c
        self._portal_name = None
        self._statement_name = kwargs.get("statement_name", "pg8000_statement_%s" % self._statement_number)
        self._row_desc = None
        self._cached_rows = []
        self._ongoing_row_count = 0
        self._command_complete = True
        self._parse_row_desc = self.c.parse(self._statement_name, statement, types)
        self._lock = threading.RLock()
dataset/ETHPy150Open uwdata/termite-data-server/web2py/gluon/contrib/pg8000/interface.py/PreparedStatement.__init__/original