3 #include "pqxx_traits.hpp"
4 #include "test_gen.hpp"
9 typedef sqlgg
<pqxx_traits
> gen
;
15 connection
C("dbname=test");
16 cout
<< "Connected to " << C
.dbname() << endl
;
20 R
= W
.exec("DROP TABLE employee");
21 gen::create_employee(W
);
23 gen::insert_employee(W
,"john",2);
24 gen::insert_employee(W
,"jack",3);
25 gen::insert_employee(W
,"bob",4);
26 R
= W
.exec("SELECT name FROM employee");
28 cout
<< "Found " << R
.size() << " employees:" << endl
;
29 for (result::const_iterator r
= R
.begin();
33 cout
<< r
[0].c_str() << endl
;
36 cout
<< "Doubling all employees' salaries..." << endl
;
37 W
.exec("UPDATE employee SET salary=salary*2");
39 cout
<< "Making changes definite: ";
41 cout
<< "ok." << endl
;
43 catch (const exception
&e
)
45 cerr
<< e
.what() << endl
;