> -----Original Message-----
> From: Zoltan Boszormenyi [mailto:zboszor@dunaweb.hu]
> Sent: 03 August 2005 19:08
> To: Dave Page
> Cc: pgsql-odbc@postgresql.org
> Subject: Re: [ODBC] New libpq based driver snapshot
> 08.01.0003 available
>
> I got these on compiling the latest CVS
> using the RedHat RawHide src.rpm environment:
<snip>
>
> You guessed right, 64 bit system, FC3/x86-64.
Well, I guessed 64 bit at least :-) I have an x86-64 FC4 box kicking
around so I'll look into this.
> I used NULL as the last parameter of SQLBindCol() for every fields
> meaning I don't care to be notified about NULL values.
>
> Last thing I tried was to use 3 SQLINTEGER for the 3 fields that may
> have NULL values and use &null_val1, etc. as the last parameter
> for SQLBindCol(). And it finally fixed it, I get all the rows that
> e.g. psql produce for the same query.
>
> I looked quickly at the sources and copy_and_convert_field() in
> convert.c has this at line 481:
>
> -----------------------------------------------
> if (!value)
> {
> /*
> * handle a null just by returning SQL_NULL_DATA in
> pcbValue, and
> * doing nothing to the buffer.
> */
> if (pcbValue)
> {
> *((SDWORD *) pcbValueBindRow) =
> SQL_NULL_DATA;
> return COPY_OK;
> }
> else
> {
> SC_set_error(stmt,
> STMT_RETURN_NULL_WITHOUT_INDICATOR, "StrLen_or_IndPtr was a
> null pointer
> and NULL data was retrieved");
> SC_log_error(func, "", stmt);
> return SQL_ERROR;
> }
> }
> -----------------------------------------------
This is correct from my reading of the spec - specifically, it says:
"If StrLen_or_IndPtr is a null pointer, no length or indicator value is
used. This is an error when fetching data and the data is NULL."
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/ht
m/odbcsqlbindcol.asp
Regards, Dave