Hi, 

I've done some tests with large objects and it works just fine under
Linux, but when I try the same code under Windows (I use the libpq
frontend) it fails for some reason with lo_read() always returning 0.

The test program I'm using is basically a modified version of the one
listed in chapter 3 of the programmer's guide (testlo.c). I first
tried to compile it using MSVC 6.0, but found that I had to replace
the open() calls in lo_import() and lo_export() in the
interfaces/libpq/fe-lobj.c file with the native Windows calls. The
files were not opened in the correct mode for some reason.

I then tried to compile the example with gcc and the cygwin tools -
the test program worked just fine without modifications to the
fe-lobj.c file. However, my lo_read() calls still returns 0 no matter
what I do.

I've tried this with both 6.51, 7.0.2 and 7.0.3 - but they all give
the same results.

Does anyone have any experience with this under Windows? I would
greatly appreciate any help in getting to the bottom of this problem.

Thanks,

-- 
Trond K.

19 Jan 2001 13:58:26 +0100
Trond Kjernaasen <trond@trolltech.com>
Problems with BLOBs under Windows?
Sorry for posting followups on my own mails, but I've noticed that
I can actually use lo_read() if I read the BLOBs in chunks of 
32760 bytes. If I try to read 32761 bytes it fails for some reason.

Thanks,

-- 
Trond K.

Trond Kjernaasen <trond@trolltech.com> writes:

> Hi, 
> 
> I've done some tests with large objects and it works just fine under
> Linux, but when I try the same code under Windows (I use the libpq
> frontend) it fails for some reason with lo_read() always returning 0.
> 
> The test program I'm using is basically a modified version of the one
> listed in chapter 3 of the programmer's guide (testlo.c). I first
> tried to compile it using MSVC 6.0, but found that I had to replace
> the open() calls in lo_import() and lo_export() in the
> interfaces/libpq/fe-lobj.c file with the native Windows calls. The
> files were not opened in the correct mode for some reason.
> 
> I then tried to compile the example with gcc and the cygwin tools -
> the test program worked just fine without modifications to the
> fe-lobj.c file. However, my lo_read() calls still returns 0 no matter
> what I do.
> 
> I've tried this with both 6.51, 7.0.2 and 7.0.3 - but they all give
> the same results.
> 
> Does anyone have any experience with this under Windows? I would
> greatly appreciate any help in getting to the bottom of this problem.

19 Jan 2001 17:31:37 +0100
Trond Kjernaasen <trond@trolltech.com>
Re: Problems with BLOBs under Windows?
Trond Kjernaasen <trond@trolltech.com> writes:
> Sorry for posting followups on my own mails, but I've noticed that
> I can actually use lo_read() if I read the BLOBs in chunks of 
> 32760 bytes. If I try to read 32761 bytes it fails for some reason.

I'm betting that something is rounding up to the next multiple of 8
bytes, and then something else is trying to fit the result in a short
integer.  Dunno where though --- AFAIR, all the LO-related code uses
integer counts, and I can't think of a good reason for rounding off
to an alignment multiple either.

Can you pursue this further and identify the culprit?  I have no time
for it at the moment.

			regards, tom lane

Fri, 19 Jan 2001 13:43:22 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: Re: Problems with BLOBs under Windows? 