You could manipulate the values & insert the modified values or update for a
dip value?

::Sent from my Verizon HTC incredible gOS::

On Sep 7, 2010 3:12 PM, "Zhang Huangbin" <[email protected]> wrote:
> Hi, all.
>
> When i try to insert a duplicate record, it will raise an error:
>
> ----
>>>> try:
>>>> db.insert(xxx)
>>>> except Exception, e:
>>>> print >> sys.stderr, e
>
> (1062, "Duplicate entry 'xxx' for key 1")
> ----
>
> Error code of "Duplicate entry" is MySQLdb.constants.ER.DUP_ENTRY (1062),
but below code with "except ER.DUP_ENTRY" doesn't work at all:
>
> ----
>>>> from MySQLdb.constants import ER
> ...
>>>> try:
>>>> db.insert(xxx)
>>>> except ER.DUP_ENTRY:
>>>> print >> sys.stderr, 'get exception'
> ----
>
> Is there a better way to catch MySQLdb exceptions?
>
> Thanks very much. :)
>
> --
> You received this message because you are subscribed to the Google Groups
"web.py" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
[email protected] <webpy%[email protected]>.
> For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to