DB 커넥션 인스턴스 Pool
더 자세히 ...
#include <JNetDB.h>
◆ JNetDBConnPool() [1/2]
jnet::JNetDBConnPool::JNetDBConnPool |
( |
| ) |
|
|
inline |
JNetDBConnPool()
Definition JNetDB.h:122
◆ JNetDBConnPool() [2/2]
jnet::JNetDBConnPool::JNetDBConnPool |
( |
bool | dbConnErrorLog | ) |
|
|
inline |
bool m_DBConnErrorLogFlag
Definition JNetDB.h:119
◆ ~JNetDBConnPool()
jnet::JNetDBConnPool::~JNetDBConnPool |
( |
| ) |
|
|
inline |
124 {
126 }
void Clear()
Definition JNetDB.cpp:487
◆ Connect()
bool JNetDBConnPool::Connect |
( |
INT32 | connectionCount, |
|
|
const WCHAR * | connectionString ) |
461{
462
463 if (::SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &
m_SqlEnvironment) != SQL_SUCCESS)
464 return false;
465
466
467 if (::SQLSetEnvAttr(
m_SqlEnvironment, SQL_ATTR_ODBC_VERSION,
reinterpret_cast<SQLPOINTER
>(SQL_OV_ODBC3), 0) != SQL_SUCCESS)
468 return false;
469
470
471
472
474 for (INT32 i = 0; i < connectionCount; i++)
475 {
477
479 return false;
480
482 }
483
484 return true;
485}
SQLHENV m_SqlEnvironment
Definition JNetDB.h:112
std::mutex m_DBConnectionsMtx
Definition JNetDB.h:117
std::queue< JNetDBConn * > m_DBConnectionsQueue
Definition JNetDB.h:116
DB Connection 추상화
Definition JNetDB.h:17
bool Connect(SQLHENV henv, const WCHAR *connectionString)
Definition JNetDB.cpp:12
◆ Clear()
void JNetDBConnPool::Clear |
( |
| ) |
|
488{
489
491 {
494 }
495
496
498
499
500
501
502
506 delete dbConn;
507 }
508}
◆ Pop()
511{
513
514
516 return nullptr;
517
518
519
522 return connection;
523}
◆ Push()
void JNetDBConnPool::Push |
( |
JNetDBConn * | connection, |
|
|
bool | isDisconnected = false, |
|
|
bool | tryToConnect = false, |
|
|
const WCHAR * | connectionString = NULL ) |
526{
528
529 if (isDisconnected) {
530 if (!connection->
Ping()) {
531 delete connection;
532
533 if (tryToConnect) {
536 return;
537 }
538
540 }
541 }
542 else {
543
544
546 }
547 }
548 else {
549
551 }
552}
bool Ping()
Definition JNetDB.cpp:88
◆ m_SqlEnvironment
SQLHENV jnet::JNetDBConnPool::m_SqlEnvironment = SQL_NULL_HANDLE |
|
private |
◆ m_DBConnectionsQueue
std::queue<JNetDBConn*> jnet::JNetDBConnPool::m_DBConnectionsQueue |
|
private |
◆ m_DBConnectionsMtx
std::mutex jnet::JNetDBConnPool::m_DBConnectionsMtx |
|
private |
◆ m_DBConnErrorLogFlag
bool jnet::JNetDBConnPool::m_DBConnErrorLogFlag |
|
private |
이 클래스에 대한 문서화 페이지는 다음의 파일들로부터 생성되었습니다.: