On Tue, 2004-06-15 at 02:40, Ahmed MOHAMED ALI wrote:
> The connection object that you are using is your original connection,
> the Transaction create a new connection,so you must use that one.
> The transaction class uses internally this connection.It exposes the
> same interface than the connection itself and use a delegation mechanism
> to communicate with the database server.Here's how you can modify your code
> to
> work with transaction:
>
> <begin modified code>
> trans = WKVTestTable._connection.transaction()
> for i in xrange(1000):
> newrec = WKVTestTable(connection=trans,...) --> set the connection argument
> to be the transaction itself
> trans.commit()
> </end modified code>
Thank you, I had stared at the example in the doc and failed to notice
the "trans" argument on the get (let alone consider it as a potential
argument for the class instantiation). I am a little disturbed however
as this implies that I cannot have a field named connection in my
DB table, is that correct? I would kinda expect that a wrapper would
take steps to not collide with potential user defined fields (much
like the __SO__ prefixing that is done).
Thanks again,
William.
|