10.07.2015 Views

JDBC Developer's Guide - Supra - Cincom

JDBC Developer's Guide - Supra - Cincom

JDBC Developer's Guide - Supra - Cincom

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Retrieving a collection and its elementsWhen you retrieve a collection, you get an ordbjava.jdbc.ordbCollection objectwhere each returned array element is a materialized Java array object or aresult set object.Once you have the collection in an ordbCollection object, you can retrieve thedata using one of the overloaded methods of the java.sql.ARRAY interface:♦♦getArray() - The getArray() methods retrieve the elements of the collection(or a subset of the collection) into a java array. The elements areconverted to the Java types corresponding to the SQL type of the data inthe collection.getResultSet() - The getResultSet() methods return a result set thatcontains elements of the collection (or a subset of the collection)designated by the ARRAY object. The result set contains one row for eachcollection element, with two columns in each row. The first column storesthe index into the database collection for that element, and the secondcolumn contains the element value.Retrieving all of an array’s elementsIf you use getArray() to retrieve an array of primitive datatypes, then ajava.lang.Object that contains the element values is returned. The elements ofthis array are of the Java type corresponding to the SQL type of the elements.For example,BigDecimal[] values=(BigDecimal[]) intArray.getArray();where intArray is an ordbjava.jdbc.ordbCollection corresponding to adatabase collection of type NUMERIC.Similarly, if you use getResultSet() to return an array of primitive datatypes,then the <strong>JDBC</strong> drivers return a ResultSet object that contains, for eachelement, the index into the array for the element and the element value. Forexample:ResultSet rset= intArray.getResultSet();In this case, the result set contains one row for each array element, with twocolumns in each row. The first column stores the index into the array; thesecond column stores the BigDecimal element value.<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 62Chapter: 4. <strong>Cincom</strong> ORDB ExtensionsSection: Working with <strong>Cincom</strong> ORDB collections

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!