JNetLibray
로딩중...
검색중...
일치하는것 없음
jnet::JNetOdbcServer 클래스 참조

DB 커넥션 기능을 수행하는 DB 커넥션 객체 풀을 관리하여 커넥션(HoldConnection)과 SQL 쿼리 및 응답 처리(ExecQuery, FetchQuery) 추상화 제공 더 자세히 ...

#include <JNetCore.h>

jnet::JNetOdbcServer에 대한 상속 다이어그램 :
jnet::JNetServer jnet::JNetCore

Public 멤버 함수

 JNetOdbcServer (int32 dbConnCnt, const WCHAR *odbcConnStr, const char *serverIP, uint16 serverPort, uint16 maximumOfConnections, PACKET_CODE packetCode_LAN, PACKET_CODE packetCode, PACKET_SYMM_KEY packetSymmetricKey, bool recvBufferingMode, uint16 maximumOfSessions, uint32 numOfIocpConcurrentThrd, uint16 numOfIocpWorkerThrd, size_t tlsMemPoolUnitCnt, size_t tlsMemPoolUnitCapacity, uint32 memPoolBuffAllocSize, uint32 sessionRecvBuffSize, bool calcTpsThread)
 
bool Start ()
 
void Stop ()
 
- jnet::JNetServer(으)로부터 상속된 Public 멤버 함수
 JNetServer (const char *serverIP, uint16 serverPort, uint16 maximumOfConnections, PACKET_CODE packetCode_LAN, PACKET_CODE packetCode, PACKET_SYMM_KEY packetSymmetricKey, bool recvBufferingMode, uint16 maximumOfSessions, uint32 numOfIocpConcurrentThrd, uint16 numOfIocpWorkerThrd, size_t tlsMemPoolUnitCnt, size_t tlsMemPoolUnitCapacity, uint32 memPoolBuffAllocSize, uint32 sessionRecvBuffSize, bool calcTpsThread)
 
bool Start ()
 
void Stop ()
 
void PrintServerInfoOnConsole ()
 
- jnet::JNetCore(으)로부터 상속된 Public 멤버 함수
 JNetCore (uint16 maximumOfSessions, uint32 numOfIocpConcurrentThrd, uint16 numOfIocpWorkerThrd, size_t tlsMemPoolUnitCnt, size_t tlsMemPoolUnitCapacity, uint32 memPoolBuffAllocSize, uint32 sessionRecvBuffSize, bool calcTpsThread)
 
 ~JNetCore ()
 
bool Start ()
 
void Stop ()
 
uint16 GetCurrentSessions ()
 
int64 GetCurrentAllocatedMemUnitCnt ()
 
int GetSessionCount ()
 
UINT GetAcceptTPS ()
 
UINT GetRecvTPS ()
 
UINT GetSendTPS ()
 
UINT64 GetTotalAcceptTransaction ()
 
UINT64 GetTotalRecvTransaction ()
 
UINT64 GetTotalSendTransaction ()
 
void IncrementRecvTransactions (bool threadSafe, UINT incre)
 
void IncrementSendTransactions (bool threadSafe, UINT incre)
 
void IncrementAcceptTransactions (bool threadSafe=false, UINT incre=1)
 

Protected 멤버 함수

JNetDBConnHoldDBConnection ()
 
void FreeDBConnection (JNetDBConn *dbConn, bool isDisconnected=false, bool tryToConnect=false)
 
bool BindParameter (JNetDBConn *dbConn, INT32 paramIndex, bool *value)
 
bool BindParameter (JNetDBConn *dbConn, INT32 paramIndex, float *value)
 
bool BindParameter (JNetDBConn *dbConn, INT32 paramIndex, double *value)
 
bool BindParameter (JNetDBConn *dbConn, INT32 paramIndex, INT8 *value)
 
bool BindParameter (JNetDBConn *dbConn, INT32 paramIndex, INT16 *value)
 
bool BindParameter (JNetDBConn *dbConn, INT32 paramIndex, INT32 *value)
 
bool BindParameter (JNetDBConn *dbConn, INT32 paramIndex, INT64 *value)
 
bool BindParameter (JNetDBConn *dbConn, INT32 paramIndex, TIMESTAMP_STRUCT *value)
 
bool BindParameter (JNetDBConn *dbConn, INT32 paramIndex, const WCHAR *str)
 
