X-Original-To: pgsql-odbc@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4F269474E44 for ; Tue, 4 Feb 2003 13:49:37 -0500 (EST) Received: from paiol.terra.com.br (paiol.terra.com.br [200.176.3.18]) by postgresql.org (Postfix) with ESMTP id 7E358474E42 for ; Tue, 4 Feb 2003 13:49:36 -0500 (EST) Received: from botucatu.terra.com.br (botucatu.terra.com.br [200.176.3.78]) by paiol.terra.com.br (Postfix) with ESMTP id 753EB7CE2A for ; Tue, 4 Feb 2003 16:49:35 -0200 (BRST) Received: from insyde (200-171-250-27.customer.telesp.net.br [200.171.250.27]) (authenticated user insyde04) by botucatu.terra.com.br (Postfix) with ESMTP id 97E5129C0FC for ; Tue, 4 Feb 2003 16:49:34 -0200 (BRST) Message-ID: <002001c2cc7d$79985580$1bfaabc8@insyde> From: "Support" To: Subject: Fw: problem on treatment when add a duplicate primary key Date: Tue, 4 Feb 2003 16:44:36 -0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/16 X-Sequence-Number: 2634 ----- Original Message ----- From: "Support" To: "Support" Sent: Tuesday, February 04, 2003 4:41 PM Subject: Re: [ODBC] problem on treatment when add a duplicate primary key > > ----- Original Message ----- > From: "Support" > To: > Sent: Tuesday, February 04, 2003 8:46 AM > Subject: [ODBC] problem on treatment when add a duplicate primary key > > > > Hi, > > I'm getting an error when I try to insert a duplicated value in > > a primary key or unique index. > > I know I can't insert so I'll explain the thing: > > > > When I insert the first time the row, it works > > but if I try to re-insert it simply crashes my application, > > giving me errors that I couldn't treat (I can treat this error in > > MSSQL ODBC Driver and MySQL ODBC Driver). > > > > Browsing the source I found that this was missing (please correct if > wrong): > > > > environ.c > > > > case ERROR_DUPLICATED_ENTRY: > > pg_sqlstate_set(env, szSqlState, "23000", ??????); > > // entry already exists > > break; > > case ERROR_DUPLICATED_KEY: > > pg_sqlstate_set(env, szSqlState, "23000", ???????); > > // key already exists > > break; > > (didn't find the second code yet. What is it?) > > statement.h > > > > #define ERRROR_DUPLICATED_ENTRY 34 > > #define ERRROR_DUPLICATED_KEY 35 > > (next numbers of the sequence) > > > > I'm still investigating, but if any of you know about it, > > let me know. > > > > I also don't know if ERRROR_DUPLICATED_ENTRY > > and ERRROR_DUPLICATED_KEY are valid return codes > > and where to put them. If someone can help. > > > > TIA, > > Ricardo > > Sorry, environ.c should be: > environ.c > > case ERROR_DUPLICATED_ENTRY: > pg_sqlstate_set(szSqlState, "23000", "23000"/*(?)*/); > // entry already exists > break; > case ERROR_DUPLICATED_KEY: > pg_sqlstate_set(szSqlState, "23000", "23000"/*(?)*/); > // key already exists > break; > > without "env" > > Ricardo. > > >