Wt
3.3.8
|
Traits class for result types. More...
#include <Wt/Dbo/SqlTraits>
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. More... | |
static Result | load (Session &session, SqlStatement &statement, int &column) |
Reads a result from an executed query. More... | |
static void | getValues (const Result &result, std::vector< boost::any > &values) |
Returns result values. More... | |
static void | setValue (Result &result, int &index, const boost::any &value) |
Sets a result value. More... | |
static Result | create () |
Creates a new result. More... | |
static void | add (Session &session, Result &result) |
Adds a new result to the session. More... | |
static void | remove (Result &result) |
Removes a result from the session. More... | |
static long long | id (const Result &result) |
Returns a unique id for a result. More... | |
static Result | findById (Session &session, long long id) |
Find a result by id. More... | |
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.
|
static |
Adds a new result to the session.
Adds a (newly created) result to a session.
This method needs to be implemented only if you want to create new results from a QueryModel (which implements Wt's MVC item model).
|
static |
Creates a new result.
Creates a new result. This should initialize a result so that its values can be set using setValue() or read using getValues().
The result should not yet be associated with a session.
This method needs to be implemented only if you want to create new results from a QueryModel (which implements Wt's MVC item model).
|
static |
Find a result by id.
This needs to be inverse of id()
|
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.
This method is needed when you want to use Result as the result of query.
|
static |
Returns result values.
This returns the individual field values in the given result
.
This method needs to be implemented only if you want to display the result in a QueryModel (which implements Wt's MVC item model).
|
static |
Returns a unique id for a result.
This method needs to be implemented to return a unique id for a result which can later be used to find the result.
If not supported, return -1.
|
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()).
This method is needed when you want to use Result as the result of query.
|
static |
Removes a result from the session.
This method needs to be implemented only if you want to remove results from a QueryModel (which implements Wt's MVC item model).
|
static |
Sets a result value.
Sets the value at index
, where index indicates the field whose value needs to be updated.
When index
is out-of-bounds, it should be decremented with as many fields as there are in this result type. Otherwise, index should be set to -1 after the value has been set.
This method needs to be implemented only if you want to modify the result from a QueryModel (which implements Wt's MVC item model).