#22306 [Opn]: pg_lo_seek($h, 0, PGSQL_SEEK_SET) succeeds yet always returns false
| From: | php at codewhore dot org | Date: | Wed, 19 Feb 2003 22:51:23 +0000 |
| Subject: | #22306 [Opn]: pg_lo_seek($h, 0, PGSQL_SEEK_SET) succeeds yet always returns false | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-33592@lists.php.net to get a copy of this message | ||
ID: 22306
User updated by: php at codewhore dot org
Reported By: php at codewhore dot org
Status: Open
Bug Type: PostgreSQL related
Operating System: Linux 2.4
PHP Version: 4.3.0
New Comment:
From ext/pgsql/pgsql.c:
if (lo_lseek((PGconn *)pgsql->conn, pgsql->lofd, offset, whence ))
{
RETURN_TRUE;
} else {
RETURN_FALSE;
}
If lo_lseek() is anything like the POSIX lseek(), shouldn't the above
return false when the return value is -1, not zero?
Previous Comments:
------------------------------------------------------------------------
[2003-02-19 16:07:22] php at codewhore dot org
Seeking back to the beginning of a file on a PostgreSQL large object
handle returns false, even though the seek succeeds.
The following script:
<?php
$database = pg_connect ('dbname=pile_dev user=postgres');
pg_exec ($database, 'begin transaction');
$oid = pg_lo_create($database);
$handle = pg_lo_open($database, $oid, "rw");
echo 'write: ';
var_dump(pg_lo_write($handle, 'foo'));
echo 'tell: ';
var_dump(pg_lo_tell($handle));
echo 'seek to begin: ';
var_dump(pg_lo_seek($handle, 0, PGSQL_SEEK_SET));
echo 'tell: ';
var_dump(pg_lo_tell($handle));
pg_exec($database, 'commit');
pg_close($database);
?>
outputs:
write: int(3)
tell: int(3)
seek to begin: bool(false)
tell: int(0)
I expected:
write: int(3)
tell: int(3)
seek to begin: bool(true)
tell: int(0)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22306&edit=1