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
This commit is contained in:
Bruce Momjian 1999-10-06 03:00:16 +00:00
parent 0eac2922ec
commit 56ba75cb53
3 changed files with 11 additions and 4 deletions

View File

@ -30,7 +30,7 @@ extern "C" {
#include "libpq-fe.h"
}
static char rcsid[] = "$Id: libpq++.H,v 1.5 1999/10/04 15:17:06 momjian Exp $";
static char rcsid[] = "$Id: libpq++.H,v 1.6 1999/10/06 03:00:16 momjian Exp $";
// ****************************************************************
@ -79,6 +79,7 @@ public:
~PgDatabase() {}; // close connection and clean up
// query result access
int Tuples();
int CmdTuples();
int Fields();
const char* FieldName(int field_num);
int FieldNum(const char *field_name);

View File

@ -10,7 +10,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgdatabase.cc,v 1.6 1999/09/28 12:59:29 momjian Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgdatabase.cc,v 1.7 1999/10/06 03:00:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -63,7 +63,12 @@ return PQntuples(pgResult);
int PgDatabase::CmdTuples()
{
return PQcmdTuples (pgResult);
char *a;
a = (char *)PQcmdTuples(pgResult);
if(NULL == a) return -1;
return atoi(a);
}

View File

@ -13,7 +13,7 @@
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: pgdatabase.h,v 1.4 1999/09/28 04:49:22 momjian Exp $
* $Id: pgdatabase.h,v 1.5 1999/10/06 03:00:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -23,6 +23,7 @@
#include "pgconnection.h"
#include <stdlib.h>
// ****************************************************************
//