agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
large objects
6+ messages / 5 participants
[nested] [flat]

* large objects
@ 1993-03-16 04:46  James Woods 61-89-895256 <jaws@pangaea.dme.nt.gov.au>
  0 siblings, 0 replies; 6+ messages in thread

From: James Woods 61-89-895256 @ 1993-03-16 04:46 UTC (permalink / raw)
  To: legacy

I am just starting to delve into storing large objects using the inversion 
method and have run into a few problems.  The first was with the setenv() call
which I have written my own routine to do what I think it does, could you 
please tell me if it is correct.

int setenv(char *var, char *val, int unknown_param)
{
  char *envstr;
 
  if(!var || !val) {
    fputs("NULL string calling setenv", stderr);
    return;
  }
  if(unknown_param != 1) {
    fprintf(stderr, 
            "unrecognised third parameter %d to setenv,"
            " assuming it is unimportant",
            unknown_param);
  }
 
  if(!(envstr = (char*)malloc(strlen(var)+strlen(val)+2))) {
    fputs("out of memory error\n", stderr);
    exit(1);
  }
 
  strcpy(envstr, var);
  strcat(envstr, "=");
  strcat(envstr, val);
 
  return putenv(envstr);
}

The second one is that I cannot seem to create more than one lage object in a database.  I am attempting to store SUN rasterfiles and when I store the first 
image it appears to work ok giving the following messages on the screen:

sock = 4
Pfout = d714 Pfin = d728

When I then attempt to store a second image in the same database with a 
different name to the first it gives the following message and then just 
freezes:

sock = 4
Pfout = d714 Pfin = d728
Error: WARN:Mar 15 14:59:59:amcreate: Xinv0 relation already exists

I am using the following code, which i basically copied out of the reference 
manual, to store the images. 

void store(unsigned char *image, char *filename)
{
  int fd;
  char *qry_result;
  char dbname[1024];
  struct rasterfile *header = (struct rasterfile*)image;
  int bufsize = 
    sizeof(struct rasterfile) + header->ras_maplength + header->ras_length;
 
  PQsetdb("jawsraster");
 
  if(*(qry_result = PQexec("begin")) == 'R') {
    fputs("error on PQexec\n", stderr);
    exit(-1);
  }
 
  strcpy(dbname, "jaws/raster/");
  if(*filename == '/')
    strcat(dbname, filename+1);
  else
    strcat(dbname, filename);
 
  if((fd = p_creat(dbname, INV_WRITE, Inversion)) < 0) {
    fprintf(stderr, "error creating database file %s\n", dbname);
    exit(-1);
  }
 
  if(p_write(fd, image, bufsize) < bufsize) {
    fputs("error writing image to database\n", stderr);
    exit(-1);
  }
 
  p_close(fd);
 
  if(*(qry_result = PQexec("end")) == 'R') {
    fputs("error commiting transaction\n", stderr);
    exit(-1);
  }
}



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* large objects
@ 1993-04-06 01:18  James Woods 61-89-895256 <jaws@pangaea.dme.nt.gov.au>
  0 siblings, 0 replies; 6+ messages in thread

From: James Woods 61-89-895256 @ 1993-04-06 01:18 UTC (permalink / raw)
  To: legacy

In the User Manual for postgres 4.1 in section 7 about large objects there is
a reference to a file /usr/postgres/tutorial/large.o, but I can't
find this file anywhere in the distribution.  Is this file supposed to exist,
along with it's source, or is it just given as a dummy example.  If it does
exist where can I get hold of it from, and if not is there something similar
somewhere?

thanks
James Woods
jaws@pangaea.dme.nt.gov.au



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Large Objects
@ 1993-08-20 12:52  Gunter Strube <Gunter.Strube@regent.e-technik.tu-muenchen.de>
  0 siblings, 1 reply; 6+ messages in thread

From: Gunter Strube @ 1993-08-20 12:52 UTC (permalink / raw)
  To: legacy

Hi,

I've been trying to work with Large_Objects in Postgres for quite a
while now, trying to store or access them either from the monitor
or via LIBPQ.
Even though I've tried it in about a thousand different versions
it doesn't seem to work right. The documentation in Manual Section 7 
is rather poor and the Example doesn't work either.

The closest I could get was that the some writing access was done to
"pg_largre_object" but the attemt to read it out failed.

A frequent error message was after the command:
	inv_fd = p_open("/inv_file2", INV_WRITE, Inversion);

	Error: Unexpected identifier: ?

so before I describe the whole mess in more detail:

1. Does anybody have experience with large objects who can explain
   the access via LIBPQ or via the monitor.

2. Can anybody send me some example-programms for storing data in
   large objects (in Unix as well as in in Inversion files).

Thanks in advance
 Gunter
