Hey all,<br /><br />Here is simple test case of LOB usage, please, note the comments:<br /><br />#include
<libpq-fe.h><br/>#include <libpq/libpq-fs.h><br /><br />int main(int argc, char* argv[])<br />{<br />
PGconn*c = PQconnectdb("password=test");<br /><br /> PGresult* r = PQexec(c, "BEGIN");<br /> PQclear(r);<br /><br />
constunsigned int id = lo_create(c, 0);<br /><br /> int fd1 = lo_open(c, id, INV_READ | INV_WRITE);<br /> int nBytes
=lo_write(c, fd1, "D", 1);<br /> int fd1Pos = lo_lseek(c, fd1, 2147483647, SEEK_SET);<br /> fd1Pos = lo_lseek(c,
fd1,1, SEEK_CUR);<br /> nBytes = lo_write(c, fd1, "Dima", 4); // nBytes == 4 ! Should be 0, IMO.<br
/> // If not, where is my name<br />
// will be written?<br /><br /> r = PQexec(c, "COMMIT");<br />
PQclear(r);<br/><br /> r = PQexec(c, "BEGIN");<br /> PQclear(r);<br /><br /> fd1 = lo_open(c, id, INV_READ |
INV_WRITE);<br/> fd1Pos = lo_lseek(c, fd1, 0, SEEK_END); // fd1Pos == -2147483647 !<br /><br /> char buf[16];<br
/> nBytes = lo_read(c, fd1, buf, 4); // nBytes == 0 ! Correct, IMO.<br /><br /> r = PQexec(c, "COMMIT");<br />
PQclear(r);<br/><br /> return 0;<br />}<br /><br />Tell me please, why lo_write() returns me the number of bytes
"actuallywritten"<br />when current write location is out of 2GB ? IMO, in this case it should returns<br />at least
zero.<br/> lo_read() returns zero in this case, and it is correct, IMO.<br clear="all" /><br />-- <br />Regards,<br
/>Dmitriy<br/><br />