Junk binary date?

From: Kevin Jenkins <gameprogrammer(at)rakkar(dot)org>
To:
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Junk binary date?
Date: 2006-06-21 04:12:50
Message-ID: 4498C742.7020800@rakkar.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2006-06-21 05:19:41 Re: Junk binary date?
Previous Message Tom Lane 2006-06-21 03:58:51 Re: multiple statement 'instead of' rule