[Twisted-Python] Again about query mapped
linuxbox at interfree.it
Tue Jun 15 04:22:33 EDT 2004
Il mar, 2004-06-15 alle 01:14, Dave Peticolas ha scritto:
> You can use runInteraction to get at the cursor directly
> (see the example I just posted for another message). The
> cursor is wrapped by the transaction object passed as the
> first argument to the interaction callback.
this is what I produced, subclassing connectionpool,
I hope it's right (well it works :) but I'm new at twisted so I don't
know if it just works or it does it in the right way), the
db_row module is linked in my past mail, comments?:
from twisted.enterprise import adbapi
from db_row import *
def mappedInteraction(self, transaction, sql_string):
"Returns the result of a query in a more useful way"
# Make a class to store the resulting rows
R = IMetaRow(transaction.description)
# Build the rows from the row class and each tuple returned from
results = [ R(row) for row in transaction.fetchall() ]
def runMappedQuery(self, sql_string):
"Runs the query"
More information about the Twisted-Python