bool BindParameter (JNetDBConn *dbConn, INT32 paramIndex, const BYTE *bin, INT32 size)
 
bool BindColumn (JNetDBConn *dbConn, INT32 columnIndex, bool *value)
 
bool BindColumn (JNetDBConn *dbConn, INT32 columnIndex, float *value)
 
bool BindColumn (JNetDBConn *dbConn, INT32 columnIndex, double *value)
 
bool BindColumn (JNetDBConn *dbConn, INT32 columnIndex, INT8 *value)
 
bool BindColumn (JNetDBConn *dbConn, INT32 columnIndex, INT16 *value)
 
bool BindColumn (JNetDBConn *dbConn, INT32 columnIndex, INT32 *value)
 
bool BindColumn (JNetDBConn *dbConn, INT32 columnIndex, INT64 *value)
 
bool BindColumn (JNetDBConn *dbConn, INT32 columnIndex, TIMESTAMP_STRUCT *value)
 
bool BindColumn (JNetDBConn *dbConn, INT32 columnIndex, WCHAR *str, INT32 size, SQLLEN *index)
 
bool BindColumn (JNetDBConn *dbConn, INT32 columnIndex, BYTE *bin, INT32 size, SQLLEN *index)
 
bool BindParameter (JNetDBConn *dbConn, SQLPOINTER dataPtr, SQLUSMALLINT paramIndex, SQLULEN len, SQLSMALLINT cType, SQLSMALLINT sqlType)
 
bool BindColumn (JNetDBConn *dbConn, SQLPOINTER outValue, SQLUSMALLINT columnIndex, SQLULEN len, SQLSMALLINT cType)
 
void UnBind (JNetDBConn *dbConn)
 
bool ExecQuery (JNetDBConn *dbConn, const wchar_t *query)
 
bool FetchQuery (JNetDBConn *dbConn)
 
INT32 GetRowCount (JNetDBConn *dbConn)
 
- jnet::JNetServer(으)로부터 상속된 Protected 멤버 함수
virtual void OnPrintLogOnConsole ()
 
bool SendPacket (SessionID64 sessionID, JBuffer *sendPktPtr, bool postToWorker=false, bool encoded=false)
 JNetCore 요청 함수 + 송신 패킷 인코딩 기능
 
bool SendPacketBlocking (SessionID64 sessionID, JBuffer *sendPktPtr, bool encoded=false)
 
bool BufferSendPacket (SessionID64 sessionID, JBuffer *sendPktPtr, bool encoded=false)
 
JBuffer * AllocSerialSendBuff (uint16 len, bool LAN=false)
 직렬화 패킷 버퍼 할당 + 헤더 초기화
 
virtual bool OnConnectionRequest (const SOCKADDR_IN &clientSockAddr)
 Accept 반환 시 호출되는 이벤트 함수, 클라이언트 수용 여부를 반환을 통해 결정
 
virtual void OnClientJoin (SessionID64 sessionID, const SOCKADDR_IN &clientSockAddr)=0
 클라이언트 연결 수용 후 정상적으로 세션을 생성한 이 후 호출되는 이벤트 함수
 
virtual void OnClientLeave (SessionID64 sessionID)=0
 클라이언트와의 연결 종료 및 클라이언트 세션 제거 후 호출되는 이벤트 함수
 
virtual void OnRecv (SessionID64 sessionID, JBuffer &recvBuff)
 패킷 수신 시 호출되는 이벤트 함수
 
virtual void OnRecv (SessionID64 sessionID, JSerialBuffer &recvSerialBuff)
 패킷 수신 시 호출되는 이벤트 함수, 수신 버퍼링 모드의 서버 전용
 
- jnet::JNetCore(으)로부터 상속된 Protected 멤버 함수
void PrintLibraryInfoOnConsole ()
 
JNetSessionCreateNewSession (SOCKET sock)
 하위 클래스에서 세션 객체 생성 요청을 위해 호출하는 함수
 
bool RegistSessionToIOCP (JNetSession *session)
 하위 클래스에서 세션 객체를 IOCP 등록을 위해 호출하는 함수
 
bool DeleteSession (SessionID64 sessionID)
 세션 제거 요청 함수
 
void Disconnect (SessionID64 sessionID)
 
