Обсуждение: help with libpq program

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

help with libpq program

От
marcelo Cortez
Дата:
folks

 i need help with libpq program ,i made on C program
for
wrapper libpq.dll program , the routine failing is
copy from stdin interface.

PQputCopyData return 1 (AKA ok)
PQputCopyEnd  return 1 (AKA ok)
but nothing is append to database.
tailing log file

 invalid input syntax for integer: "3    hello world
          4.5
        "
CONTEXT:  COPY foo, line 1, column a: "3        hello
world             4.5
        "
STATEMENT:  copy foo from stdin

data seems to be correct
"3\    hello world     \    4.5\n"
"\\.\n"

database ( is for one example found at google)
create table foo (a int4, b char(16), d float8);
copy foo from stdin;

"3\    hello world     \    4.5\n"
"\\.\n"

I'm wrong?

what is way to diagnose?
any sugestion are welcomed
best regards

  MDC

PD: any example are welcomed too.







__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas


Re: help with libpq program

От
"Dann Corbit"
Дата:
Where is your actual copy statement?
What is your field delimiter?

Why not post the actual C code for your program, if it is not too long?

I guess from what you have posted that the delimiter you supplied does not match the delimiter from your copy
statement.

> -----Original Message-----
> From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-
> owner@postgresql.org] On Behalf Of marcelo Cortez
> Sent: Saturday, June 16, 2007 9:04 PM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] help with libpq program
>
>
> folks
>
>  i need help with libpq program ,i made on C program
> for
> wrapper libpq.dll program , the routine failing is
> copy from stdin interface.
>
> PQputCopyData return 1 (AKA ok)
> PQputCopyEnd  return 1 (AKA ok)
> but nothing is append to database.
> tailing log file
>
>  invalid input syntax for integer: "3    hello world
>           4.5
>         "
> CONTEXT:  COPY foo, line 1, column a: "3        hello
> world             4.5
>         "
> STATEMENT:  copy foo from stdin
>
> data seems to be correct
> "3\    hello world     \    4.5\n"
> "\\.\n"
>
> database ( is for one example found at google)
> create table foo (a int4, b char(16), d float8);
> copy foo from stdin;
>
> "3\    hello world     \    4.5\n"
> "\\.\n"
>
> I'm wrong?
>
> what is way to diagnose?
> any sugestion are welcomed
> best regards
>
>   MDC
>
> PD: any example are welcomed too.
>
>
>
>
>
>
>
> __________________________________________________
> Preguntá. Respondé. Descubrí.
> Todo lo que querías saber, y lo que ni imaginabas,
> está en Yahoo! Respuestas (Beta).
> ¡Probalo ya!
> http://www.yahoo.com.ar/respuestas
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

Re: help with libpq program

От
marcelo Cortez
Дата:
DAnn


 My c code is one layer for wrap libpq.dll functions
 i'm using function like

start with

PGresult *PQexec(PGconn *conn, const char *command);

 command like  'copy foo  from stdin ';

int PQputCopyData(PGconn *conn,
                  const char *buffer,
                  int nbytes);

(many times)
int PQputCopyEnd(PGconn *conn,
                 const char *errormsg);

 I was sucessfull with append CSV

 delimiter if not specified is tab character (from
documentation)

The problem was numeric formats, i can't find
solution for this but with CSV append was succesfull.
Thank for responses

 Best regards
 MDC


--- Dann Corbit <DCorbit@connx.com> escribió:

> Where is your actual copy statement?
> What is your field delimiter?
>
> Why not post the actual C code for your program, if
> it is not too long?
>
> I guess from what you have posted that the delimiter
> you supplied does not match the delimiter from your
> copy statement.
>
> > -----Original Message-----
> > From: pgsql-general-owner@postgresql.org
> [mailto:pgsql-general-
> > owner@postgresql.org] On Behalf Of marcelo Cortez
> > Sent: Saturday, June 16, 2007 9:04 PM
> > To: pgsql-general@postgresql.org
> > Subject: [GENERAL] help with libpq program
> >
> >
> > folks
> >
> >  i need help with libpq program ,i made on C
> program
> > for
> > wrapper libpq.dll program , the routine failing is
> > copy from stdin interface.
> >
> > PQputCopyData return 1 (AKA ok)
> > PQputCopyEnd  return 1 (AKA ok)
> > but nothing is append to database.
> > tailing log file
> >
> >  invalid input syntax for integer: "3    hello
> world
> >           4.5
> >         "
> > CONTEXT:  COPY foo, line 1, column a: "3
> hello
> > world             4.5
> >         "
> > STATEMENT:  copy foo from stdin
> >
> > data seems to be correct
> > "3\    hello world     \    4.5\n"
> > "\\.\n"
> >
> > database ( is for one example found at google)
> > create table foo (a int4, b char(16), d float8);
> > copy foo from stdin;
> >
> > "3\    hello world     \    4.5\n"
> > "\\.\n"
> >
> > I'm wrong?
> >
> > what is way to diagnose?
> > any sugestion are welcomed
> > best regards
> >
> >   MDC
> >
> > PD: any example are welcomed too.
> >
> >
> >
> >
> >
> >
> >
> > __________________________________________________
> > Preguntá. Respondé. Descubrí.
> > Todo lo que querías saber, y lo que ni imaginabas,
> > está en Yahoo! Respuestas (Beta).
> > ¡Probalo ya!
> > http://www.yahoo.com.ar/respuestas
> >
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 6: explain analyze is your friend
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please
> send an appropriate
>        subscribe-nomail command to
> majordomo@postgresql.org so that your
>        message can get through to the mailing list
> cleanly
>







__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas