답변 감사합니다.
하지만 반영된 레코드 수를 가져오는 것이 문제가 아니고 레코드 수가 이상하다는 것 입니다.
첨부한 코드를 실행한 후의 Request Block 은 아래의 설명 처럼 정상적으로 가져오는 것 같습니다.
Result buffer for DELETE statement contains:
23, 29,0, (isc_info_sql_records, length=29)
15, 4,0, 0,0,0,0, (isc_info_req_update_count, 0 rows updated)
16, 4,0, 4,0,0,0, (isc_info_req_delete_count, 4 rows deleted)
13, 4,0, 4,0,0,0, (isc_info_req_select_count, 4 rows selected)
14, 4,0, 0,0,0,0, (isc_info_req_insert_count)
1, (isc_info_end)
Result buffer for UPDATE statement contains:
23, 29,0,
15, 4,0, 4,0,0,0,
16, 4,0, 0,0,0,0,
13, 4,0, 4,0,0,0,
14, 4,0, 0,0,0,0,
1,
Result buffer for INSERT statement contains:
23, 29,0,
15, 4,0, 0,0,0,0,
16, 4,0, 0,0,0,0,
13, 4,0, 0,0,0,0,
14, 4,0, 1,0,0,0,
1,
하지만 update 수는 계속 적으로 증가는 한다는 것 입니다.
테이블을 하나 만들고 임시데이터를 쓴 후 update 를 실행(2개의 record 에 반영되도록)하고 해당 테이블을 삭제(Drop Table)하는 루틴으로 되어 있는데 데이터베이스를 처음 만들고 이 루틴을 실행하면 update 레코드 수는 2가 나오는데 다시 실행하면 4가 되고 반복적으로 실행하면 6,8,10 이렇게 증가 한다는 것입니다.
멀고도험한길 님이 쓰신 글 :
: 안명호.ASURADA 님이 쓰신 글 :
: : 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 );
: : }
: :
:
: select 는 안되는걸로 알고있습니다..
:
: upd_count = isc_vax_integer(pCur[6], 4);
: del_count = isc_vax_integerpCur[13], 4);
: ins_count = isc_vax_integer(pCur[27], 4);
: 이렇게 해보세요.. 무슨뜻인지 아시죠? ^^