Обсуждение: TR: interface PERL and return results

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

TR: interface PERL and return results

От
"victor3.lopes@voila.fr"
Дата:
Hello no one has a solution for my problem :-) ?


---------- Entête Initiale  -----------

De    : "victor3.lopes@voila.fr" <victor3.lopes@voila.fr>
A     : "pgsql-interfaces" <pgsql-interfaces@postgresql.org>
Copie :
Date  : Sat,  5 Oct 2002 23:31:40 +0200
Objet : interface PERL and return results

Hello,
I use Perl Pg interface to join my postgresql database.

I wan't  send the below query in perl :

$res = $db->exec(' create table temp (....); \copy temp from result.res');

I wan't test the result of this 2 commands with : $res->resultStatus

Although this command works normaly or no, depends of  values format in result.res, i
have always the same
response PGRES_FATAL_ERROR.
Is it normal ? How  i do to  know the real result of my commands ?

If i use this commands in psql, if there are an error in my result.res file,  psql
indicates me the line where is localized the
error in my file.
Can i have this functionnality and information with the perl interface Pg ?

Thanks for your response :-)
------------------------------------------

Faites un voeu et puis Voila ! www.voila.fr

------------------------------------------

Faites un voeu et puis Voila ! www.voila.fr



Re: TR: interface PERL and return results

От
"Nigel J. Andrews"
Дата:

Bonjour,

On Mon, 7 Oct 2002, [utf-8] victor3.lopes@voila.fr wrote:

> Hello no one has a solution for my problem :-) ?
>
>
> ---------- Entête Initiale  -----------
>
> De    : "victor3.lopes@voila.fr" <victor3.lopes@voila.fr>
> A     : "pgsql-interfaces" <pgsql-interfaces@postgresql.org>
> Copie :
> Date  : Sat,  5 Oct 2002 23:31:40 +0200
> Objet : interface PERL and return results
>
> Hello,
> I use Perl Pg interface to join my postgresql database.
>
> I wan't  send the below query in perl :
>
> $res = $db->exec(' create table temp (....); \copy temp from result.res');

The \copy is a psql command. You need to use just the word 'copy' without the
leading '\'.

Using:

 COPY temp FROM /path/to/result.res

will try and read result.res from a file on the server system. To load a file
on your client system you should use COPY temp FROM STDIN and read the Pg
manpage.

Documentation:

http://developer.postgresql.org/docs/postgres/sql-copy.html

and

man Pg

search for 'copy' in the second of these to get a good starting point on the
subject.


--
Nigel J. Andrews
Director

---
Logictree Systems Limited
Computer Consultants