Hi, 

I'm trying to use a QDataBrowser to browse and manipulate some records.  The
problem is that I'm not being able to set a new ID before inserting the record
and it is overwriting the only record available all the time.

My table structure -- this is a PostgreSQL database -- is:

symbol -> varchar(9)
name   -> varchar(30)
id     -> serial


My "primeInsert()" handler is:


    def dbGetNewUnitsID(self, record):
        query = QSqlQuery("SELECT NEXTVAL('units_id_seq')")
        query.execQuery()
        query.first()
        record.setValue('id', query.value(0))


It gets invoked correctly, it even executes the query, but it doesn't insert
the record as part of the transaction after getting the new ID.

Is there something else I should be doing?  Is it the correct way to handle
this kind of thing to create a new button to get the correct ID and then use
the 'Insert' button to make the insertion on the database?


Thanks in advance,

-- 
Jorge Godoy      <[EMAIL PROTECTED]>


_______________________________________________
PyKDE mailing list    [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to