bool SendPacket (SessionID64 sessionID, JBuffer *sendPktPtr, bool postToWorker=false)
 패킷 송신 요청 함수
 
bool SendPacketBlocking (SessionID64 sessionID, JBuffer *sendPktPtr)
 동기식 송신 요청 함수
 
bool BufferSendPacket (SessionID64 sessionID, JBuffer *sendPktPtr)
 세션 송신 버퍼 큐에 버퍼링(삽입만 진행)
 
bool SendBufferedPacket (SessionID64 sessionID, bool postToWorker=false)
 세션 송신 버퍼 큐 내 송신 패킷 직렬화 버퍼에 대한 일괄 송신 작업 수행
 
DWORD AllocTlsMemPool ()
 직렬화 패킷 버퍼 Tls 풀 할당 함수
 
JBuffer * AllocSerialBuff ()
 직렬화 패킷 버퍼 할당 요청 wrapper
 
void FreeSerialBuff (JBuffer *buff)
 직렬화 패킷 버퍼 반환 wrapper
 
void AddRefSerialBuff (JBuffer *buff)
 직렬화 패킷 버퍼 참조 카운트 증가 wrapper
 
virtual bool OnWorkerThreadCreate (HANDLE thHnd)
 Start() 함수 내 IOCP 작업자 스레드 생성(CREATE_SUSPENDED) 후 호출되는 이벤트 함수
 
virtual void OnAllWorkerThreadCreate ()
 Start() 함수 내 요청된 수 만큼 IOCP 작업자 스레드를 생성한 후 함수를 빠져나오기 전 호출되는 이벤트 함수
 
virtual void OnWorkerThreadStart ()
 개별 IOCP 작업자 스레드의 수행 흐름 초입부(WorkerThreadFunc 함수 초입부)에 호출되는 이벤트 함수, 개별 작업자 스레드의 초기화를 독립적으로 수행하도록 재정의 가능
 
virtual void OnWorkerThreadEnd ()
 개별 IOCP 작업자 스레드가 종료(작업자 함수 return) 전 호출되는 이벤트 함수
 
virtual void OnError ()
 

Private 속성

int32 m_DBConnCnt
 DB Connection Count
 
const WCHAR * m_OdbcConnStr
 ODBC Connection String
 
JNetDBConnPoolm_DBConnPool
 DB Connection Pool
 
bool m_DBConnFlag
 

추가로 상속된 멤버들

- jnet::JNetServer(으)로부터 상속된 Protected 속성
BYTE m_PacketCode_LAN
 LAN 구간 패킷 코드
 
BYTE m_PacketCode
 LAN 외부 통신 패킷 코드
 
BYTE m_PacketSymmetricKey
 대칭-키
 
- jnet::JNetCore(으)로부터 상속된 Protected 속성
bool m_CalcTpsFlag
 

상세한 설명

DB 커넥션 기능을 수행하는 DB 커넥션 객체 풀을 관리하여 커넥션(HoldConnection)과 SQL 쿼리 및 응답 처리(ExecQuery, FetchQuery) 추상화 제공

생성자 & 소멸자 문서화

◆ JNetOdbcServer()

jnet::JNetOdbcServer::JNetOdbcServer ( int32 dbConnCnt,
const WCHAR * odbcConnStr,
const char * serverIP,
uint16 serverPort,
uint16 maximumOfConnections,
PACKET_CODE packetCode_LAN,
PACKET_CODE packetCode,
PACKET_SYMM_KEY packetSymmetricKey,
bool recvBufferingMode,
uint16 maximumOfSessions,
uint32 numOfIocpConcurrentThrd,
uint16 numOfIocpWorkerThrd,
size_t tlsMemPoolUnitCnt,
size_t tlsMemPoolUnitCapacity,
uint32 memPoolBuffAllocSize,
uint32 sessionRecvBuffSize,
bool calcTpsThread )
inline
526 : JNetServer(serverIP, serverPort, maximumOfConnections,
527 packetCode_LAN, packetCode, packetSymmetricKey,
528 recvBufferingMode,
529 maximumOfSessions,
530 numOfIocpConcurrentThrd, numOfIocpWorkerThrd,
531 tlsMemPoolUnitCnt, tlsMemPoolUnitCapacity,
532 memPoolBuffAllocSize,
533 sessionRecvBuffSize,
534 calcTpsThread
535 ),
536 m_DBConnCnt(dbConnCnt), m_OdbcConnStr(odbcConnStr), m_DBConnFlag(false)
537 {}
const WCHAR * m_OdbcConnStr
ODBC Connection String
Definition JNetCore.h:510
bool m_DBConnFlag
Definition JNetCore.h:512
int32 m_DBConnCnt
DB Connection Count
Definition JNetCore.h:509
JNetServer(const char *serverIP, uint16 serverPort, uint16 maximumOfConnections, PACKET_CODE packetCode_LAN, PACKET_CODE packetCode, PACKET_SYMM_KEY packetSymmetricKey, bool recvBufferingMode, uint16 maximumOfSessions, uint32 numOfIocpConcurrentThrd, uint16 numOfIocpWorkerThrd, size_t tlsMemPoolUnitCnt, size_t tlsMemPoolUnitCapacity, uint32 memPoolBuffAllocSize, uint32 sessionRecvBuffSize, bool calcTpsThread)
Definition JNetServer.cpp:5

