0

I inserted entity "a" into table with unique column content. Then

Db.driver().commitTransaction()

Then begin new transaction and repeated. Transaction failed. As I can guess next action is automatic transacion rollback. Then I tried

Dlg.Table.model().select()

but it returned 0 rows (although there are several rows in table). Why? How to fix this?

EDIT: No, rollback have to be done manually.

2
  • Why downvote? I'll try not to repeat this mistake in the future Commented Jan 13, 2011 at 7:03
  • 1
    You need to post more code for somebody to be able to answer this. Right now this is completely out of context. Commented Jan 13, 2011 at 8:58

1 Answer 1

1

Only solution that I have found is using something like this function:

def refresh_model(Dlg):
    Dlg.Model = QSqlRelationalTableModel()
    Dlg.Model.setTable(Dlg.TableName)
    Dlg.Model.setEditStrategy(QSqlTableModel.OnManualSubmit)
    for Col in range(len(DisplColNames[Dlg.TableName])):
        Dlg.Model.setHeaderData( Col, Qt.Horizontal, DisplColNames[Dlg.TableName][Col])
    Dlg.tvTable.setModel(Dlg.Model)
    Dlg.Model.select()

But why I need to set new model after fail of transaction is unclear.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.