Samchon Framework for CPP  1.0.0
samchon::library::TSQLi Class Reference

A SQL interface for T-SQL. More...

#include <TSQLi.hpp>

Collaboration diagram for samchon::library::TSQLi:

Public Member Functions

 TSQLi (int port=1433)
 Construct from port. More...
 
virtual auto createStatement () -> std::shared_ptr< SQLStatement >
 Factory method for creating T-SQL statement. More...
 
- Public Member Functions inherited from samchon::library::SQLi
 SQLi (const std::string &driver, int port)
 Construct from driver name and port. More...
 
virtual void connect (const std::string &ip, const std::string &db, const std::string &id, const std::string &pwd)
 Connect to the DBMS
. More...
 
virtual void disconnect ()
 Disconnect from DBMS. More...
 

Additional Inherited Members

- Protected Attributes inherited from samchon::library::SQLi
std::string driver
 Driver; name of DBMS used for connection. More...
 
int port
 Port number of DBMS. More...
 

Detailed Description

A SQL interface for T-SQL.

[Inherited]

SQLi is an abstract class managing connection (session) with a specific database and manages SQL statements are executed and results are returned within the context of a connection.

The reason why SQLStatement(s) are managed by SQLi is because of a principle of DBMS, DBMS system doesn't allow simultaneous query from a session (connection). Only a query (process0) 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.

library_sql.png
Note

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.

See also
samchon::library
Author
Jeongho Nam http://samchon.org

Definition at line 19 of file TSQLi.hpp.

Constructor & Destructor Documentation

TSQLi::TSQLi ( int  port = 1433)

Construct from port.

Parameters
portPort number of T-SQL. default is 1433.

Definition at line 8 of file TSQLi.cpp.

Member Function Documentation

auto TSQLi::createStatement ( ) -> std::shared_ptr<SQLStatement>
virtual

Factory method for creating T-SQL statement.

To realize domain function in T-SQL, 'FOR XML' statement.

[Inherited]
SQLi::createStatement()
Returns
A T-SQL statement

Reimplemented from samchon::library::SQLi.

Definition at line 13 of file TSQLi.cpp.


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