멤버 함수 문서화

◆ Start()

bool JNetOdbcServer::Start ( )
5 {
7
9 std::cout << "JNetOdbcServer::m_DBConnPool->Connect(..) Fail!" << std::endl;
10 return false;
11 }
12
13 std::cout << "JNetOdbcServer::m_DBConnPool->Connect(..) Success!" << std::endl;
14 m_DBConnFlag = true;
15
16 if (!JNetServer::Start()) {
17 return false;
18 }
19
20 return true;
21}
DB 커넥션 인스턴스 Pool
Definition JNetDB.h:109
bool Connect(INT32 connectionCount, const WCHAR *connectionString)
Definition JNetDB.cpp:460
JNetDBConnPool * m_DBConnPool
DB Connection Pool
Definition JNetCore.h:511
bool Start()
Definition JNetServer.cpp:36

◆ Stop()

void JNetOdbcServer::Stop ( )
22 {
23 if (m_DBConnPool != NULL) {
25 }
26
27 if (m_DBConnFlag) {
29 }
30}
void Clear()
Definition JNetDB.cpp:487
void Stop()
Definition JNetServer.cpp:74

◆ HoldDBConnection()

JNetDBConn * jnet::JNetOdbcServer::HoldDBConnection ( )
inlineprotected
543{ return m_DBConnPool->Pop(); }
JNetDBConn * Pop()
Definition JNetDB.cpp:510

◆ FreeDBConnection()

void jnet::JNetOdbcServer::FreeDBConnection ( JNetDBConn * dbConn,
bool isDisconnected = false,
bool tryToConnect = false )
inlineprotected
544 {
545 m_DBConnPool->Push(dbConn, isDisconnected, tryToConnect, m_OdbcConnStr);
546 }
void Push(JNetDBConn *connection, bool isDisconnected=false, bool tryToConnect=false, const WCHAR *connectionString=NULL)
Definition JNetDB.cpp:525

◆ BindParameter() [1/11]

bool JNetOdbcServer::BindParameter ( JNetDBConn * dbConn,
INT32 paramIndex,
bool * value )
protected
32 {
33 if (!dbConn->BindParam(paramIndex, value)) {
34 dbConn->Unbind();
35 return false;
36 }
37 return true;
38}
bool BindParam(INT32 paramIndex, bool *value)
Definition JNetDB.cpp:169
void Unbind()
Definition JNetDB.cpp:285

◆ BindParameter() [2/11]

bool JNetOdbcServer::BindParameter ( JNetDBConn * dbConn,
INT32 paramIndex,
float * value )
protected
39 {
40 if (!dbConn->BindParam(paramIndex, value)) {
41 dbConn->Unbind();
42 return false;
43 }
44 return true;
45}

◆ BindParameter() [3/11]

bool JNetOdbcServer::BindParameter ( JNetDBConn * dbConn,
INT32 paramIndex,
double * value )
protected
46 {
47 if (!dbConn->BindParam(paramIndex, value)) {
48 dbConn->Unbind();
49 return false;
50 }
51 return true;
52}

◆ BindParameter() [4/11]

