Return-Path: andrew_yu
Received: from dune.silkroad.com (postgres@dune.silkroad.com [165.209.1.2]) by nobozo.CS.Berkeley.EDU (8.6.10/8.6.3) with ESMTP id GAA05612 for <postgres95@postgres.berkeley.edu>; Thu, 16 Nov 1995 06:17:46 -0800
Received: (from postgres@localhost) by dune.silkroad.com (8.6.12/8.6.9) id JAA12102 for postgres95@postgres.berkeley.edu; Thu, 16 Nov 1995 09:15:26 -0500
From: Tim Bass (Postmaster95) <postgres@dune.silkroad.com>
Message-Id: <199511161415.JAA12102@dune.silkroad.com>
Subject: open(SQL,"$psql|");
To: postgres95@postgres.Berkeley.EDU
Date: Thu, 16 Nov 1995 09:15:25 -0500 (EST)
X-Mailer: ELM [version 2.4 PL24 PGP2]
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 1510      


Hello everyone.

I've been having a lot of fun and great success with my PERL CGI scripts
just opening up a pipe using the psql binary, i.e.

$psql = "/usr/bin/psql -H hostname -d directory -f filename";
open (SQL, "$psql|");
while (<SQL>) {

		s/-{10,1000}/g; 	#get rid of the -------s
		@line=split(/\|/,$_);   #split on the |
		# other great perl pattern stuff

		}

works very good so far and is really easy.  What is the advantage of 
using a postgres perl library when piping psql calls into a process
is so easy?

Thanks for a serious answer.  Also, thanks to postgres95 for motivating
me to write perl scripts.  It is really fun!  I could never program
in C this fast and if it wasn't for postgres95 I would still be wasting
time prototyping in C instead of PERL.

In a different question.  Has anyone written a postgres95 SQL lexer/
syntax checker?  Interested?

Thanks,

Tim


+--------------------------------------------------------------------------+
| Tim Bass                           | #include<campfire.h>                | 
| Principal Network Systems Engineer |       for(beer=100;beer>1;beer++){  |
| The Silk Road Group, Ltd.          |           take_one_down();          |
|                                    |           pass_it_around();         |
| http://www.silkroad.com/           |       }                             |
|                                    |  back_to_work(); /*never reached */ | 
+--------------------------------------------------------------------------+




