Primary Key Violation Checking

Rich Shepard <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
   Now and then, as I enter data into my model, I get a pysqlite2 integrity error
such as this:

   File "/data1/eikos/fuzSetPage.py", line 557, in OnSave
     self.appData.cur.execute(stmt1,(self.fsName.capitalize(), self.fsVar,
pysqlite2.dbapi2.IntegrityError: columns name, parent, subcomp, comp are not
unique

   Before I re-invent the wheel, is there an example of wrapping the INSERT
statement to catch these errors and present them in a message box to the
user? Ideally, the message would show what values were attempted to be added
to the database, and what the existing row looks like. I did not see
anything appropriate on the web site in the comprehensive manual.

   I go looking for these errors using the sqlite3 command line editor, and I
can't find them.

Thanks,

Rich

-- 
Richard B. Shepard, Ph.D.               |    The Environmental Permitting
Applied Ecosystem Services, Inc.        |         Accelerators(TM)
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.