Re: Primary Key Violation Checking

Adrian Klaver <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
On Sunday 28 October 2007 4:46 pm, Rich Shepard wrote:
>    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
Are you talking INSERT or UPDATE?  The part about checking the existing row 
would seem to imply an UPDATE.
-- 
Adrian Klaver
[email protected]
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.