From: Robin Whitworth <rwhit@goldwiretech.com>
To: Byron Nikolaidis <byronn@solipsys.com>
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] ODBC & bytea
Date: Wed, 23 Jun 1999 15:14:57 -0400
Message-ID: <37713231.78497751@goldwiretech.com> (raw)
References: <377103C7.D695CB9E@goldwiretech.com>
<37711BFE.1E6EEA3C@solipsys.com>
Here are the relevant portions from the log. The statement
being executed was:
"INSERT INTO gwt_type_test (type_binary) VALUES (?)"
The buffers bound to the input parameter (as SQL_C_BINARY)
were:
ubyte value1[] = "backslash: \\";
ubyte value2[] = "single quote: '";
The log:
DSN info: DSN='rwhit',server='localhost',port='5432',dbase='rwhit',user='',passw
d=''
readonly='0',protocol='',showoid='',fakeoidindex='',showsystable=''
conn_settings=''
translation_dll='',translation_option=''
conn = 134729648, SQLConnect(DSN='rwhit', UID='rwhit', PWD='')
Global Options: Version='06.30.0250', fetch=100, socket=4096, unknown_sizes=0, m
ax_varchar_size=8190, max_longvarchar_size=8190
disable_optimizer=1, unique_index=0, use_declarefetch=0
text_as_longvarchar=1, unknowns_as_longvarchar=0, bools_as_char=
1
extra_systable_prefixes='dd_;', conn_settings=''
conn=134729648, query=' '
conn=134729648, query='set DateStyle to 'ISO''
conn=134729648, query='set geqo to 'OFF''
...
conn=134729648, query='BEGIN'
conn=134729648, query='INSERT INTO gwt_type_test(type_binary) VALUES ('backslash
: \\\000')'
ERROR from backend during send_query: 'ERROR: Bad input string for type bytea'
conn=134729648, query='COMMIT'
STATEMENT ERROR: func=SC_execute, desc='', errnum=1, errmsg='Error while executi
ng the query'
------------------------------------------------------------
hdbc=134729648, stmt=134816168, result=0
manual_result=0, prepare=1, internal=0
bindings=0, bindings_allocated=0
parameters=134766824, parameters_allocated=1
statement_type=1, statement='INSERT INTO gwt_type_test(type_bin
ary) VALUES (?)'
stmt_with_params='INSERT INTO gwt_type_test(type_binary) VALUES
('backslash: \\\000')'
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_CUR0x80921a8'
----------------QResult Info -------------------------------
CONN ERROR: func=SC_execute, desc='', errnum=10, errmsg='ERROR: Bad input strin
g for type bytea'
------------------------------------------------------------
henv=134729096, conn=134729648, status=1, num_stmts=16
sock=134735944, stmts=134744192, lobj_type=-999
---------------- Socket Info -------------------------------
socket=6, reverse=0, errornumber=0, errormsg='(null)'
buffer_in=134735984, buffer_out=134740088
buffer_filled_in=2, buffer_filled_out=0, buffer_read_in=2
...
conn=134729536, query='BEGIN'
conn=134729536, query='INSERT INTO gwt_type_test(type_binary) VALUES ('single qu
ote: '\\000')'
ERROR from backend during send_query: 'ERROR: parser: parse error at or near "\
"'
conn=134729536, query='COMMIT'
STATEMENT ERROR: func=SC_execute, desc='', errnum=1, errmsg='Error while executi
ng the query'
------------------------------------------------------------
hdbc=134729536, stmt=134816056, result=0
manual_result=0, prepare=1, internal=0
bindings=0, bindings_allocated=0
parameters=134766712, parameters_allocated=1
statement_type=1, statement='INSERT INTO gwt_type_test(type_bin
ary) VALUES (?)'
stmt_with_params='INSERT INTO gwt_type_test(type_binary) VALUES
('single quote: '\\000')'
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_CUR0x8092138'
----------------QResult Info -------------------------------
CONN ERROR: func=SC_execute, desc='', errnum=10, errmsg='ERROR: parser: parse e
rror at or near "\"'
------------------------------------------------------------
henv=134728984, conn=134729536, status=1, num_stmts=16
sock=134735832, stmts=134744080, lobj_type=-999
---------------- Socket Info -------------------------------
socket=5, reverse=0, errornumber=0, errormsg='(null)'
buffer_in=134735872, buffer_out=134739976
Byron Nikolaidis wrote:
>
> Robin Whitworth wrote:
>
> > I'm having trouble inserting binary data into a column of
> > type bytea using a dynamic INSERT. The trouble seems to be if the
> > data contains the values 0x5C (ASCII backslash) or 0x27 (ASCII
> > singlequote). When I bind the input values for these I'm using
> > SQL_C_BINARY. Shouldn't the data just be passed straight through,
> > without any evaluation? Is there something special I need to
> > do to make this work (or is this a bug?)
> >
>
> Sounds like a bug. You should be able to see exactly what is being
> sent to the backend by using the driver's log feature. Could you send
> that logfile which shows the error.
>
> Byron
--
.........................................................
Robin Whitworth Gold Wire Technology Inc.
rwhit@goldwiretech.com P.O. Box 103
617.876.9473x1603 Belmont, MA 02478-0001
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 using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: rwhit@goldwiretech.com, byronn@solipsys.com
Subject: Re: [INTERFACES] ODBC & bytea
In-Reply-To: <37713231.78497751@goldwiretech.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