Skip site navigation (1) Skip section navigation (2)

Strange Update query ...

From: Thomas Chabaud <tc(at)geosys(dot)fr>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Strange Update query ...
Date: 2006-03-31 14:00:29
Message-ID: 442D35FD.2050208@geosys.fr (view raw or flat)
Thread:
Lists: pgsql-odbc
Hello,
I have a problem with update on recordset with Visual Basic 6.

I'm using the recordset as following :

   Set rs = New ADODB.Recordset
   rs.Open "SELECT id,myfield1,myfield2,myfield3 from mytable where 
id=6",dbConn, adOpenKeyset, adLockOptimistic, adCmdText

   rs("myfield1").value = myvalue1
   rs("myfield2").value = myvalue2
   rs("myfield3").value = myvalue3
   rs.Update
   rs.close
   set rs=Nothing

But the line is not updated, so I checked the log, and I saw that the query 
which was generated by odbc driver is :

UPDATE mytable SET myfield1=myvalue1,myfield2=myvalue2,myfield3=myvalue3 
WHERE (id=6 AND myfield1=myvalue1 AND myfield2=myvalue2 AND myfield3=myvalue3 )'

I wonder why the odbc driver add those "AND ..." statement, because I think 
they are useless, and they fail my rs.update

I use the following connection parameters :

DRIVER={PostgreSQL 
ANSI};DATABASE=mydb;SERVER=localhost;PORT=5432;SSLMODE=prefer;UID=postgres;PWD=XXXXXXXXX;
ReadOnly=0;FakeOidIndex=0;ShowOidColumn=1;RowVersioning=1;ShowSystemTables=0;ConnSettings=;
Fetch=10000;Socket=4096;UnknownSizes=0;MaxVarcharSize=254;MaxLongVarcharSize=32767;
Debug=0;CommLog=1;Optimizer=1;Ksqo=0;UseDeclareFetch=0;TextAsLongVarchar=1;
UnknownsAsLongVarchar=1;BoolsAsChar=0;Parse=0;CancelAsFreeStmt=0;ExtraSysTablePrefixes=dd_;
LFConversion=1;UpdatableCursors=0;DisallowPremature=0;TrueIsMinus1=1;BI=0;ByteaAsLongVarBinary=0;
UseServerSidePrepare=0;LowerCaseIdentifier=0


Thanks in advance for your answers.

Regards,

Thomas

Responses

pgsql-odbc by date

Next:From: Johann ZuschlagDate: 2006-03-31 16:51:07
Subject: Re: Unicode is not UTF-8. was :psqlODBC-Driver Test / text
Previous:From: meDate: 2006-03-31 11:47:58
Subject: problem with latest stable driver

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group