Scott Frankel ha scritto:

Am I missing something obvious? I've tried to peek inside using queryModel.lastError(), but it's returning a memory address. Not sure how to get a string from this method.

I hope someone on the list can help shed light on this problem.

I don't know what's happen (it seems an issue with the database) but if you want to catch the error when committing, you have to know that the function mapper.submit() return true if the operation is ok, or false otherwise. So, to catch an exception:

if not mapper.submit():
    # using the .text() function return the error as string
    print "Error on committing: %s" % (model.lastError().text())
else:
    print "Everything is ok!"

In some cases, for example if you delete some records, you need to use the model.submit() function instead.

--
Simone


Chiacchiera con i tuoi amici in tempo reale! http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to