PG Problems
PG Problems
От:
ALASTAIR JOHN TAYLOR <ajt6@aber.ac.uk>
Дата:
Hello,
I was wondering if anyone could help me with a little problem with the Pg
module - I've looked at the manual, but I can't work it out.....
------------------------------------------------------------
$conn = Pg::connectdb("host=...................");
$query = "select timeone from times where racer='$name'";
$result = $conn->exec($query);
$result->print(stdout, ..............);
------------------------------------------------------------
The above code works without any problem, as it should, and prints out a
value, but as soon as I try to add another query/result I get problems...
ie.
--------------------------------------------------------------
$querytwo = "select timetwo from times where racer='$name'";
$resulttwo = $conn->exec($querytwo);
$total = $result + $resulttwo;
$total->print(stout,..........);
--------------------------------------------------------------
I know the problem comes in with the addition of pointers, but I'm at a
dead-end.
Any suggestions?
Thanks in advance, Alastair
Re: PG Problems
От:
"Brett W. McCoy" <bmccoy@chapelperilous.net>
Дата:
On Fri, 21 Apr 2000, ALASTAIR JOHN TAYLOR wrote:
> --------------------------------------------------------------
> $querytwo = "select timetwo from times where racer='$name'";
> $resulttwo = $conn->exec($querytwo);
>
> $total = $result + $resulttwo;
What is it you think this is supposed to be doing? You are adding the
dereferenced values of these references to get a third reference? The
values of $result and $resulttwo aren't what you think they are. They
don't hold the actual value of a query, just a reference to the tuples
returned from the query. You still need to 'fecth' those results out,
even if you only have one row returned.
Brett W. McCoy
http://www.chapelperilous.net
---------------------------------------------------------------------------
When I first arrived in this country I had only fifteen cents in my pocket
and a willingness to compromise.
-- Weber cartoon caption
How to get the size of a large object?
От:
"Robert B. Easter" <reaster@comptechnews.com>
Дата:
I use php4 and I'm wondering if there is a way to find out the size of a large object so that when I call pg_loread($fd, $len), I can set $len to the correct number of bytes to read in. Does the database maintain this information anywhere accessible by a query? I could store the sizes in a table along with the oids but would rather not if I don't need to.
Re: How to get the size of a large object?
От:
swalker <swalker@ct36753-a.jfrvil1.in.home.com>
Дата:
This really doesn't answer your question. But maybe it will achieve the same result. PHP has a function called pg_loreadall. This function reads a large object and passes it straight through to the browser. Here is an example On Fri, 21 Apr 2000, Robert B. Easter wrote: > I use php4 and I'm wondering if there is a way to find out the size of a large > object so that when I call pg_loread($fd, $len), I can set $len to the correct > number of bytes to read in. Does the database maintain this information > anywhere accessible by a query? I could store the sizes in a table along with > the oids but would rather not if I don't need to. >