/[H9]/trunk/tntnet/dynamic/critical.ecpp
ViewVC logotype

Diff of /trunk/tntnet/dynamic/critical.ecpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 103 by torben, Tue Nov 27 17:08:11 2007 UTC revision 104 by torben, Thu Nov 29 17:06:38 2007 UTC
# Line 3  Line 3 
3  #include <tntdb/connection.h>  #include <tntdb/connection.h>
4  #include <tntdb/result.h>  #include <tntdb/result.h>
5  #include <tntdb/row.h>  #include <tntdb/row.h>
6    
7    #include <vector>
8    
9    
10    
11    class CriticalInstallation
12    {
13    public:
14            CriticalInstallation() {}
15            CriticalInstallation(int i, std::string m) : id(i), message(m) {}
16            int id;
17            std::string message;
18    };
19    
20  </%pre>  </%pre>
21    
22  <%config>  <%config>
# Line 11  dburl; Line 25  dburl;
25    
26  <&header title="Critical systems">  <&header title="Critical systems">
27  </&header>  </&header>
28    <h2>Critical systems</h2>
29    
30  <{  <{
 tntdb::Connection conn;  
31    
32  conn = tntdb::connect(dburl); //letting exceptions flow up and to tntnet and let it display an error message  
33    std::vector<CriticalInstallation> criticals;
34    
35    tntdb::Connection conn = tntdb::connect(dburl);
36    
37    tntdb::Result res = conn.select("SELECT id FROM installation WHERE commerror = true");
38    for (int i=0; i<res.size(); ++i)
39    {
40            criticals.push_back(CriticalInstallation(res[i].getInt(0), std::string("Communication Error")));
41    }
42    
43  }>  }>
44    

Legend:
Removed from v.103  
changed lines
  Added in v.104

  ViewVC Help
Powered by ViewVC 1.1.20