From: | Rene Grün <rene(dot)gruen(at)cslab(dot)de> |
---|---|
To: | <pgsql-interfaces(at)postgresql(dot)org> |
Subject: | Postgresql 9.0.8 - ECPG - COPY FROM returning COUNT |
Date: | 2013-05-24 14:42:21 |
Message-ID: | 5AD33821D1C0AD479A69349F17DA5F5548697F@exchange.mbs.internal |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
Dear List,
I'm trying to copy an unknown amount of data from a file to a table unsing a copy command.
This is working without any problems.
Now I want to get the number of copied rows.
In psql this is retuned as a text 'COPY XXX'
How can I get this in ECPG?
Using a prepared DELETE- or INSERT- statement I can simply execute the statement INTO a var.
EXEC SQL BEGIN DECLARE SECTION;
const char *stmt_1 = "DELETE FROM my_table;";
int myVar;
EXEC SQL END DECLARE SECTION;
EXEC SQL PREPARE stmt_1 FROM :stmt_1;
EXECUTE stmt_1 INTO :myVar;
Var now contains the number of deleted rows.
But...
EXEC SQL BEGIN DECLARE SECTION;
const char *stmt_1 = "COPY my_table FROM '/tmp/file.data';";
int myVar;
EXEC SQL END DECLARE SECTION;
EXEC SQL PREPARE stmt_1 FROM :stmt_1;
EXECUTE stmt_1 INTO :myVar;
mvVar is always 0.
Any suggestions how to get the numer?
Mit freundlichen Grüßen aus Krefeld,
With best regards from Krefeld,
CS-Lab GmbH
i. A. René Grün
E-Mail: rgr(at)cslab(dot)de
Fon: +49 2151 72949-0
Fax: +49 2151 72949-9
---
CS-Lab GmbH (Creativ Software Labor GmbH)
Römerstr. 15
D-47809 Krefeld
Geschäftsführer: Dieter Schmitz
Registergericht Krefeld, HRB 12257, USt.-ID: DE 263 834 180
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Meskes | 2013-05-25 16:44:37 | Re: Postgresql 9.0.8 - ECPG - COPY FROM returning COUNT |
Previous Message | Neeraj Rai | 2013-05-23 11:53:44 | - pgaql long value corrupted using htons |