Re: AW: [INTERFACES] Postgres (NT), ODBC and DBTools - Mailing list pgsql-interfaces

From Ken J. Wright
Subject Re: AW: [INTERFACES] Postgres (NT), ODBC and DBTools
Date
Msg-id 3.0.1.32.19991103073343.00aeea20@ori-ind.com
Whole thread Raw
In response to AW: [INTERFACES] Postgres (NT), ODBC and DBTools  ("Teulings, Tim" <Tim.Teulings@materna.de>)
List pgsql-interfaces
>After looking at it again, I'm not sure if it is a problem with the
>colon. The "?" in the statement looks supicious (itis near the
>'where'
>stated in the error message). AFAIK ODBC does allow binding of
>variables
>(bind variable, bound expresion) and DBTools uses this. Is the "?"
>legal
>at this point (it references the value bound to a variable) or is it
>a
>error?

The '?' is fine but it's not getting replaced with the real value. The
stmt_with_params string in the log is the actual string sent to the backend
after parsing. I'm just guessing at the flag values, but it appears to me
that there was not a "Prepare" statement in your code after assigning the
sql string, and before assigning the parameter value. I'm not familiar with
DBTools, so I don't know how it handles prepares. Normally it would go
something like:

(pseudo code)
stmt.sql = 'select foo from bar where it = ?'
stmt.prepare
stmt.setparam(1,'avalue')
stmt.execute

Ken

>ERROR from backend during send_query: 'ERROR:  parser: parse error at
>or near "where"'

>                 hdbc=25902376, stmt=26161368, result=0
>                 manual_result=0, prepare=1, internal=0
>                 bindings=0, bindings_allocated=0
>                 parameters=25897048, parameters_allocated=1
>                 statement_type=2, statement='UPDATE CXMgl SET
>RowVersion = 2, Vorname = ? WHERE RowVersion = 1 AND MglID = 2776'
>                 stmt_with_params='UPDATE CXMgl SET RowVersion = 2,
>Vorname = ? WHERE RowVersion = 1 AND MglID = 2776'


>                 data_at_exec=-1, current_exec_param=-1, put_data=0
>                 currTuple=-1, current_col=-1, lobj_fd=-1
>                 maxRows=0, rowset_size=1, keyset_size=0,
>cursor_type=0, scroll_concurrency=1
>                 cursor_name='SQL_CUR018F30D8'
>                 ----------------QResult Info
>- -------------------------------
>CONN ERROR: func=SC_execute, desc='', errnum=110, errmsg='ERROR: 
>parser: parse error at or near "where"'



pgsql-interfaces by date:

Previous
From: "Aage J. Skjolingstad"
Date:
Subject: Re: [INTERFACES] ODBC connect from Linux to Postgresql db server
Next
From: "stuart"
Date:
Subject: sequences