Re: libpq, PQExecParams and the inserting of binary data - Mailing list pgsql-interfaces

From Volkan YAZICI
Subject Re: libpq, PQExecParams and the inserting of binary data
Date
Msg-id 7104a737050604065267a108b@mail.gmail.com
Whole thread Raw
In response to Re: libpq, PQExecParams and the inserting of binary data  ("Daniel Verite" <daniel@manitou-mail.org>)
Responses Re: libpq, PQExecParams and the inserting of binary data
List pgsql-interfaces
Hi,

On 6/4/05, Daniel Verite <daniel@manitou-mail.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.


pgsql-interfaces by date:

Previous
From: "Daniel Verite"
Date:
Subject: Re: libpq, PQExecParams and the inserting of binary data
Next
From: Tom Lane
Date:
Subject: Re: libpq, PQExecParams and the inserting of binary data