Received: from villa.bildbasen.se (villa.bildbasen.kiruna.se [193.45.225.97]) by hub.org (8.9.3/8.9.3) with SMTP id OAA73859 for ; Mon, 29 Nov 1999 14:46:00 -0500 (EST) (envelope-from goran@kirra.net) Received: (qmail 26691 invoked from network); 29 Nov 1999 19:45:22 -0000 Received: from a203.dial.kiruna.se (HELO kirra.net) (193.45.238.19) by villa.bildbasen.kiruna.se with SMTP; 29 Nov 1999 19:45:22 -0000 Sender: goran Message-ID: <3842D7BB.8008988@kirra.net> Date: Mon, 29 Nov 1999 20:44:59 +0100 From: Goran Thyni Organization: kirra.net X-Mailer: Mozilla 4.6 [en] (X11; U; Linux 2.2.13 i586) X-Accept-Language: sv, en MIME-Version: 1.0 To: The Hermit Hacker CC: pgsql-interfaces@postgreSQL.org Subject: Re: [INTERFACES] DBI and 'COPY' ... possible? References: Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit The Hermit Hacker wrote: > > I've just checked the perldoc's on DBI and DBD::Pg, and can't see any way > of doing this in perl that "jumps out at me"...has anyone gotten this to > work, and how? Marc, No DBI-way I konow of, but perl is the greatest glue language. I did it like this, exemple below: open(FIL, "| psql $databas"); print FIL "COPY x_kw FROM STDIN USING DELIMITERS '|';\n"; foreach (sort keys %kw) { my $id = $kw{$_}; /^(.+)\+(\w)$/; my ($kw,$kat) = ($1,$2); print FIL "$id|$kw|$kat\n"; } close FIL; best regards, Göran Thyni -------------------- On quiet nights you can hear Windows NT reboot!