Changeset 839

Show
Ignore:
Timestamp:
03/12/07 20:49:45 (1 year ago)
Author:
mfenniak
Message:

add row_description fields

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • pg8000/trunk/pg8000.py

    r838 r839  
    280280        description = property(lambda self: self._getDescription()) 
    281281        def _getDescription(self): 
    282             return None 
     282            if self.cursor.row_description == None: 
     283                return None 
     284            columns = [] 
     285            for col in self.cursor.row_description: 
     286                columns.append((col["name"], col["type_oid"])) 
     287            return columns 
    283288 
    284289        def execute(self, operation, args=()): 
     
    412417        self.c.close_statement(self._statement_name) 
    413418 
     419    row_description = property(lambda self: self._getRowDescription()) 
     420    def _getRowDescription(self): 
     421        return self._row_desc.fields 
     422 
    414423    ## 
    415424    # Run the SQL prepared statement with the given parameters. 
     
    529538        self.connection = connection 
    530539        self._stmt = None 
     540 
     541    row_description = property(lambda self: self._getRowDescription()) 
     542    def _getRowDescription(self): 
     543        if self._stmt == None: 
     544            return None 
     545        return self._stmt.row_description 
    531546 
    532547    ## 
  • pg8000/trunk/pg8000-test.py

    r834 r839  
    6767cur1 = pg8000.Cursor(db) 
    6868cur1.execute("SELECT * FROM t1") 
     69print repr(cur1.row_description) 
    6970s1 = pg8000.PreparedStatement(db, "SELECT f1, f2 FROM t1 WHERE f1 > $1", int) 
    7071i = 0