kinterbasdb exception

John Bradbury john_bradbury at ___cableinet.co.uk
Fri Sep 27 14:39:00 EDT 2002


What is wrong with the code below?  When the kintebasdb.Error fires it does
not seem to clear as all the subsequent INSERTs cause the execption..  Do
you have to do something the clear the exception?

Any help gratefully received.

John Bradbury


    TABLE_NAME = "CLIENTS"
    cur.execute('select TEL,MIN(CLIENTCODE)AS CLIENTCODE from %s GROUP BY
TEL HAVING TEL IS not NULL AND TEL <> ""' % TABLE_NAME)
    i = 0
    while 1:
        row = cur.fetchonemap()
        if row is None:
            break
        i = i + 1
        if i % 100 == 0:
            print "Inserted %d %s" % (i, TABLE_NAME)
        ky = cleanit(row['TEL'])
        if ky <> "":
            try:
                curupd.execute('INSERT INTO PH (TEL,CLIENT_LINGUIST,DBCODE)
VALUES ("%s","CLIENTS","%s")' % (ky,row['CLIENTCODE']))
            except kinterbasdb.Error:
                print "Duplicate %s" % ky






More information about the Python-list mailing list