[Libpqxx-general] Howto escape inside a transactor?

Jeroen Vermeulen jtv at xs4all.nl
Wed Jun 10 15:11:31 UTC 2009


Roland Bock wrote:

> class my_transactor: public pqxx::transactor<>
> {
> ...
>    void operator()(argument_type& t)
>    {
>    ...
>    }
> ...
> }
> 
> Within the operator(), I would like to escape a string (following the 
> tutorial "Make me proud."). I don't seem to be able to find the right 
> way, though:
> 
> The pqxx::escape_binary is deprecated, the pqxx::connection object I 
> have at hand has a esc function, but it is private and I doubt that I 
> should create a transaction object insider my transactor just to call an 
> escape function...

The argument_type is actually an alias for "whatever transaction type 
your transactor uses."  So t is the transaction you're looking for. 
Since you're not overriding the type, you're getting the standard 
transaction type at the standard read-committed isolation level.

(Apart from that, don't fret, looks like you've got things down pretty 
well :-)


Jeroen


More information about the Libpqxx-general mailing list