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

Public Member Functions

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

Additional Inherited Members

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

PROUD_API void Proud::CAdoConnection::Close ( )

ADODB will be closed.

PROUD_API void Proud::CAdoConnection::Close_NoThrow ( )

ADODB will be closed.

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

DB transaction commit

PROUD_API long Proud::CAdoConnection::Execute ( const PNTCHAR *  lpszSQL)

Executes SQL syntax. Can use as printf(). SQL syntax

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

Executes SQL syntax. The result gets stored at outputRecords.

Parameters
outRecordsetRecordset of results to get. SQL syntax
Returns
Number of records affected by stored procedure; 0 if no rows were affected or the statement failed; and -1 for SELECT statements
PROUD_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 PNTCHAR *  pszConnStr)
inline

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

Parameters
pszConnStrDB Connection String
void Proud::CAdoConnection::Open ( const PNTCHAR *  pszConnStr,
DbmsType  Type 
)
inline

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

Parameters
pszConnStrDB Connection String
PROUD_API void Proud::CAdoConnection::OpenEx ( const PNTCHAR *  pszConnStr,
const PNTCHAR *  AppName 
)

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

Parameters
pszConnStrDBMS 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.
PROUD_API void Proud::CAdoConnection::OpenEx ( const PNTCHAR *  pszConnStr,
const PNTCHAR *  AppName,
DbmsType  Type 
)

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

Parameters
pszConnStrDBMS 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