2 /**************************************************************************
3 ** (c) Copyright 2002, Andromeda Technology & Automation
4 ***************************************************************************
5 ** MODULE INFORMATION *
6 ***********************
7 ** FILE NAME : database.h
9 ** VERSION NUMBER : $Revision: 1.2 $
11 ** DESCRIPTION : Classes to provide an abstract layer on the Gnucomo
17 ***************************************************************************
18 ** ADMINISTRATIVE INFORMATION *
19 ********************************
20 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
21 ** CREATION DATE : Sep 10, 2002
22 ** LAST UPDATE : Nov 04, 2002
24 **************************************************************************/
26 /*****************************
28 Revision 1.2 2002-11-04 10:13:36 arjen
29 Use proper namespace for iostream classes
31 Revision 1.1 2002/10/05 10:25:49 arjen
32 Creation of gcm_input and a first approach to a web interface
34 *****************************/
36 /* static const char *RCSID = "$Id: database.h,v 1.2 2002-11-04 10:13:36 arjen Exp $"; */
38 #include <libpq++/pgdatabase.h>
39 #include "gnucomo_config.h"
42 ///////////////////////////////////////////////////////////////////////////
43 // NAME : gnucomo_database
44 // BASECLASS : configuration
47 // METHODS : Database - Obtain the database access string
53 // LAST MODIFIED : Sep 16, 2002
54 ///////////////////////////////////////////////////////////////////////////
57 class gnucomo_database
70 gnucomo_database(gnucomo_config *c); // Use the configuration to connect to the database
72 // Low-level database access functions
76 ExecStatusType result;
78 result = db->Exec(qry);
79 if (result == PGRES_TUPLES_OK || result == PGRES_COMMAND_OK)
85 std::cerr << "Database query error: " << db->ErrorMessage() << "\n";
90 // Return the objectid of the host given its name.
92 String find_host(const String hostname);