Overloaded gnucomo_database::Field() to include the Result
authorarjen <arjen>
Tue, 2 Sep 2003 12:54:10 +0000 (12:54 +0000)
committerarjen <arjen>
Tue, 2 Sep 2003 12:54:10 +0000 (12:54 +0000)
from a query as an argument.

src/include/database.h

index 051adb8..2060cb5 100644 (file)
@@ -8,7 +8,7 @@
 ***********************
 **      FILE NAME      : database.h
 **      SYSTEM NAME    : 
-**      VERSION NUMBER : $Revision: 1.8 $
+**      VERSION NUMBER : $Revision: 1.9 $
 **
 **  DESCRIPTION      :  Classes to provide an abstract layer on the Gnucomo
 **                      database.
 ********************************
 **      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
 **      CREATION DATE   : Sep 10, 2002
-**      LAST UPDATE     : Aug 17, 2003
+**      LAST UPDATE     : Aug 27, 2003
 **      MODIFICATIONS   : 
 **************************************************************************/
 
 /*****************************
    $Log: database.h,v $
-   Revision 1.8  2003-08-17 11:39:33  arjen
+   Revision 1.9  2003-09-02 12:54:10  arjen
+   Overloaded gnucomo_database::Field() to include the Result
+   from a query as an argument.
+
+   Revision 1.8  2003/08/17 11:39:33  arjen
    Changed the gnucomo_database class to the new PostgreSQL
    library, libpqxx
 
@@ -56,7 +60,7 @@
 
 *****************************/
 
-/* static const char *RCSID = "$Id: database.h,v 1.8 2003-08-17 11:39:33 arjen Exp $"; */
+/* static const char *RCSID = "$Id: database.h,v 1.9 2003-09-02 12:54:10 arjen Exp $"; */
 
 #include <pqxx/transaction.h>
 #include "gnucomo_config.h"
@@ -73,7 +77,7 @@
 //
 //  RELATIONS      :
 //  SEE ALSO       :
-//  LAST MODIFIED  : Aug 17, 2003
+//  LAST MODIFIED  : Aug 27, 2003
 ///////////////////////////////////////////////////////////////////////////
 */
 
@@ -132,6 +136,15 @@ public:
       return last_result;
    }
 
+   //  The field value of a specific result.
+
+   String Field(pqxx::Result res, int tuple, const char *fieldname)
+   {
+      return String(res[tuple][fieldname].c_str());
+   }
+
+   //  Use the result of the last query by default
+
    String Field(int tuple, const char *fieldname)
    {
       return String(last_result[tuple][fieldname].c_str());