Wt::Dbo::query_result_traits< Result > Class Template Reference
[Database Objects (Dbo)]

Traits class for result types. More...

#include <Wt/Dbo/SqlTraits>

List of all members.

Static Public Member Functions

static void getFields (Session &session, std::vector< std::string > *aliases, std::vector< FieldInfo > &result)
 Obtains the list of fields in this result.
static Result load (Session &session, SqlStatement &statement, int &column)
 Reads a result from an executed query.
static void getValues (const Result &result, std::vector< boost::any > &values)
 Returns result values.


Detailed Description

template<typename Result>
class Wt::Dbo::query_result_traits< Result >

Traits class for result types.

This traits class may be used to add support for using classes or structs as a result for a Session::query().

The library provides by default support for primitive types, using sql_value_traits, mapped objects held by ptr types, and boost::tuple<> of any combination of these.

See also:
sql_value_traits, ptr

Member Function Documentation

template<typename Result>
void Wt::Dbo::query_result_traits< Result >::getFields ( Session session,
std::vector< std::string > *  aliases,
std::vector< FieldInfo > &  result 
) [inline, static]

Obtains the list of fields in this result.

This is used to build the select clause of an Sql query.

The given aliases may be used to qualify fields that correspond to entire tables (popping values from the front of this vector). An exception is thrown if not enough aliases were provided.

template<typename Result>
Result Wt::Dbo::query_result_traits< Result >::load ( Session session,
SqlStatement statement,
int &  column 
) [inline, static]

Reads a result from an executed query.

This reads the value from the statement, starting at column column, and advancing the column pointer for as many columns as needed (and according to the number of fields returned by getFields()).

template<typename Result>
void Wt::Dbo::query_result_traits< Result >::getValues ( const Result &  result,
std::vector< boost::any > &  values 
) [inline, static]

Returns result values.

This returns the individual field values in the given result.


Generated on Thu May 20 18:14:52 2010 for Wt by doxygen 1.5.6