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

Bug in convert.c copy_and_convert_field

From: Paul Cochrane <paul(dot)m(dot)cochrane(at)tuht(dot)scot(dot)nhs(dot)uk>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Bug in convert.c copy_and_convert_field
Date: 2005-02-11 17:28:28
Message-ID: 420CEB3C.4050003@tuht.scot.nhs.uk (view raw or flat)
Thread:
Lists: pgsql-odbc
Hi again list.

I think I've encountered a bug in the file convert.c -  
copy_and_convert_field procedure. Unfortunately my C is a little out of 
practise not having done it for 10 years or so. Can anyone help? I think 
I've traced the error to the default part of the switch around line 850 
(that where the dodgy lines are being placed in the mylog file so it's 
somewhere before that). Below is a snippet of the mylog showing the 
problem. The lines where it is saying DEFAULT: & the ptr part of the 
string. In some cases this is correct but in others there are lots of 
extra / strange characters. The len field always seems to be correct 
however.

The log file ends with a single ' which may explain the error I get on 
the server (1) could not receive data from client: Connection reset by 
peer and (2) unexpected EOF on client connection




]**** SC_fetch: manual_result
[2052]fetch: cols=13, lf=0, opts = 137569848, opts->bindings = 
137610576, buffer[] = 35483564
[2052]type = 1043
[2052]manual_result
[2052]value = ''
[2052]copy_and_convert: field_type = 1043, fctype = 1, value = '', 
cbValueMax=129
[2052]DEFAULT: len = 0, ptr = '8Ã3ts'
[2052]    SQL_C_CHAR, default: len = 0, cbValueMax = 129, 
rgbValueBindRow = ''
[2052]copy_and_convert: retval = 0
[2052]fetch: cols=13, lf=1, opts = 137569848, opts->bindings = 
137610576, buffer[] = 35483695
[2052]type = 1043
[2052]manual_result
[2052]value = 'public'
[2052]copy_and_convert: field_type = 1043, fctype = 1, value = 'public', 
cbValueMax=129
[2052]DEFAULT: len = 6, ptr = 'public'
[2052]    SQL_C_CHAR, default: len = 6, cbValueMax = 129, 
rgbValueBindRow = 'public'
[2052]copy_and_convert: retval = 0
[2052]fetch: cols=13, lf=2, opts = 137569848, opts->bindings = 
137610576, buffer[] = 35483826
[2052]type = 1043
[2052]manual_result
[2052]value = 'LOGIN'
[2052]copy_and_convert: field_type = 1043, fctype = 1, value = 'LOGIN', 
cbValueMax=129
[2052]DEFAULT: len = 5, ptr = 'LOGINc'
[2052]    SQL_C_CHAR, default: len = 5, cbValueMax = 129, 
rgbValueBindRow = 'LOGIN'
[2052]copy_and_convert: retval = 0
[2052]fetch: cols=13, lf=3, opts = 137569848, opts->bindings = 
137610576, buffer[] = 35483957
[2052]type = 21
[2052]manual_result
[2052]value = '0'
[2052]copy_and_convert: field_type = 21, fctype = 5, value = '0', 
cbValueMax=2
[2052]copy_and_convert: retval = 0
[2052]fetch: cols=13, lf=4, opts = 137569848, opts->bindings = 
137610576, buffer[] = 35483961
[2052]type = 1043
[2052]manual_result
[2052]value = ''
[2052]copy_and_convert: field_type = 1043, fctype = 1, value = '', 
cbValueMax=129
[2052]DEFAULT: len = 0, ptr = '8Ã3 To'
[2052]    SQL_C_CHAR, default: len = 0, cbValueMax = 129, 
rgbValueBindRow = ''
[2052]copy_and_convert: retval = 0
[2052]fetch: cols=13, lf=5, opts = 137569848, opts->bindings = 
137610576, buffer[] = 35484092
[2052]type = 1043
[2052]manual_result
[2052]value = 'LOGIN_pkey'
[2052]copy_and_convert: field_type = 1043, fctype = 1, value = 
'LOGIN_pkey', cbValueMax=129
[2052]DEFAULT: len = 10, ptr = 'LOGIN_pkey'
[2052]    SQL_C_CHAR, default: len = 10, cbValueMax = 129, 
rgbValueBindRow = 'LOGIN_pkey'
[2052]copy_and_convert: retval = 0
[2052]fetch: cols=13, lf=6, opts = 137569848, opts->bindings = 
137610576, buffer[] = 35484223
[2052]type = 21
[2052]manual_result
[2052]value = '3'
[2052]copy_and_convert: field_type = 21, fctype = 5, value = '3', 
cbValueMax=2
[2052]copy_and_convert: retval = 0
[2052]fetch: cols=13, lf=7, opts = 137569848, opts->bindings = 
137610576, buffer[] = 35484227
[2052]type = 21
[2052]manual_result
[2052]value = '1'
[2052]copy_and_convert: field_type = 21, fctype = 5, value = '1', 
cbValueMax=2
[2052]copy_and_convert: retval = 0
[2052]fetch: cols=13, lf=8, opts = 137569848, opts->bindings = 
137610576, buffer[] = 35484231
[2052]type = 1043
[2052]manual_result
[2052]value = 'Login'
[2052]copy_and_convert: field_type = 1043, fctype = 1, value = 'Login', 
cbValueMax=129
[2052]DEFAULT: len = 5, ptr = 'LoginTo'
[2052]    SQL_C_CHAR, default: len = 5, cbValueMax = 129, 
rgbValueBindRow = 'Login'
[2052]copy_and_convert: retval = 0
[2052]fetch: cols=13, lf=9, opts = 137569848, opts->bindings = 
137610576, buffer[] = 35484362
[2052]type = 18
[2052]manual_result
[2052]value = 'A'
[2052]copy_and_convert: field_type = 18, fctype = 1, value = 'A', 
cbValueMax=2
[2052]DEFAULT: len = 1, ptr = 'AÃ3Nc'
[2052]    SQL_C_CHAR, default: len = 1, cbValueMax = 2, rgbValueBindRow 
= 'A'
[2052]copy_and_convert: retval = 0
[2052]fetch: cols=13, lf=10, opts = 137569848, opts->bindings = 
137610576, buffer[] = 35484366
[2052]type = 23
[2052]manual_result
[2052]value = '<NULL>'
[2052]copy_and_convert: field_type = 23, fctype = 4, value = '<NULL>', 
cbValueMax=4
[2052]copy_and_convert: retval = 0
[2052]fetch: cols=13, lf=11, opts = 137569848, opts->bindings = 
137610576, buffer[] = 35484372
[2052]type = 23
[2052]manual_result
[2052]value = '<NULL>'
[2052]copy_and_convert: field_type = 23, fctype = 4, value = '<NULL>', 
cbValueMax=4
[2052]copy_and_convert: retval = 0
[2052]fetch: cols=13, lf=12, opts = 137569848, opts->bindings = 
137610576, buffer[] = 35484378
[2052]type = 1043
[2052]manual_result
[2052]value = '<NULL>'
[2052]copy_and_convert: field_type = 1043, fctype = 1, value = '<NULL>', 
cbValueMax=129
[2052]copy_and_convert: retval = 0
[2052][[SQLFetch]][2052]PGAPI_ExtendedFetch: stmt=137569712
[2052]SQL_FETCH_NEXT: num_tuples=7, currtuple=0
[2052]PGAPI_ExtendedFetch: new currTuple = 0
[2052]manual_result = 1, use_declarefetch = 1
[2052]**** SC_fetch: manual_result
[2052]fetch: cols=13, lf=0, opts = 137569848, opts->bindings = 
137610576, buffer[] = 35483564
[2052]type = 1043
[2052]manual_result
[2052]value = ''
[2052]copy_and_convert: field_type = 1043, fctype = 1, value = '', 
cbValueMax=129
[2052]DEFAULT: len = 0, ptr = '8Ã3nTo'
[2052]    SQL_C_CHAR, default: len = 0, cbValueMax = 129, 
rgbValueBindRow = ''
[2052]copy_and_convert: retval = 0

; This is how the mylog ends

[2052]copy_and_convert: field_type = 1043, fctype = 1, value = 
'Classification', cbValueMax=129
[2052]DEFAULT: len = 14, ptr = '

-- 
  Paul Cochrane       (paul(dot)m(dot)cochrane(at)tuht(dot)scot(dot)nhs(dot)uk)
+--------------------------------------------------------
| Tayside Orthopaedic & Rehabilitation Technology Centre
| Ninewells Hospital & Medical School
| Dundee, Scotland, UK.	
| DD1 9SY
| Phone: Internal: 36284
|        External: +44 (1382) 496284
| Fax:   +44 (1382) 496322
+--------------------------------------------------------	


Responses

pgsql-odbc by date

Next:From: Paul CochraneDate: 2005-02-11 18:06:27
Subject: Re: Bug in convert.c copy_and_convert_field
Previous:From: Paul CochraneDate: 2005-02-11 12:19:50
Subject: Trip back in time

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