It would be nice if I could access the original mixed case column names of a query result (not only the lower cased). Reason: I would like the names as headers for a .csv, and the original mixed case versions are more readable. (I don't like underline in names and use camel notation instead.)
For myself I have written an extension in a class inheriting from Cursor - which is not nice, because it is dependant of internal implementation of Cursor.
The call of getMixedCaseColumnNames() for the cursor instance makes these names available.
Of course this is only a workaround and an implementation in adodbapi would be much better.
Here it is:
"wie adodbapi.Cursor aber mit Erweiterung getMixedCaseColumnNames()" def __init__(self, baseCursor): self.__dict__["_cursor"] = baseCursor def __getattr__(self, attr): #print "getAttribute", attr return getattr(self.__dict__["_cursor"], attr) def __setattr__(self, attr, value): #print "setAttr", attr, value return setattr(self.__dict__["_cursor"], attr, value) def getMixedCaseColumnNames(self): "wie columnNames, aber mixed case" colNames = structuredConfig.CommonOptions() for i in range(self.numberOfColumns): fld = self.rs.Fields(i) colNames[fld.Name] = i # columnNames lookup return colNames
(Of course there is also a similar construction for Connection, by which this class is instantiated.)