このセクションでは、Rational® Business Developer V9.0 における複数行の挿入と複数行のフェッチのサポートについて説明します。
Rational Business Developer V9.0 では、新しい複数行機能が導入されて SQL テーブルへのアクセス時のパフォーマンスが向上しています。この新機能によって、データベースとの 1 回の対話中に、必要に応じた数だけ行を取り出したり、挿入することができます。
単一行フェッチと複数行フェッチの違いを以下に示します。

Rational Business Developer V9.0 では、SQL レコードに対する open、get、add、および replace ステートメントでの複数行操作をサポートします。詳しくは、『SQL の open に関する考慮事項』、『SQL の get に関する考慮事項』、『SQL の add に関する考慮事項』、『SQL の delete に関する考慮事項』、および『SQL の replace に関する考慮事項』の各ステートメントを参照してください。
次の例は、必要に応じた数だけ行を取り出す方法を示しています。 このコードの任意のセクションをユーザー独自のアプリケーションに合わせてください。
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
end
close abc;
| プラットフォーム | 問題 |
|---|---|
| Java 生成およびデバッグ | get diagnostics ステートメントはサポートされていません。 生成は正常に終了しますが、get diagnostics ステートメントを使用すると、この実行時またはデバッガーによる実行時に sqlException が返されます。 |