Обсуждение: DBI and 'COPY' ... possible?

Поиск
Список
Период
Сортировка

DBI and 'COPY' ... possible?

От
The Hermit Hacker
Дата:
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? 

Thanks...

Marc G. Fournier                   ICQ#7615664               IRC Nick: Scrappy
Systems Administrator @ hub.org 
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org 



Re: [INTERFACES] DBI and 'COPY' ... possible?

От
Goran Thyni
Дата:
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!

************




Re: [INTERFACES] DBI and 'COPY' ... possible?

От
Goran Thyni
Дата:
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!

************




Re: [INTERFACES] DBI and 'COPY' ... possible?

От
Goran Thyni
Дата:
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!

************