[SQL-CVS] r789 - trunk/SQLObject/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2005-05-10 19:27:26
|
Author: ianb Date: 2005-05-10 19:27:15 +0000 (Tue, 10 May 2005) New Revision: 789 Modified: trunk/SQLObject/sqlobject/dbconnection.py Log: New method to retrieve db description with rows Modified: trunk/SQLObject/sqlobject/dbconnection.py =================================================================== --- trunk/SQLObject/sqlobject/dbconnection.py 2005-05-10 17:38:24 UTC (rev 788) +++ trunk/SQLObject/sqlobject/dbconnection.py 2005-05-10 19:27:15 UTC (rev 789) @@ -312,6 +312,23 @@ def queryAll(self, s): return self._runWithConnection(self._queryAll, s) + def _queryAllDescription(self, conn, s): + """ + Like queryAll, but returns (description, rows), where the + description is cursor.description (which gives row types) + """ + if self.debug: + self.printDebug(conn, s, 'QueryAllDesc') + c = conn.cursor() + self._executeRetry(conn, c, s) + value = c.fetchall() + if self.debugOutput: + self.printDebug(conn, value, 'QueryAll', 'result') + return c.description, value + + def queryAllDescription(self, s): + return self._runWithConnection(self._queryAllDescription, s) + def _queryOne(self, conn, s): if self.debug: self.printDebug(conn, s, 'QueryOne') |