pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Goran Thyni <goran@kirra.net>
To: The Hermit Hacker <scrappy@hub.org>
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] DBI and 'COPY' ... possible?
Date: Mon, 29 Nov 1999 20:44:59 +0100
Message-ID: <3842D7BB.8008988@kirra.net> (raw)
References: <Pine.BSF.4.10.9911250055080.63896-100000@thelab.hub.org>

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!



view thread (2+ messages)

Message-ID: <3842D7BB.8008988@kirra.net>
Permalink:  ../3842D7BB.8008988@kirra.net/
Also on:    postgresql.org/message-id/3842D7BB.8008988@kirra.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: goran@kirra.net, scrappy@hub.org
  Subject: Re: [INTERFACES] DBI and 'COPY' ... possible?
  In-Reply-To: <3842D7BB.8008988@kirra.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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