Samchon Framework for CPP
1.0.0
|
A t-sql statement. More...
#include <TSQLStatement.hpp>
Public Member Functions | |
virtual auto | toXML () const -> std::shared_ptr< XML > override |
Return an XML representing records. More... | |
![]() | |
void | free () |
Free the sql statement. More... | |
void | refresh () |
Refresh the sql statement. More... | |
template<typename T , typename... _Args> | |
void | prepare (const std::string &sql, const T &val, const _Args &...args) |
Prepare a sql statement. More... | |
void | execute () |
Execute the prepared sql statement. More... | |
void | executeDirectly (const std::string &) |
Execute sql-statement direclty. More... | |
auto | fetch () const -> bool |
Fetch a record. More... | |
auto | next () const -> bool |
Move cursor to the next sql-statement. More... | |
auto | size () const -> size_t |
Get size of columns. More... | |
template<typename T > | |
auto | at (size_t index) const -> T |
Get column's data by its index. More... | |
template<typename T > | |
auto | get (const std::string &) const -> T |
Get a column data by its name. More... | |
Additional Inherited Members | |
![]() | |
SQLStatement (SQLi *sqli) | |
Protected Constructor. More... | |
![]() | |
SQLi * | sqli |
SQLi who created the SQLStatement. More... | |
void * | hstmt |
Handler of sql statement (OBDC) More... | |
size_t | bindParameterCount |
Count of binded parameters . More... | |
Map< size_t, SQL_SIZE_T > | bindParameterBASizeMap |
A map for binary size. More... | |
A t-sql statement.
TSQLStatement is a SQLStatement for adjusting domain function f T-SQL, 'FOR XML' statement.
A SQLStatement instance is used to executing a SQL statement and returning the results it produces against a SQL database that is opened through a SQLi instance.
Through the SQLi, it's the reason why a principle of DBMS, DBMS system doesn't allow simultaneous query from a session (connection). Only a query (process) is allowed at a time. If you try to simultaneous query from a SQLi, ODBC throws error. To avoid the error, an execute of query from SQLStatement will lock a mutex of SQLi to ensure exclusiveness.
To ensure the exclusiveness, you've to make SQLStatement from SQLi. Do not make SQLStatement by yourself. call SQLi::createSQLStatement() instead. Even you make a derived class from SQLStatement, don't make its constructor to have public accessor.
Becuase execution of a sql statement causes lock on mutex in SQLi, you've to destruct the SQLStatement or call SQLStatement::free() method(). If you don't, the mutex will not be unlocked, thus you can't do anything by the SQLi.
Definition at line 21 of file TSQLStatement.hpp.
|
overridevirtual |
Return an XML representing records.
Get an XML object generated from a sql statement containing 'FOR XML'
Reimplemented from samchon::library::SQLStatement.
Definition at line 14 of file TSQLStatement.cpp.