From: Pascal Viandier <pascal@accovia.com>
To: pgsql-odbc@postgresql.org
Subject: Problems updating rows
Date: Thu, 27 Jul 2006 15:53:32 -0400
Message-ID: <00f001c6b1b6$5713fdd0$270210ac@windows.accovia.com> (raw)
Hi,
I am modifying existing programs that were bound to Informix to use ODBC.
All this under SUN Solaris.
I use unixODBC and setup 3 databases to connect to through ODBC:
- Informix ODBC (CLI)
- MySQL
- PostgreSQL.
I have a test program that makes various ODBC calls (Connect, Select, Insert,
Update, Delete) to these databases. This program works well with the two others.
I use PostgreSQL 8.1.4 and psqlodbc-08.01.0200.
My problem with the PostgreSQL ODBC is: I cannot Update or Delete rows using
SQLSetPos().
I have seen many threads on this subject in this newsgroup but I cannot figure
out what to do to have it work.
First, I re-created the database with oids since they look essential in this
case.
Then I put UpdatableCursors=1 in odbc.ini, as seen in other threads
Here is the odbc.ini part for pgodbc:
[lt]
Driver=/home/pascal/ODBC/libpsqlodbcw.so
Description=PostgreSQL ODBC DRIVER
ServerName=mbench
Database=lt
Port=5432
UserName=postgres
Password=postgres
ReadOnly=0
RowVersioning=1
ShowSystemTables=0
ShowOidColumn=1
FakeOidIndex=0
UpdatableCursors=1
UseDeclareFetch=1
CommLog=1
Debug=1
Trace=Yes
TraceFile=/tmp/pgsql.log
The main problem is I cannot change the cursor type of the SELECT statement.
When calling SQLSetStmtAttr(hstmt, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER)
SQL_CURSOR_KEYSET_DRIVEN, 0); as seen in an other thread, I get a return code of
SQL_SUCCESS_WITH_INFO and SQLDiagRec returns:
SQLSTATE:01S02
NATIVE CODE: 16
MESSAGE: Requested value changed.
If I call SQLGetStmtAttr(..., SQL_ATTR_CURSOR_TYPE,...); it returns
SQL_CURSOR_STATIC.
I really think this is why I cannot update or delete rows using SQLSetPos() but
I don't know why I cannot change the cursor type.
I have to say, I spent some hours reading this newsgroup to try finding a
solution but I am completely stuck now.
Any help would be greatly appreciated.
Thanks in advance.
Pascal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: pascal@accovia.com
Subject: Re: Problems updating rows
In-Reply-To: <00f001c6b1b6$5713fdd0$270210ac@windows.accovia.com>
References: <00f001c6b1b6$5713fdd0$270210ac@windows.accovia.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox