복수 행

이 절은 Rational® Business Developer V9.0에서 복수 행 삽입 및 복수 행 페치에 대해 설명합니다.

Rational Business Developer V9.0에서는 SQL 테이블에 액세스할 때 성능을 향상시키는 새 복수 행 기능을 소개합니다. 이 새 기능을 사용하면 데이터베이스와의 상호작용 중에 필요한 만큼의 행을 페치하거나 삽입할 수 있습니다.

단일 행 페치와 복수 행 페치의 차이는 다음과 같이 설명할 수 있습니다.

단일 행 페치와 복수 행 페치 비교

Rational Business Developer V9.0은 SQL 레코드에 대한 open, get, add 및 replace 문에서 복수 행 조작을 지원합니다. 세부사항은 SQL에 대한 open 고려사항, SQL에 대한 get 고려사항, SQL에 대한 add 고려사항, SQL에 대한 delete 고려사항SQL에 대한 replace 고려사항 문을 참조하십시오.

예제

다음 샘플은 요구된 행 수를 페치하는 방법을 나타냅니다. 이 코드 섹션을 사용자 자신의 애플리케이션에 적용하십시오.

복수 행 또는 행 세트 처리는 동적 배열 변수 선언에 rowsetsize 특성을 지정하거나 open 문에 rowsetsize 특성의 사용을 지정하여 EGL SQL에서 활성화됩니다.
employees employeeRecord[0]{rowsetsize=10};  

//assume table EMPLOYEETEST contains 10,000 rows, the result 
// set for the below SQL will return 10,000 rows

// it uses rowset processing to interact with the database

Open abc with #sql{
    select eID, uName, PASSWORD, fName, lName, office, sex, EMail
    from EMPLOYEETEST
    order by eID
} for employees;

get next employees;  //this returns an 10 element array with 
                     //the first 10 rows of the result set


while ( sysvar.sqlData.sqlcode == 0 )

   // sysvar.sqlData.sqlerrd[3] will contains the number of returned rows

   for ( i int from 1 to sysvar.sqlData.sqlerrd[3] )

     // if eid is greater than 2000, stop fetching more rows.
     // This is what is meant by "demanded" 
        if ( employees[i].eID > 2000 ) 
            exit while;
        end        SysLib.writeStdout( employees[i].fName );
    end
    get next employees;  //this returns the next 10 rows and 
                         //replaces rows in array

endclose abc;
표 1. delete에 대한 호환성 고려사항
플랫폼 문제
Java™ 생성 및 디버그 get diagnostics 문은 지원되지 않습니다. 생성은 성공하지만 get diagnostics 문을 사용하면 런타임에 또는 디버거를 통해 실행될 때 sqlException이 리턴됩니다.