Re: libpq, PQExecParams and the inserting of binary data

From: Volkan YAZICI <volkan(dot)yazici(at)gmail(dot)com>
To: Daniel Verite <daniel(at)manitou-mail(dot)org>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: libpq, PQExecParams and the inserting of binary data
Date: 2005-06-04 13:52:27
Message-ID: 7104a737050604065267a108b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hi,

On 6/4/05, Daniel Verite <daniel(at)manitou-mail(dot)org> wrote:
> Are you passing a NULL pointer in paramLengths? You need to
> pass an array containing the actual length of your binary data.

Yes, paramLengthts is a NULL pointer. But, is SegFault an expected result?

Himms... When I take a look at src/interfaces/libpq/fe-exec.c:

956 if (paramValues && paramValues[i])
957 {
958 int nbytes;
960 if (paramFormats && paramFormats[i] != 0)
961 {
962 /* binary parameter */
963 nbytes = paramLengths[i];

It appears to be SegFault was caused by paramLengths[i] on line 963.
So, this means, user _has_to_ specify the size of input while using
binary data. Maybe a "if ( paramLengths )" check can be useful.

Regards.

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2005-06-04 14:57:42 Re: libpq, PQExecParams and the inserting of binary data
Previous Message Daniel Verite 2005-06-04 13:36:20 Re: libpq, PQExecParams and the inserting of binary data