pqxx::prepare Namespace Reference

Dedicated namespace for helper types related to prepared statements. More...


Classes

class  declaration
 Helper class for declaring parameters to prepared statements. More...
class  invocation
 Helper class for passing parameters to, and executing, prepared statements. More...

Namespaces

namespace  internal

Enumerations

enum  param_treatment { treat_binary, treat_string, treat_bool, treat_direct }
 Type of treatment of a particular parameter to a prepared statement. More...


Detailed Description

Dedicated namespace for helper types related to prepared statements.

Enumeration Type Documentation

Type of treatment of a particular parameter to a prepared statement.

This information is needed to determine whether a parameter needs to be quoted, escaped, binary-escaped, and/or converted to boolean as it is passed to a prepared statement on execution.

This treatment becomes especially relevant when either the available libpq version doesn't provide direct support for prepared statements, so the definition must be generated as SQL. This is the case with libpq versions prior to the one shipped with PostgreSQL 7.4).

To pass binary data into a prepared statement, declare it using treat_binary. When invoking the statement, pass in the binary data as a standard string object. If your data can contain null bytes, be careful to have those included in the string object: std::string("\0 xyz") will construct an empty string because it stops reading data at the nul byte. You can include the full array of data by passing its length to the string constructor: std::string("\0 xyz", 5)

Enumerator:
treat_binary  Pass as raw, binary bytes.
treat_string  Escape special characters and add quotes.
treat_bool  Represent as named Boolean value.
treat_direct  Include directly in SQL without conversion (e.g. for numeric types).


Generated on Mon Feb 15 18:22:54 2010 for libpqxx by  doxygen 1.5.5