Ed Leafe escreveu:
> On Apr 15, 2009, at 9:30 AM, Pedro Vale de Gato wrote:
>
>   
>> # this is the recomended way to do it, dabo cannot use this
>> # cur = conn.cursor()
>>     
>
>       Why wouldn't you write this as:
>
> cur = conn._cnx.cursor()
>   

dBackend defines getDictCursorClass wich must return the class of the 
cursor, not an instance, on mysql for instance we can just return 
MySQLdb.cursors.DictCursor as it can be instanced passing a connection 
object as argument.

Dabo assumes it can do this:

cur = CursorClass(connection)

On pymssql it cannot, the pymssqlCnx is not the connection itself, 
pymssqlCnx._cnx is!, thats why i have defined getDictCursorClass as:

    def getDictCursorClass(self):
        import pymssql
        class conCursor(pymssql.pymssqlCursor):
            def __init__(self, src):
                self.super(src._cnx)

            def _getconn(self):
                return self.__source
            # pymssql doesn't supply this optional dbapi attribute, so 
create it here.
            connection = property(_getconn, None, None)
        return conCursor

Regards,
Pedro Vale de Gato

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to