Junk binary date? - Mailing list pgsql-general

From Kevin Jenkins
Subject Junk binary date?
Date
Msg-id 4498C742.7020800@rakkar.org
Whole thread Raw
In response to multiple statement 'instead of' rule  ("Merlin Moncure" <mmoncure@gmail.com>)
Responses Re: Junk binary date?
List pgsql-general
I call PQexecParams with the last parameter as 1 to return binary
data.  I then get this data with:

fileLengthPtr = PQgetvalue(result, rowIndex, fileLengthColumnIndex);
memcpy(&fileLength, fileLengthPtr, sizeof(fileLength));

The value being returned is of type integer.

It should have the value 7237 in binary.
It actually has the value:
fileLengthPtr[0]    0    char
fileLengthPtr[1]    0    char
fileLengthPtr[2]    28 '?'    char
fileLengthPtr[3]    69 'E'    char

Which is not 7237, it's:
fileLength    1159462912    int

Why?


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: multiple statement 'instead of' rule
Next
From: Michael Fuhr
Date:
Subject: Re: Junk binary date?