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.

insertValue(Object javaObj, int <strong>JDBC</strong>type, int index)The insertValue(Object javaObj, int <strong>JDBC</strong>type, int index) inserts the valuecontained in javaObj of type <strong>JDBC</strong>Type into the collection at location index.The value is always inserted at the position given. If the index is beyond thesize of the collection, null elements will be inserted to fill in the “holes”. Ifthere is a value in the index position, all values from the current index positionwill be shifted right one position to make room for the new value. The size ofthe collection will increase by one or more elements.removeNulls()The removeNulls() method will delete null elements from the collection. Thisincludes values that are null as well as object references that point to deletedreferences. The size of the collection may decrease.The following example shows the use of these methods and can found in the%ORDB%\demo\jdbc\samples\collectionSample4.java file:package demo.jdbc.samples;import java.sql.*;import java.math.*;import java.io.*;import ordbjava.jdbc.*;import java.util.HashMap;//import for custom mappingclass collectionSample4{public static void main (String args []) throws SQLException{// Connect to the demodb database without autocommit enabled.Connection conn = demodbHelper.makeConnection (false);// Create a new collection leaving some "holes"ordbCollection newActivities = new ordbCollection(conn);String activity = "Activity 1";newActivities.insertValue(activity,Types.VARCHAR,1);activity = "Activity 3";newActivities.insertValue(activity,Types.VARCHAR,3);activity = "Activity 5";newActivities.insertValue(activity,Types.VARCHAR,5);<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 70Chapter: 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!