Lists: | pgsql-odbc |
---|
From: | "Support" <support(at)insyde(dot)com(dot)br> |
---|---|
To: | <pgsql-odbc(at)postgresql(dot)org> |
Subject: | Fw: problem on treatment when add a duplicate primary key |
Date: | 2003-02-04 18:44:36 |
Message-ID: | 002001c2cc7d$79985580$1bfaabc8@insyde |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-odbc |
----- Original Message -----
From: "Support" <support(at)insyde(dot)com(dot)br>
To: "Support" <support(at)insyde(dot)com(dot)br>
Sent: Tuesday, February 04, 2003 4:41 PM
Subject: Re: [ODBC] problem on treatment when add a duplicate primary key
>
> ----- Original Message -----
> From: "Support" <support(at)insyde(dot)com(dot)br>
> To: <pgsql-odbc(at)postgresql(dot)org>
> 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.
>
>
>
From: | "Support" <support(at)insyde(dot)com(dot)br> |
---|---|
To: | <pgsql-odbc(at)postgresql(dot)org> |
Subject: | Repost: problem on treatment when add a duplicate primary key |
Date: | 2003-02-06 15:43:21 |
Message-ID: | 000a01c2cdf6$7bd068e0$80faabc8@insyde |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-odbc |
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).
I'm using 04/02/2003 CVS version
Browsing the source I found that this was missing (please correct if
wrong):
environ.c
case ERROR_DUPLICATED_ENTRY:
pg_sqlstate_set(szSqlState, "23000", "S1010");
// entry already exists
break;
case ERROR_DUPLICATED_KEY:
pg_sqlstate_set(szSqlState, "23000", "S1010");
// key already exists
break;
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