Skip to content

Commit 56ba75c

Browse files
committed
CmdTuples() returns an int showing the number of affected tuples after an
insert, update or delete. It will return -1 on error, although I've yet to an error situation to prove that out! Vince
1 parent 0eac292 commit 56ba75c

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/interfaces/libpq++/libpq++.H

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extern "C" {
3030
#include "libpq-fe.h"
3131
}
3232

33-
static char rcsid[] = "$Id: libpq++.H,v 1.5 1999/10/04 15:17:06 momjian Exp $";
33+
static char rcsid[] = "$Id: libpq++.H,v 1.6 1999/10/06 03:00:16 momjian Exp $";
3434

3535

3636
// ****************************************************************
@@ -79,6 +79,7 @@ public:
7979
~PgDatabase() {}; // close connection and clean up
8080
// query result access
8181
int Tuples();
82+
int CmdTuples();
8283
int Fields();
8384
const char* FieldName(int field_num);
8485
int FieldNum(const char *field_name);

src/interfaces/libpq++/pgdatabase.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 1994, Regents of the University of California
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgdatabase.cc,v 1.6 1999/09/28 12:59:29 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgdatabase.cc,v 1.7 1999/10/06 03:00:16 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -63,7 +63,12 @@ return PQntuples(pgResult);
6363

6464
int PgDatabase::CmdTuples()
6565
{
66-
return PQcmdTuples (pgResult);
66+
char *a;
67+
68+
a = (char *)PQcmdTuples(pgResult);
69+
if(NULL == a) return -1;
70+
71+
return atoi(a);
6772
}
6873

6974

src/interfaces/libpq++/pgdatabase.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Copyright (c) 1994, Regents of the University of California
1414
*
1515
*
16-
* $Id: pgdatabase.h,v 1.4 1999/09/28 04:49:22 momjian Exp $
16+
* $Id: pgdatabase.h,v 1.5 1999/10/06 03:00:16 momjian Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -23,6 +23,7 @@
2323

2424
#include "pgconnection.h"
2525

26+
#include <stdlib.h>
2627

2728
// ****************************************************************
2829
//

0 commit comments

Comments
 (0)