-- 
------------------------------------------------------------------------
Gunter Strube                                 Phone +49 89 551 743-74 
Institute of Electronic Design Automation    
Prof. Dr.-Ing. K. Antreich               
Technical University of Munich          
P.O. Box 202420                        
W-80290 Munich 2                 
Germany                            gus@regent.e-technik.tu-muenchen.de
------------------------------------------------------------------------




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Large Objects
@ 1993-08-23 00:13  Paul M. Aoki <aoki@postgres.berkeley.edu>
  parent: Gunter Strube <Gunter.Strube@regent.e-technik.tu-muenchen.de>
  0 siblings, 0 replies; 6+ messages in thread

From: Paul M. Aoki @ 1993-08-23 00:13 UTC (permalink / raw)
  To: legacy

Gunter Strube <Gunter.Strube@regent.e-technik.tu-muenchen.de> writes:
> A frequent error message was after the command:
> 	inv_fd = p_open("/inv_file2", INV_WRITE, Inversion);
> 	Error: Unexpected identifier: ?

this means the backend dumped core (or was never invoked).  the 
arguments you give are appropriate for p_creat, which must be called 
before p_open is called.  as far as i can tell this was correctly 
documented in 4.1..

> 2. Can anybody send me some example-programms for storing data in
>    large objects (in Unix as well as in in Inversion files).

the inversion file system utilities (especially icopy) contain
lots of uses of large objects.. look in src/bin/fsutils.

changing icopy to use unix/inversion large objects is pretty simple. 
only two lines must be changed:

593c593
<     if ((destfd = p_creat(destfname, 0666, Unix)) < 0) {
---
>     if ((destfd = p_creat(destfname, INV_WRITE|smgrno, Inversion)) < 0) {
670c670
<     if ((srcfd = p_open(srcfname, O_RDONLY)) < 0) {
---
>     if ((srcfd = p_open(srcfname, INV_READ)) < 0) {

(the line numbers are approximate since they come from our development
source code, not 4.1.)
--
  Paul M. Aoki  |  CS Div., Dept. of EECS, UCB  |  aoki@postgres.Berkeley.EDU
                |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* large objects
@ 1994-09-23 16:32  Ray E. Flanery Jr <flanery@tram.epm.ornl.gov>
  0 siblings, 1 reply; 6+ messages in thread

From: Ray E. Flanery Jr @ 1994-09-23 16:32 UTC (permalink / raw)
  To: legacy


are there any tutorials or exaples available on using large objects
as attributes?
---------------------------------------------------------------------------
                   Raymond E. Flanery Jr., Director
             Advanced Visualization Research Center, ORNL
 (615)574-0630                                     flanery@msr.epm.ornl.gov 
 (615)574-0680 fax                        http://www.epm.ornl.gov/~flanery/
----------------------------------------------------------------------------
                            Cleveland Browns
---------------------------------------------------------------------------
  "When the last individual of a race of living things breathes no more,
another heaven and another earth must pass before such a one can be again."
                           --- William Beebe
---------------------------------------------------------------------------
               "Loyalty above all else, except honor"  ---  ??


==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"

   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: large objects
@ 1994-09-23 20:18  Paul M. Aoki <aoki@cs.berkeley.edu>
  parent: Ray E. Flanery Jr <flanery@tram.epm.ornl.gov>
  0 siblings, 0 replies; 6+ messages in thread

From: Paul M. Aoki @ 1994-09-23 20:18 UTC (permalink / raw)
  To: Ray E. Flanery Jr <flanery@tram.epm.ornl.gov>; +Cc: legacy

flanery@tram.epm.ornl.gov (Ray E. Flanery Jr) writes:
> are there any tutorials or exaples available on using large objects
> as attributes?

i stuck some short examples in 
	ftp://s2k-ftp.cs.berkeley.edu/pub/postgres/contrib/LO-examples
though they're not particularly tutorial in nature.  at least one of
them may need some minor syntax changes (due to being written against
the version of the query language in a previous release).
--
  Paul M. Aoki          |  University of California at Berkeley
  aoki@CS.Berkeley.EDU  |  Dept. of EECS, Computer Science Division (#1776) 
                        |  Berkeley, CA 94720-1776

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"

   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~1994-09-23 20:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1993-03-16 04:46 large objects James Woods 61-89-895256 <jaws@pangaea.dme.nt.gov.au>
1993-04-06 01:18 large objects James Woods 61-89-895256 <jaws@pangaea.dme.nt.gov.au>
1993-08-20 12:52 Large Objects Gunter Strube <Gunter.Strube@regent.e-technik.tu-muenchen.de>
1993-08-23 00:13 ` Re: Large Objects Paul M. Aoki <aoki@postgres.berkeley.edu>
1994-09-23 16:32 large objects Ray E. Flanery Jr <flanery@tram.epm.ornl.gov>
1994-09-23 20:18 ` Paul M. Aoki <aoki@cs.berkeley.edu>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox