error code and string exchanged in python application

Hello.

1. I am writing the python program that uses 2.4.16 last dbxml. It seems that it is small bug there. I'm capture the blocking error when you try to manage the blockages. And when I catch him, I don't have the error string and the error code exchanged. Example of code might look like this:

def some_function (self):
Bq. # & lt; some preparations here & gt; ------While retry and max_tries & gt; 0:BQ. Try: bq. If self._transaction:bq. result = expr.execute (self._transaction, self._context)
Another thing:
Bq. result = expr.execute (self._context)
Self._RESULT = result.__iter__)
Self._executed = True
Retry = False

the XmlException exception, inst:
Bq. print inst.what # does not print the string, but the code here ("-30095")-inst.getDbErrno (print) # not print the code, but the chain here ("" Error: DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock ' ")------# so with this bug I have to write the following code:------if inst.what == DB_LOCK_DEADLOCK:bq. max_tries-= 1------retry = True
Bq. If self._transaction:bq. Self._transaction. Abort()

Another thing:
Bq. raise DatabaseError (inst.getDbErrno)



2. actually, I managed a blockage in a very simple way. I just launch 2 proceccess, insert the new node at the end of the same node in the same container. Blockages appear just after the second process is executed. How does such a thing happen? Simple simultaneous writing should we not resolved with locking and blocking of the system? The second process to wait for the first transaction finsh, shouldn't it?
3. I have a question about contexts. I can create two types of contexts - XmlQueryContext and XmlUpdateContext. Which of them should I use when I do a query that updates/inserts/replaces only some nodes in the document without having to work with the entire document with i.e. function updateDocument? The lock type is type of context or it is decided later after analysis of the query?

Hello

1. the XmlDatabaseException seems to have a constructor with arguments in the wrong order:
def __init__ (self, dberr, msg):
should be
def __init__ (self, msg, dberr):
In dbxml.py in the XmlDatabaseError constructor. Make sure that change and I would like to know how it works.

2. it depends on how you insert. If you insert a query which, apparently, you can do it is likely that the query part is what's blocking with the update. Calls simultaneous putDocument() in 2.4.16 will tend to back up on another. No matter, if you make simultaneous anything, you must manage the blocking. There will be less because the container expands.

3 contexts - use the one that calls the API. Querys, put to date or not, call for XmlQueryContext. Direct update (except Java) operations call for XmlUpdateContext. It can be made optional in Python in the future, but for now, it isn't.

Kind regards

George

Tags: Database

Similar Questions

Maybe you are looking for