13 |
dburl; |
dburl; |
14 |
</%config> |
</%config> |
15 |
|
|
16 |
<&header title="Critical systems"> |
<&header title="Customers and installations"> |
17 |
</&header> |
</&header> |
18 |
|
|
19 |
<h2>Customers and installations</h2> |
<h2>Customers and installations</h2> |
21 |
<{ |
<{ |
22 |
tntdb::Connection conn; |
tntdb::Connection conn; |
23 |
|
|
24 |
conn = tntdb::connect(dburl); //letting exceptions flow up and to tntnet and let it display an error message |
conn = tntdb::connectCached(dburl); //letting exceptions flow up and to tntnet and let it display an error message |
25 |
|
|
26 |
std::string customer_sql = "SELECT id,name,address,phonenr,contactperson FROM customer ORDER BY name ASC"; |
std::string customer_sql = "SELECT id,name,address,phonenr,contactperson FROM customer ORDER BY name ASC"; |
27 |
|
|
50 |
std::stringstream sqlstream; |
std::stringstream sqlstream; |
51 |
sqlstream << "SELECT id, description FROM installation "; |
sqlstream << "SELECT id, description FROM installation "; |
52 |
sqlstream << "WHERE customerid = " << customerid; |
sqlstream << "WHERE customerid = " << customerid; |
53 |
|
sqlstream << " ORDER BY description ASC"; |
54 |
|
|
55 |
tntdb::Result instres = conn.select(sqlstream.str()); |
tntdb::Result instres = conn.select(sqlstream.str()); |
56 |
|
|
57 |
if (instres.size() > 0) |
if (instres.size() > 0) |
58 |
{ |
{ |
59 |
out << "Installations:\n"; |
out << "Installations:\n"; |
60 |
out << "<ol style='margin-top:0px;'>\n"; |
out << "<ol>\n"; |
61 |
for (tntdb::Result::const_iterator instit = instres.begin(); instit != instres.end(); ++instit) |
for (tntdb::Result::const_iterator instit = instres.begin(); instit != instres.end(); ++instit) |
62 |
{ |
{ |
63 |
tntdb::Row instrow = *instit; |
tntdb::Row instrow = *instit; |