...
이건 전처리를 통과하지 않아도 되는 순수 C 로 된 라이브러리였고 막강한 기능을 제공했었다. 다만 한 가지 큰 문제는 API 가 너무 어렵고 난잡했다.
Oracle 에 연결하기 위해 OCI 관련 변수와 환경을 초기화하면 코드만 해도 다음과 같이 엄청난 양을 코딩해야 했다.
Expand |
---|
|
Code Block |
---|
OCIEnv *envhp; // OCI environment handle
OCIServer *srvhp; // OCI Server handle
OCIError *errhp; // OCI Error handle
OCISvcCtx *svchp; // OCI Service context handle
OCISession *authp; // OCI Session handle
static int initialize(const int threaded_mode=0)
{
int status;
int mode;
if(threaded_mode)
mode=OCI_THREADED;
else
mode=OCI_DEFAULT;
status=OCIInitialize
(static_cast<ub4>(mode),
reinterpret_cast<dvoid *>(0),
0,
0,
0
);
if(status!=OCI_SUCCESS)
return 0;
else
return 1;
} |
|
SQL 구문의 placeholder와 프로그램내 변수를 매핑시키는 OCIBindByName 같은 함수는 다음과 같은 엄청난 매개 변수를 넘겨주고 호출해야 했다.
Expand |
---|
title | OCIBindByName interface |
---|
|
Code Block |
---|
sword OCIBindByName ( OCIStmt *stmtp,
OCIBind **bindpp,
OCIError *errhp,
CONST text *placeholder,
sb4 placeh_len,
dvoid *valuep,
sb4 value_sz,
ub2 dty,
dvoid *indp,
ub2 *alenp,
ub2 *rcodep,
ub4 maxarr_len,
ub4 *curelep,
ub4 mode ); |
|
Ref
...