Av "OID" ing working

Поиск
Список
Период
Сортировка
От Roy Cabaniss
Тема Av "OID" ing working
Дата
Msg-id 200202191529.g1JFTlm01619@cabanisspc.uamont.edu
обсуждение исходный текст
Список pgsql-general
Using postgresql 7.1.3 with phpPgAdmin 2.4.1-beta and phplib.

I have been working on this for more than a while and am getting more and
more confused.  It has to be something relatively simple that I am missing
but I cannot find it in simple english in any of the manuals thus far.   That
includes the two online books ( Momjian and Worsley/Drake).  (BTW, I use SuSE
and since suse has this habit of storing things in non-standard places I have
been reluctant to upgrade to 7.2)

The problem deals with storing and accessing binaries (images).

What I have is a simple table which I created using the following:

create table product (item_no int4, name varchar(32), description text, image
oid);

And with no problem, the table was created.  I then went to insert some data
into this table initially with phpPgAdmin.  But I never could get phpPgAdmin
to take the data when I tried to put something in the image field, regardless
of format.  Since the format for finding an image springs from lo_import as
opposed to simple data, I was not overly surprised by this.

Go to manual sql and give it the following:

insert into product values
(nextval('"product_item_no_seq"'::text),'fish','deadfish',lo_import('/usr/local/image/fish.jpg'));

And lo and behold, it works.  (no real surprise there.)  To me this is not a
problem at all since I am going to be making dedicated input forms.  Anyway,
it has put the item into the product table.  When I go to look at the table
with a simple "Select * from product;" I get what I expected to see....

Item_no       name            description                    image

 3           fish        deadfish                       20744

With the image column giving me back that oid reference number.

I will mention that I am using phplib for authentication and to generate the
table, but it is simple sql at this point.  Now for the problem... I want to
see that image in a table.  Since

select * from product;

is just going to give me the oid reference numbers I would like to see this
actual pictures in the table.

I have tried many variants of

$db2 = new DB_Example;
$db2->query("select lo_export(product.image, '/tmp/outimage.jpg') from
product;
$t2 = new Table;
$t2->heading = "on";
$t2->show_result($db2);

with no results.  (the code I use to simply view the table is

$db = new DB_Example;
$db->query("select * from product");
$t = new Table;
$t->heading = "on";
$t->show_result($db);

If it matters.

All help greatly appreciated.  And I am sure that this is something that
folks would like to see in the reference.

--
Dr. Roy F. Cabaniss
Associate Professor of Business
University of Arkansas Monticello
http://cabanisspc.uamont.edu/~rcaban

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pg_dump correct version?
Следующее
От: "Robert Treat"
Дата:
Сообщение: Re: text vs varchar(n)