I have had several requests for an SDO code sample. The SDO code samples below have been published elsewhere on the CodeFutures site, but I am providing them here as well for reference purposes.
If you really want a proper SDO code sample, the best way is to do an SDO download and generate your own SDO code sample using FireStorm/DAO
SDO Code Sample for Dynamic SDO API
DataGraph graph = db.executeQuery( “select * from customer” );
DataObject root = graph.getRootObject();
// use xpath to get the name of the first customer
String firstCustName = root.getString( “customer[0]/name” );
// iterate through all customers
Iterator iter = root.getList( “customer” ).iterator();
while (iter.hasNext()) {
DataObject dataObject = (DataObject) iter.next();
String custName = dataObject.getString( “name” );
SDO Code Sample for Static SDO API
In the SDO code sample below, customer is a generated class that extends DataObject).
// iterate through all customers
Iterator iter = root.getList( “customer” ).iterator();
while (iter.hasNext()) {
Customer customer = (Customer) iter.next();
String custName = customer.getName();
PJ Murray
CodeFutures Software


0 Comments:
Post a Comment
<< Home