12 #if defined(SQLGG_DEBUG)
20 typedef std::string Text
;
23 typedef pqxx::result::const_iterator row
;
24 typedef pqxx::work
& connection
;
26 static void get_column(row r
, int index
, Int
& data
)
31 static void get_column(row r
, int index
, Text
& data
)
35 typedef pqxx::prepare::declaration stmt_decl
;
37 static void set_param(stmt_decl
const& stmt
, const Text
& val
, int index
)
39 stmt("varchar",pqxx::prepare::treat_string
);
42 static void set_param(stmt_decl
const& stmt
, const Int
& val
, int index
)
44 stmt("INTEGER",pqxx::prepare::treat_direct
);
48 static void set_param(pqxx::prepare::invocation
& stmt
, const T
& val
, int index
)
53 template<class Container
, class Binder
, class Params
>
54 static bool do_select(connection db
, Container
& result
, const char* sql
, Binder binder
, Params params
)
56 const char* name
= "sqlgg_stmt";
57 cout
<< "start prepare" << endl
;
58 pqxx::prepare::declaration decl
= db
.conn().prepare(name
,sql
);
59 params
.set_params(decl
);
61 cout
<< "start invoke" << endl
;
62 pqxx::prepare::invocation call
= db
.prepared(name
);
63 cout
<< "set params" << endl
;
64 params
.set_params(call
);
65 cout
<< "exec" << endl
;
67 cout
<< "execed" << endl
;
69 db
.conn().unprepare(name
);
76 void set_params(pqxx::prepare::declaration
const&) {}
77 void set_params(pqxx::prepare::invocation
&) {}
89 template<class Params
>
90 static bool do_execute(connection db
, const char* sql
, Params params
)
93 return do_select(db
,R
,sql
,no_binder
<int>(),params
);