C API 의 isc_dsql_sql_info 와 isc_info_sql_records 를 이용하여 Update 구문을 실행한 뒤 반영된 레코드 수를 얻어오고 있는데 update 된 레코드 수가 계속 증가를 합니다.
데이터베이스를 detach 후 다시 attach 시켜도 초기화 되지 않고 계속 증가만 하네요.
바로 직전의 질의문에 의해서 반영된 레코드 수 만을 얻어 오려면 특별한 방법이 있는 건가요?
아래는 반영된 레코드 수를 얻어오기 위해 작성한 코드 입니다.
int del_count = 0, ins_count = 0, upd_count = 0, sel_count = 0;
static char const info_count[] = { isc_info_sql_records };
char result[64];
int ret = 0;
isc_dsql_sql_info( status, &stmt, sizeof(info_count), info_count, sizeof(result), result );
char* pCur = result;
int length;
if ( *pCur == isc_info_sql_records )
{
pCur++;
length = isc_vax_integer(pCur, 2); /* normally 29 bytes */
pCur += 2;
while(*pCur != 1)
{
switch(*pCur)
{
case isc_info_req_select_count:
pCur++;
length = isc_vax_integer(pCur, 2);
pCur += 2;
sel_count = isc_vax_integer(pCur, length);
pCur += length;
break;
case isc_info_req_insert_count:
pCur++;
length = isc_vax_integer(pCur, 2);
pCur += 2;
ins_count = isc_vax_integer(pCur, length);
pCur += length;
break;
case isc_info_req_update_count:
pCur++;
length = isc_vax_integer(pCur, 2);
pCur += 2;
upd_count = isc_vax_integer(pCur, length);
pCur += length;
break;
case isc_info_req_delete_count:
pCur++;
length = isc_vax_integer(pCur, 2);
pCur += 2;
del_count = isc_vax_integer(pCur, length);
pCur += length;
break;
default:
pCur++;
break;
}
}
CString strMsg;
strMsg.Format( _T("%d Row(s) Updated"), upd_count );
}
|