Problem

How to read data with ViewReader


Solution

The class ViewReader (only server side) opens a read-only cursor on a view. This mode is faster and requires less resources than the use of classes Table or View. The following code shows how to use it:

// Open viewreader object
dataweb.datastore.ViewReader vreader=dbSession.openViewReader("<Package>.<View>");

// Read data
while (vreader.next())
   val1 = vreader.getValue("<Column Name>");
   ....
   ....
   valn = vreader.getValue("<Column Name>");
}

// Close viewreader object
vreader.close();

Published in Fri, 10 December 2010 16:16