Represents a database table. More...
#include <table.hpp>
Inherits matador::basic_table.
Public Types | |
typedef T | table_type |
Public Types inherited from matador::basic_table | |
typedef std::shared_ptr< basic_table > | table_ptr |
typedef std::unordered_map< std::string, table_ptr > | t_table_map |
typedef std::unordered_map< std::string, detail::t_identifier_multimap > | t_relation_item_map |
typedef std::unordered_map< std::string, std::shared_ptr< detail::basic_relation_data > > | t_relation_data_map |
Public Member Functions | |
table (prototype_node &node, persistence &p) | |
Creates a new table. | |
void | create (connection &conn) override |
Create the table on database. | |
void | drop (connection &conn) override |
Drops the table on database. | |
void | load (object_store &store) override |
Loads tables data into store. | |
void | insert (object_proxy *proxy) override |
Insert the object proxy into the table. | |
void | update (object_proxy *proxy) override |
Updates the object proxy on database. | |
void | remove (object_proxy *proxy) override |
Deletes the object proxy from table. | |
void | reset () override |
Marks the table as not loaded. | |
Public Member Functions inherited from matador::basic_table | |
basic_table (prototype_node &node, persistence &p) | |
Creates a basic_table. | |
std::string | name () const |
Returns the name of the table. | |
bool | is_loaded () const |
Returns true if the table is laready loaded. | |
prototype_node & | node () |
Returns the underlaying prototype node. | |
const prototype_node & | node () const |
Returns the underlaying prototype node. | |
persistence & | persistence_unit () |
Access the underlaying persistence unit object. | |
const persistence & | persistence_unit () const |
Access the underlaying persistence unit object. | |
Protected Member Functions | |
void | prepare (connection &conn) override |
Prepares the table object. | |
Represents a database table.
This class represents one table on the database created by the given type. All columns are derived from the given type.
T | The type of the table |
typedef T matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >::table_type |
Shortcut to the type the table represents
|
inline |
Creates a new table.
Creates a new table for the given node and the given persistence object.
node | The underlying prototype_node |
p | The underlying persistence object |
|
inlineoverridevirtual |
Create the table on database.
Creates the database table for the given connection
conn | The database connection |
Implements matador::basic_table.
|
inlineoverridevirtual |
Drops the table on database.
Drops the database table for the given connection
conn | The database connection |
Implements matador::basic_table.
|
inlineoverridevirtual |
Insert the object proxy into the table.
Insert the given object proxy into the database table.
proxy | The object proxy to be inserted |
Implements matador::basic_table.
|
inlineoverridevirtual |
Loads tables data into store.
Loads the data of the table into the given object store. It is also ensured that all relations are resolved or at least prepared for later resolve.
store | The object store to load the data into |
Implements matador::basic_table.
|
inlineoverrideprotected |
Prepares the table object.
Prepares the table object for the given connection. Subsequently some prepared statements are created:
These statements will be used on the provide methods.
conn | The database connection |
|
inlineoverridevirtual |
Deletes the object proxy from table.
The object represented by the object proxy is deleted from the table
proxy | The object proxy to be deleted |
Implements matador::basic_table.
|
inlineoverridevirtual |
Marks the table as not loaded.
Reimplemented from matador::basic_table.
|
inlineoverridevirtual |
Updates the object proxy on database.
Updates the given object proxy on the database.
proxy | The object proxy to update |
Implements matador::basic_table.