bool JNetOdbcServer::BindParameter ( JNetDBConn * dbConn,
INT32 paramIndex,
INT8 * value )
protected
53 {
54 if (!dbConn->BindParam(paramIndex, value)) {
55 dbConn->Unbind();
56 return false;
57 }
58 return true;
59}

◆ BindParameter() [5/11]

bool JNetOdbcServer::BindParameter ( JNetDBConn * dbConn,
INT32 paramIndex,
INT16 * value )
protected
60 {
61 if (!dbConn->BindParam(paramIndex, value)) {
62 dbConn->Unbind();
63 return false;
64 }
65 return true;
66}

◆ BindParameter() [6/11]

bool JNetOdbcServer::BindParameter ( JNetDBConn * dbConn,
INT32 paramIndex,
INT32 * value )
protected
67 {
68 if (!dbConn->BindParam(paramIndex, value)) {
69 dbConn->Unbind();
70 return false;
71 }
72 return true;
73}

◆ BindParameter() [7/11]

bool JNetOdbcServer::BindParameter ( JNetDBConn * dbConn,
INT32 paramIndex,
INT64 * value )
protected
74 {
75 if (!dbConn->BindParam(paramIndex, value)) {
76 dbConn->Unbind();
77 return false;
78 }
79 return true;
80}

◆ BindParameter() [8/11]

bool JNetOdbcServer::BindParameter ( JNetDBConn * dbConn,
INT32 paramIndex,
TIMESTAMP_STRUCT * value )
protected
81 {
82 if (!dbConn->BindParam(paramIndex, value)) {
83 dbConn->Unbind();
84 return false;
85 }
86 return true;
87}

◆ BindParameter() [9/11]

bool JNetOdbcServer::BindParameter ( JNetDBConn * dbConn,
INT32 paramIndex,
const WCHAR * str )
protected
88 {
89 if (!dbConn->BindParam(paramIndex, str)) {
90 dbConn->Unbind();
91 return false;
92 }
93 return true;
94}

◆ BindParameter() [10/11]

bool JNetOdbcServer::BindParameter ( JNetDBConn * dbConn,
INT32 paramIndex,
const BYTE * bin,
INT32 size )
protected
95 {
96 if (!dbConn->BindParam(paramIndex, bin, size)) {
97 dbConn->Unbind();
98 return false;
99 }
100 return true;
101}

◆ BindColumn() [1/11]

bool JNetOdbcServer::BindColumn ( JNetDBConn * dbConn,
INT32 columnIndex,
bool * value )
protected
102 {
103 if (!dbConn->BindCol(columnIndex, value)) {
104 dbConn->Unbind();
105 return false;
106 }
107 return true;
108}
bool BindCol(INT32 columnIndex, bool *value)
Definition JNetDB.cpp:227

◆ BindColumn() [2/11]

bool JNetOdbcServer::BindColumn ( JNetDBConn * dbConn,
INT32 columnIndex,
float * value )
protected
109 {
110 if (!dbConn->BindCol(columnIndex, value)) {
111 dbConn->Unbind();
112 return false;
113 }
114 return true;
115}

◆ BindColumn() [3/11]

bool JNetOdbcServer::BindColumn ( JNetDBConn * dbConn,
INT32 columnIndex,
double * value )
protected
116 {
117 if (!dbConn->BindCol(columnIndex, value)) {
118 dbConn->Unbind();
119 return false;
120 }
121 return true;
122}

◆ BindColumn() [4/11]

bool JNetOdbcServer::BindColumn ( JNetDBConn * dbConn,
INT32 columnIndex,
INT8 * value )
protected
123 {
124 if (!dbConn->BindCol(columnIndex, value)) {
125 dbConn->Unbind();
126 return false;
127 }
128 return true;
129}

◆ BindColumn() [5/11]

bool JNetOdbcServer::BindColumn ( JNetDBConn * dbConn,
INT32 columnIndex,
INT16 * value )
protected
130 {
131 if (!dbConn->BindCol(columnIndex, value)) {
132 dbConn->Unbind();
133 return false;
134 }
135 return true;
136}

◆ BindColumn() [6/11]

bool JNetOdbcServer::BindColumn ( JNetDBConn * dbConn,
INT32 columnIndex,
INT32 * value )
protected
137 {
138 if (!dbConn->BindCol(columnIndex, value)) {
139 dbConn->Unbind();
140 return false;
141 }
142 return true;
143}

