Hello,
   i have a problem with QSqlQuery, i have a column "nombre" with an unique 
index (constraint), i am doing
many inserts from PyQT (ODBC driver), i have the same problem from windows 
client and linux client, when any
of the inserts of the prepared query have a duplicated unique column all the 
executed later gives me the same
error but the insert works, i will explain here:

i prepare the query:

queryinsertmaxdb = QSqlQuery(maxdb)
queryinsertmaxdb.prepare("INSERT INTO NAMESPACE.MODELO_FAMILIA (FAMILIA_ID, 
NOMBRE, SECCION) VALUES (?, ?, ?)")

later inside a loop for every value in a list i do this:

queryinsertmaxdb.addBindValue(QVariant(codigo_familia))
queryinsertmaxdb.addBindValue(QVariant(nombre_familia))
queryinsertmaxdb.addBindValue(QVariant(seccion_familia))
queryinsertmaxdb.exec_()

all works fine but when it finds an integrity constraint violation:
INSERT INTO NAMESPACE.MODELO_FAMILIA (FAMILIA_ID, NOMBRE, SECCION) VALUES 
(8325, TENIS MUJER, 2)
Unable to execute statement:   [SAP AG][LIBSQLOD SO][MaxDB] Integrity 
constraint violation;250 POS(1)
Duplicate secondary key:UQ_NOMBRE [SAP AG][LIBSQLOD SO][MaxDB] Integrity 
constraint violation;250 POS(1)
Duplicate secondary key:UQ_NOMBRE

this insert does not works and it is correct (because it has the column name 
duplicated) but all the inserts
after this gives me the same errors and all of them do correctly the insert 
because dont have a duplicate
secondary key really, what can be the problem? I suppose with qsqlquery exec 
method reset the errors of last
query but i thinks it is not working. Thanks in advance.
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to