?? dbcom.pc
字號:
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <strings.h>#include <math.h>#include <pthread.h>#include "sqlca.h"#include "sqlda.h"#include "dbcom.h"#include "dbfunc.h"#define MODULE_NAME "DBCOM"thrd_conn_t a_thrd_conn[10];int DbsEnableThread(){ EXEC SQL ENABLE THREADS; return(sqlca.sqlcode);}int DbsConnectThread(int thrd_index, char *connect){ SQL_THREAD_SAFE_PREPARE; char buf[100], *p_str, *p_cur, dbuser[10], password[10]; if(connect==NULL) return -1; strcpy(buf, connect); p_str=strtok_r(buf, "/", &p_cur); if(p_str==NULL) return -1; strcpy(dbuser, p_str); p_str=strtok_r(NULL, "/", &p_cur); if(p_str==NULL) return -1; strcpy(password, p_str); EXEC SQL context allocate :a_thrd_conn[thrd_index].context; EXEC SQL context use :a_thrd_conn[thrd_index].context; EXEC SQL connect :dbuser identified by :password; SQL_CODE_PROCESS("SYS", "CON");}int DbsDisconnThread(int thrd_index){ SQL_THREAD_SAFE_PREPARE; EXEC SQL context use :a_thrd_conn[thrd_index].context; EXEC SQL commit work release; EXEC SQL context free :a_thrd_conn[thrd_index].context; SQL_CODE_PROCESS("SYS", "CON");}int DbsCommit(int thrd_index){ SQL_THREAD_SAFE_PREPARE; EXEC SQL commit; SQL_CODE_PROCESS("SYS", "COM");}int DbsRollback(int thrd_index){ SQL_THREAD_SAFE_PREPARE; EXEC SQL rollback; SQL_CODE_PROCESS("SYS", "ROL");}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -