def closeDb(self, dbConnection: Connection, dbCursor: Cursor) -> None: """- 关闭数据库。 - param - `dbConnection` 数据库连接 """ if dbCursor != None: dbCursor.close() if dbConnection != None: dbConnection.close()
def _output_named_records(cursor: Cursor) -> Iterable[Dict[str, Any]]: names = [description[0] for description in cursor.description] for record in cursor: yield {name: value for name, value in zip(names, record)} cursor.close()