From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | Юрий EGO <mail_ego(at)list(dot)ru> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: |
Date: | 2011-06-07 16:33:59 |
Message-ID: | BANLkTimQnYa7QYf=qwyFGFU0f0uoBZWe5g@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Jun 7, 2011 at 7:46 AM, Юрий EGO <mail_ego(at)list(dot)ru> wrote:
> Hello!
>
> I have a code (libpq):
>
> char textbuffer[120];
> res = PQexec(conn, "COPY
> table_name(\"serial_column",\"int_column",\"bytea_column\") FROM STDIN");
> if(PQresultStatus(res) == PGRES_COPY_IN)
> {
> for(int n=0; n < 10; n++) {
> sprintf(textbuffer, "1\t%i\t'text'\n", n);
> int copydatares = PQputCopyData(conn, textbuffer, strlen(textbuffer));
> }
> PQputCopyEnd(conn, NULL);
> }
>
> For text data it's ok, but binary data may have '\n' or '\t' characters.
> How correctly write int STDIN binary data?
the binary format doesn't use delimiters like that. you have to
basically study the format if you want to craft data that wasn't
produced by the server :(.
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Kretschmer | 2011-06-07 16:38:51 | Re: Estimate for 9.1 release |
Previous Message | Tom Lane | 2011-06-07 16:26:34 | Re: Postmaster holding unlinked files for pg_largeobject table |