Subject: Examples on Large Objects

From: [email-masked] (Raj Vadakkencherry)
Date: Tue, 6 Sep 1994 10:45:22 -0700 (PDT)

Hi,

 Do you have source code examples for creating and using large objects
 from Unix files ? The ...src/bin/fsutils directory contains only an example
 for inversion large object.

Raj.

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "[email-masked]"

   If this fails, send mail to "[email-masked]" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================

---

From: [email-masked]
Date: Tue, 06 Sep 94 11:35:11 -0700

> for inversion large object.

Hello,

If you're familiar with Tcl you can use libpqtcl to manipulate Unix
large objects in a script.  Here's an example:

#
# test libpqtcl's large object interface
#

# copy /etc/motd to a new large object
set lo [PQlo open junk w+]
set fp [open /etc/motd]
PQlo copyin $fp $lo
close $fp

# copy the data back out to stdout
PQlo seek $lo 0
PQlo copyout $lo stdout

# now stat the large object and print the statbuf array to stdout
PQlo stat junk statBuf
parray statBuf

# dump a listing of files at the LO root to stdout
puts stdout [PQlo glob *]

# make a new directory and move the large object there
PQlo mkdir mydir
PQlo cd mydir
PQlo rename /junk /mydir/junk

# delete the large object and directory
PQlo unlink junk
PQlo cd /
PQlo rmdir mydir

Libpqtcl can be included in any Tcl or Tk application.  You can get it
at:

ftp://ftp.crseo.ucsb.edu/pub/libpqtcl.tar.Z

-Jim

 __________________________________________________________
  Jim Davidson                     |  [email-masked]
  CSL / Center for Remote Sensing  |  [email-masked]
  University of California         |  Phone (805)893-8475
  Santa Barbara, CA 93106          |  Fax           -2578