matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type > Class Template Reference

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_tabletable_ptr
 
typedef std::unordered_map< std::string, table_ptrt_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_nodenode ()
 Returns the underlaying prototype node.
 
const prototype_nodenode () const
 Returns the underlaying prototype node.
 
persistencepersistence_unit ()
 Access the underlaying persistence unit object.
 
const persistencepersistence_unit () const
 Access the underlaying persistence unit object.
 

Protected Member Functions

void prepare (connection &conn) override
 Prepares the table object.
 

Detailed Description

template<class T>
class matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >

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.

Template Parameters
TThe type of the table

Member Typedef Documentation

◆ table_type

template<class T >
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

Constructor & Destructor Documentation

◆ table()

template<class T >
matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >::table ( prototype_node node,
persistence p 
)
inline

Creates a new table.

Creates a new table for the given node and the given persistence object.

Parameters
nodeThe underlying prototype_node
pThe underlying persistence object

Member Function Documentation

◆ create()

template<class T >
void matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >::create ( connection conn)
inlineoverridevirtual

Create the table on database.

Creates the database table for the given connection

Parameters
connThe database connection

Implements matador::basic_table.

◆ drop()

template<class T >
void matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >::drop ( connection conn)
inlineoverridevirtual

Drops the table on database.

Drops the database table for the given connection

Parameters
connThe database connection

Implements matador::basic_table.

◆ insert()

template<class T >
void matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >::insert ( object_proxy *  proxy)
inlineoverridevirtual

Insert the object proxy into the table.

Insert the given object proxy into the database table.

Parameters
proxyThe object proxy to be inserted

Implements matador::basic_table.

◆ load()

template<class T >
void matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >::load ( object_store store)
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.

Parameters
storeThe object store to load the data into

Implements matador::basic_table.

◆ prepare()

template<class T >
void matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >::prepare ( connection conn)
inlineoverrideprotected

Prepares the table object.

Prepares the table object for the given connection. Subsequently some prepared statements are created:

  • select
  • insert
  • update
  • delete

These statements will be used on the provide methods.

Parameters
connThe database connection

◆ remove()

template<class T >
void matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >::remove ( object_proxy *  proxy)
inlineoverridevirtual

Deletes the object proxy from table.

The object represented by the object proxy is deleted from the table

Parameters
proxyThe object proxy to be deleted

Implements matador::basic_table.

◆ reset()

template<class T >
void matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >::reset ( )
inlineoverridevirtual

Marks the table as not loaded.

Reimplemented from matador::basic_table.

◆ update()

template<class T >
void matador::table< T, typename std::enable_if<!std::is_base_of< basic_has_many_to_many_item, T >::value >::type >::update ( object_proxy *  proxy)
inlineoverridevirtual

Updates the object proxy on database.

Updates the given object proxy on the database.

Parameters
proxyThe object proxy to update

Implements matador::basic_table.


The documentation for this class was generated from the following file:
  • matador/orm/table.hpp