◆ BindColumn() [7/11]

bool JNetOdbcServer::BindColumn ( JNetDBConn * dbConn,
INT32 columnIndex,
INT64 * value )
protected
144 {
145 if (!dbConn->BindCol(columnIndex, value)) {
146 dbConn->Unbind();
147 return false;
148 }
149 return true;
150}

◆ BindColumn() [8/11]

bool JNetOdbcServer::BindColumn ( JNetDBConn * dbConn,
INT32 columnIndex,
TIMESTAMP_STRUCT * value )
protected
151 {
152 if (!dbConn->BindCol(columnIndex, value)) {
153 dbConn->Unbind();
154 return false;
155 }
156 return true;
157}

◆ BindColumn() [9/11]

bool JNetOdbcServer::BindColumn ( JNetDBConn * dbConn,
INT32 columnIndex,
WCHAR * str,
INT32 size,
SQLLEN * index )
protected
158 {
159 if (!dbConn->BindCol(columnIndex, str, size, index)) {
160 dbConn->Unbind();
161 return false;
162 }
163 return true;
164}

◆ BindColumn() [10/11]

bool JNetOdbcServer::BindColumn ( JNetDBConn * dbConn,
INT32 columnIndex,
BYTE * bin,
INT32 size,
SQLLEN * index )
protected
165 {
166 if (!dbConn->BindCol(columnIndex, bin, size, index)) {
167 dbConn->Unbind();
168 return false;
169 }
170 return true;
171}

◆ BindParameter() [11/11]

bool JNetOdbcServer::BindParameter ( JNetDBConn * dbConn,
SQLPOINTER dataPtr,
SQLUSMALLINT paramIndex,
SQLULEN len,
SQLSMALLINT cType,
SQLSMALLINT sqlType )
protected
173 {
174 SQLLEN index = 0;
175 if (!dbConn->BindParam(paramIndex, cType, sqlType, len, dataPtr, &index)) {
176 dbConn->Unbind();
177 return false;
178 }
179 return true;
180}

◆ BindColumn() [11/11]

bool JNetOdbcServer::BindColumn ( JNetDBConn * dbConn,
SQLPOINTER outValue,
SQLUSMALLINT columnIndex,
SQLULEN len,
SQLSMALLINT cType )
protected
181 {
182 SQLLEN index = 0;
183 if (!dbConn->BindCol(columnIndex, cType, len, outValue, &index)) {
184 dbConn->Unbind();
185 return false;
186 }
187 return true;
188}

◆ UnBind()

void JNetOdbcServer::UnBind ( JNetDBConn * dbConn)
protected
191{
192 if (dbConn != nullptr) {
193 dbConn->Unbind();
194 }
195}

◆ ExecQuery()

bool JNetOdbcServer::ExecQuery ( JNetDBConn * dbConn,
const wchar_t * query )
protected
197 {
198 bool ret = false;
199 if (dbConn->Execute(query)) {
200 ret = true;
201 }
202 return ret;
203}
bool Execute(const WCHAR *query)
Definition JNetDB.cpp:94

◆ FetchQuery()

bool JNetOdbcServer::FetchQuery ( JNetDBConn * dbConn)
protected
205 {
206 if (dbConn == NULL) {
207 return false;
208 }
209
210 dbConn->Fetch();
211 return true;
212}
bool Fetch()
Definition JNetDB.cpp:115

◆ GetRowCount()

INT32 JNetOdbcServer::GetRowCount ( JNetDBConn * dbConn)
protected
215{
216 return dbConn->GetRowCount();
217}
INT32 GetRowCount()
Definition JNetDB.cpp:158

멤버 데이터 문서화

◆ m_DBConnCnt

int32 jnet::JNetOdbcServer::m_DBConnCnt
private

DB Connection Count

◆ m_OdbcConnStr

const WCHAR* jnet::JNetOdbcServer::m_OdbcConnStr
private

ODBC Connection String

◆ m_DBConnPool

JNetDBConnPool* jnet::JNetOdbcServer::m_DBConnPool
private

DB Connection Pool

◆ m_DBConnFlag

bool jnet::JNetOdbcServer::m_DBConnFlag
private

이 클래스에 대한 문서화 페이지는 다음의 파일들로부터 생성되었습니다.: