2 /**************************************************************************
3 ** (c) Copyright 2002, Andromeda Technology & Automation
4 ***************************************************************************
5 ** MODULE INFORMATION *
6 ***********************
7 ** FILE NAME : database.h
9 ** VERSION NUMBER : $Revision: 1.1 $
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
24 **************************************************************************/
26 /*****************************
28 Revision 1.1 2002-10-05 10:25:49 arjen
29 Creation of gcm_input and a first approach to a web interface
31 *****************************/
33 /* static const char *RCSID = "$Id: database.h,v 1.1 2002-10-05 10:25:49 arjen Exp $"; */
35 #include <libpq++/pgdatabase.h>
36 #include "gnucomo_config.h"
39 ///////////////////////////////////////////////////////////////////////////
40 // NAME : gnucomo_database
41 // BASECLASS : configuration
44 // METHODS : Database - Obtain the database access string
50 // LAST MODIFIED : Sep 16, 2002
51 ///////////////////////////////////////////////////////////////////////////
54 class gnucomo_database
67 gnucomo_database(gnucomo_config *c); // Use the configuration to connect to the database
69 // Low-level database access functions
73 ExecStatusType result;
75 result = db->Exec(qry);
76 if (result == PGRES_TUPLES_OK || result == PGRES_COMMAND_OK)
82 cerr << "Database query error: " << db->ErrorMessage() << "\n";
87 // Return the objectid of the host given its name.
89 String find_host(const String hostname);