On Dec 13, 2005, at 2:14 PM, Jorge Godoy wrote:


Jared Kuolt <[EMAIL PROTECTED]> writes:

I just have to wrap it with hub.being() and hub.commit() and it works
but I got really frustrated trying to figure that out.

Thoughts?

I think this change is surprising everyone and making some parts of TG
unusable without resorting to other tools (such as creating users to use with
the identity framework).

One solution is just to make the TG shell do something like this:

hub.begin()
try:
    execute_input()
    hub.commit()
except:
    hub.rollback()
    raise

The psql tool for PostgreSQL does something like this. Autocommit is implemented by the client, not the server.

I guess what would be needed is for the tool to have before-input, after-input, and on-exception hooks, and for a hook to be written that keeps a weakref to all hubs so that it can do this.

I'm of course assuming that hubs support nesting of transactions, because it would be even more surprising if users couldn't manually do them! Otherwise you'd need some way to disable the hook if it's detected that the hub is currently in some kind of transaction.

-bob

Reply via email to