1 |
torben |
90 |
<%pre> |
2 |
|
|
#include <tntdb/connect.h> |
3 |
|
|
#include <tntdb/connection.h> |
4 |
|
|
#include <tntdb/result.h> |
5 |
|
|
#include <tntdb/row.h> |
6 |
|
|
#include <sstream> |
7 |
|
|
</%pre> |
8 |
|
|
|
9 |
|
|
<%config> |
10 |
|
|
dburl; |
11 |
|
|
</%config> |
12 |
|
|
|
13 |
|
|
<%session scope="global"> |
14 |
|
|
std::string userName; |
15 |
|
|
</%session> |
16 |
|
|
|
17 |
|
|
|
18 |
|
|
<%args> |
19 |
|
|
int id; |
20 |
|
|
</%args> |
21 |
|
|
|
22 |
|
|
<{ |
23 |
|
|
|
24 |
|
|
if (userName.size() == 0) |
25 |
|
|
{ |
26 |
torben |
94 |
reply.setHeader("Location", "index"); |
27 |
|
|
return HTTP_MOVED_TEMPORARILY; |
28 |
|
|
} |
29 |
|
|
|
30 |
torben |
195 |
tntdb::Connection conn = tntdb::connectCached(dburl); |
31 |
torben |
90 |
|
32 |
torben |
94 |
std::stringstream query; |
33 |
|
|
query << "DELETE FROM customer WHERE id = " << id; |
34 |
torben |
90 |
|
35 |
torben |
94 |
conn.execute(query.str()); |
36 |
|
|
reply.setHeader("Location", "adm_customer_list"); |
37 |
|
|
return HTTP_MOVED_TEMPORARILY; |
38 |
torben |
90 |
|
39 |
torben |
94 |
|
40 |
torben |
90 |
}> |