[ODBC] Update

Поиск
Список
Период
Сортировка
От Alain Reymond
Тема [ODBC] Update
Дата
Msg-id 12c0ed39-08a0-6f19-f47b-caee35bc0b5b@gmail.com
обсуждение исходный текст
Ответы [ODBC] Materialized views trough ODBC  (koffi BADOH <koff10@hotmail.com>)
Список pgsql-odbc
Hello,

We are using psqlodbc to update a Postgresql database from embedded sql
for cobol.
We have a strange behaviour : the first time we update, the update is
correct (sqlcode 0). I we try the same update, the system return sqlcode
= 100 and sqlstate = 2000.

postgresql.x86_64                      9.2.18-1.el7
postgresql-odbc.x86_64                 09.03.0100-2.el7
unixODBC.x86_64                        2.3.1-11.el7
under Centos 7.2 64 bits.

Here an example to simulaute an upsert :

           exec sql
            UPDATE testtable SET
                num = :testtable-num
                , libelle = :testtable-libelle:testtable-libelle-NULL
                WHERE num = :testtable-num;
           end-exec
           if sqlcode = 100 then
             exec sql
              INSERT into testtable
                (
                num
                , libelle
               )
               SELECT
                  :testtable-num
                  , :testtable-libelle:testtable-libelle-NULL
              WHERE NOT EXISTS (SELECT 1 FROM testtable WHERE num =
:testtable-num);
             end-exec
           end-if
           if sqlcode = 0 then
              exec sql commit end-exec
           end-if

If I call two times the above code with the same content of
testtable-num and testtable-libelle, the first attempt is successful and
all other attempts, even changing the content of the variables, fails.

It was working good under Centos 5.9 32 bits, and Postgres 9.2.

Any idea why ?

Kind regards,

Alain



В списке pgsql-odbc по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: [ODBC] odbc
Следующее
От: Matthew Shaer
Дата:
Сообщение: [ODBC] GSS from windows