2 /**************************************************************************
3 ** (c) Copyright 2002, Andromeda Technology & Automation
4 ** This is free software; you can redistribute it and/or modify it under the
5 ** terms of the GNU General Public License, see the file COPYING.
6 ***************************************************************************
7 ** MODULE INFORMATION *
8 ***********************
9 ** FILE NAME : object.cpp
10 ** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
11 ** VERSION NUMBER : $Revision: 1.1 $
13 ** DESCRIPTION : Implementation of the Object class
18 ***************************************************************************
19 ** ADMINISTRATIVE INFORMATION *
20 ********************************
21 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
22 ** CREATION DATE : Jul 08, 2005
23 ** LAST UPDATE : Jul 08, 2005
25 **************************************************************************/
27 /*****************************
29 Revision 1.1 2007-01-11 13:49:54 arjen
30 Experimental start of database OO abstraction layer.
32 *****************************/
34 static const char *RCSID = "$Id: object.cpp,v 1.1 2007-01-11 13:49:54 arjen Exp $";
38 extern std::ostream *Log;
40 /*=========================================================================
42 ** SYNOPSIS : Object(gnucomo_database &db);
44 ** RETURN VALUE : Object constructor.
46 ** DESCRIPTION : Create a new Object for which there is no representation
53 ** LAST MODIFIED : Jul 08, 2005
54 **=========================================================================
57 Object::Object(gnucomo_database &gdb) : database_entity(gdb, "object")
63 Object::Object(gnucomo_database &gdb, String name) : database_entity(gdb, "object")
71 check_host += "objectname = '";
72 check_host += hostname;
75 if (find_one(check_host) > 0)
77 id = fields["objectid"];
78 std::cerr << "Object id = " << id << "\n";
83 std::list<ObjectLog> Object::select_logs(UTC start, UTC finish, String service)
87 std::list<ObjectLog> logs;
89 String where("objectid=");
92 where += " and timestamp >= '";
93 where += start.format();
94 where += "' and timestamp <= '";
95 where += finish.format();
96 where += "' and servicecode = '";
100 rows_found = find_many("log", where);
102 for (int r = 0; r < rows_found; r++)
104 ObjectLog ol(this, r);