Proud::CAdoConnection Class Reference
Inheritance diagram for Proud::CAdoConnection:

Public Member Functions

PROUDSRV_API CAdoConnection (ADODB::_Connection *conn)
 
PROUDSRV_API void OpenEx (const String &connectionString, const PNTCHAR *AppName)
 
void Open (const String &connectionString)
 
PROUDSRV_API void OpenEx (const String &connectionString, const PNTCHAR *AppName, DbmsType Type)
 
void Open (const String &connectionString, DbmsType Type)
 
PROUDSRV_API void Close ()
 
PROUDSRV_API void Close_NoThrow ()
 
PROUDSRV_API bool IsOpened ()
 
PROUDSRV_API long Execute (const String &lpszSQL)
 
PROUDSRV_API long Execute (CAdoRecordset &outputRecords, const String &lpszSQL)
 
void BeginTrans ()
 
void RollbackTrans ()
 
void CommitTrans ()
 

Additional Inherited Members

PROUDSRV_API void ExecuteBegin ()
 
PROUDSRV_API void ExecuteEnd (const String &command)
 

Detailed Description

DMBS link object of ADO Wrapper API

  • If you access other thread with this object, it will occur some problems (e.g. race condition) So we recommend to use this object with changing local variable when you needed. However it is better to leave process object without using to improve performance. Please refer to Accessing database with ADOion_pooling for more detail.
  • Before creating this object, at least once of Colnitialize must be called. It will be much convenient if the following syntax is included in the thread main function.
  • Function that checks whether or not critical section has been touched while accessing DB: ADODB_RefCriticalSection, ADODB_RecommendCriticalSectionProc

Member Function Documentation

void Proud::CAdoConnection::BeginTrans ( )
inline

DB transaction begins

PROUDSRV_API void Proud::CAdoConnection::Close ( )

ADODB will be closed.

PROUDSRV_API void Proud::CAdoConnection::Close_NoThrow ( )

ADODB will be closed.

  • throw will not occur.
void Proud::CAdoConnection::CommitTrans ( )
inline

DB transaction commit

PROUDSRV_API long Proud::CAdoConnection::Execute ( const String lpszSQL)

Executes SQL syntax. Can use as printf().

Parameters
lpszSQLSQL syntax
Returns
Number of records affected by stored procedure; 0 if no rows were affected or the statement failed; and -1 for SELECT statements
PROUDSRV_API long Proud::CAdoConnection::Execute ( CAdoRecordset outputRecords,
const String lpszSQL 
)

Executes SQL syntax. The result gets stored at outputRecords.

Parameters
outRecordsetRecordset of results to get.
lpszSQLSQL syntax
Returns
Number of records affected by stored procedure; 0 if no rows were affected or the statement failed; and -1 for SELECT statements
PROUDSRV_API bool Proud::CAdoConnection::IsOpened ( )

Is ADO object connected to DB server?

Returns
true if it succeed to connect DB;false if it failed to connect DB
void Proud::CAdoConnection::Open ( const String connectionString)
inline

This method connects to DB. Refer to OpenEx guideline for more details.

Parameters
connectionStringDB Connection String
void Proud::CAdoConnection::Open ( const String connectionString,
DbmsType  Type 
)
inline

This method connects to DB. Refer to OpenEx guideline for more details.

Parameters
connectionStringDB Connection String
PROUDSRV_API void Proud::CAdoConnection::OpenEx ( const String connectionString,
const PNTCHAR *  AppName 
)

This method connects to DB. It has a function that expanse ADODB.Connection.

Parameters
connectionStringDBMS link string
  • It follows the rule of ADO DB connection string. Refer to http://www.connectionstrings.com/ for more details.
  • If Driver or Provider is not included, use sqloledb as provider. Below is an example.
    Data Source=.;Database=ProudDB-Test;Trusted_Connection=yes // use . instead of localhost. using localhost causes connection error in some computers.
    Data Source=.;Database=ProudDB-Test;user id=xxx;password=yyy
AppNameName being displayed on SQL Server Enterprise Manager. This method helps detecting dead-lock when adding a name that points to a specific routine to the name of connection. If you don't insert this method, this will be ignores.
PROUDSRV_API void Proud::CAdoConnection::OpenEx ( const String connectionString,
const PNTCHAR *  AppName,
DbmsType  Type 
)

TODO:translate needed. This method connects to DB. It has a function that expans ADODB.Connection.

Parameters
connectionStringDBMS link string
  • It follows the rule of ADO DB connection string. Refer to http://www.connectionstrings.com/ for more details. Below is one example.
    Data Source=.;Database=ProudDB-Test;Trusted_Connection=yes // .을 써야지, localhost를 쓰지 말 것. 일부 컴에서 연결 실패 오류로 이어짐.
    Data Source=.;Database=ProudDB-Test;user id=xxx;password=yyy
    //MySql
    Driver={MySQL ODBC 5.1 Driver};server=xxx.xxx.xxx.xxx;port=3306;Database=TableName;User ID=UserID;Password=yyy;
AppNameName being displayed on SQL Server Enterprise Manager. This method helps detecting dead-lock when adding a name that points to a specific routine to the name of connection. It ignores if you don't insert this method.
TypeThis inserts enum value of DbmsType such as for Sql,MySql and etc.(MsSql internally uses sqloledb Provider.)
void Proud::CAdoConnection::RollbackTrans ( )
inline

DB transaction rollback