> >

> > alguém tem um exemplo de código de como executar um COPY (a partir de 

> > um arquivo presente na maquina requisitante)

> >

> > para um servidor Postgresql via um programa em C (utilizando a libpq) ?

> >

> > O programa em C fica na minha maquina (localhost win XP) e o servidor 

> > postgres 8.2.4 em Linux.

> >

> 

> 

> Do manual:

> "Files named in a COPY command are read or written directly by the server, 
> not by the client application. Therefore, they must reside on or be 
> accessible to the database > server machine, not the client. They must be 
> accessible to and readable or writable by the PostgreSQL user (the user ID 
> the server runs as), not the client.

> 

> When STDIN or STDOUT is specified, data is transmitted via the connection 
> between the client and the server."

> http://www.postgresql.org/docs/current/interactive/sql-copy.html 
> <http://www.postgresql.org/docs/current/interactive/sql-copy.html> 

> 

> Creio que a forma mais transparente seja seu programa C ler o arquivo e 
> transmiti-lo logo após o comando COPY STDIN (que é o que faz o \copy do 
> psql). Não esquecer de > finalizar com uma linha contendo apenas "\."

> (sem as aspas).

> 

> Osvaldo

 

Osvaldo, isso que dizer que tenho que 'transmiti-lo' via FTP (por outro meio 
qualquer) 

antes de fazer o código do COPY via o programa em C através da libpq?

 

Em caso, afirmativo como faço isso em C? Senão, sabe como fazer isso através da 
libpq?

 

Fico no aguardo. Att.

Newton Teixeira do Nascimento Junior



 



<html>
<body>
<font face = "arial" size = "1" color = "#000080">Aviso:<br>"O emitente desta 
mensagem &eacute; respons&aacute;vel por seu conte&uacute;do e 
endere&ccedil;amento. Cabe ao destinat&aacute;rio cuidar quanto ao tratamento 
adequado. Sem a devida autoriza&ccedil;&atilde;o, a divulga&ccedil;&atilde;o, a 
reprodu&ccedil;&atilde;o, a distribui&ccedil;&atilde;o ou qualquer outra 
a&ccedil;&atilde;o em desconformidade com as normas internas da ELETRONORTE S/A 
s&atilde;o proibidas e pass&iacute;veis de san&ccedil;&atilde;o disciplinar, 
c&iacute;vel e criminal. Esta mensagem pode ser monitorada".
</font>
</body>
</html>
_______________________________________________
pgbr-geral mailing list
pgbr-geral@listas.postgresql.org.br
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a