Samchon Framework for CPP  1.0.0
samchon::protocol::ISQLEntity Class Reference

An interface supporting DB-I/O. More...

#include <ISQLEntity.hpp>

Public Member Functions

 ISQLEntity ()
 Default Constructor. More...
 
virtual void load (std::shared_ptr< library::SQLStatement > stmt)
 Load data of entity from DB. More...
 
virtual void archive (std::shared_ptr< library::SQLStatement > stmt)
 Archive data of entity to DB. More...
 
virtual auto toSQL () const -> std::string
 Get a sql-statement string represents the entity. More...
 

Detailed Description

An interface supporting DB-I/O.

ISQLEntity is an interface for interacting with Database. By implementing load() and archive() methods, you can make an entity to interact with a Database.

If an entity implementing the ISQLEntity is a type of EntityGroup and its children also implemented the ISQLEntity, you can realize construction and archiving chain by each child entity to do their I/O procedures by their own.

library_sql.png
Author
Jeongho Nam http://samchon.org

Definition at line 32 of file ISQLEntity.hpp.

Constructor & Destructor Documentation

ISQLEntity::ISQLEntity ( )

Default Constructor.

Definition at line 9 of file ISQLEntity.cpp.

Member Function Documentation

void ISQLEntity::load ( std::shared_ptr< library::SQLStatement stmt)
virtual

Load data of entity from DB.

Loads and constructs data of the entity from a SQLStatement.

If an entity implementing the ISQLEntity is a type of EntityGroup and its children also implemented the ISQLEntity, you can realize construction chain by each child entity fetches data of their own by themselves.

Parameters
stmtSQLStatement storing data of the Entity

Definition at line 13 of file ISQLEntity.cpp.

void ISQLEntity::archive ( std::shared_ptr< library::SQLStatement stmt)
virtual

Archive data of entity to DB.

Archives data of the entity to Database by a SQLStatement.

If an entity implementing the ISQLEntity is a type of EntityGroup and its children also implemented the ISQLEntity, you can realize archiving chain by each child entity archives data of their own by themselves.

Parameters
stmtSQLStatement would store data of the Entity

Definition at line 16 of file ISQLEntity.cpp.

auto ISQLEntity::toSQL ( ) const -> std::string
virtual

Get a sql-statement string represents the entity.

ISQLEntity::toSL() is an abstract method returns a sql-statement string.

However, if there's some parameter in a sql-statement string from the toString() method, it is categorized in dynamic sql. In that case, do not access table directly but indirect from sql-procedure. Indirecting procedure is good for performance and security.

Returns
SQL storing record(s) to temporary table of a Procedure

Definition at line 20 of file ISQLEntity.cpp.


The documentation for this class was generated from the following files: