This example demonstrates UltraLiteJ support for processing rows in an alternate order.
package ianywhere.ultralitej.demo; import ianywhere.ultralitej.*; public class SortTransactions { /** Mainline. * @param args program arguments (not used) */ public static void main( String[] args ) { try { Configuration config = DatabaseManager.createConfigurationFile( "Sales.ulj" ); Connection conn = DatabaseManager.connect( config ); PreparedStatement stmt = conn.prepareStatement( "SELECT inv_no, prod_no, quantity FROM InvoiceItem" + " ORDER BY prod_no" ); ResultSet cursor = stmt.executeQuery(); for( ; cursor.next(); ) { /* Can't access columns by name because no meta data */ int inv_no = cursor.getInt( 1 /* "inv_no" */ ); int prod_no = cursor.getInt( 2 /* "prod_no" */ ); int quantity = cursor.getInt( 3 /* "quantity" */ ); Demo.display( Integer.toString( prod_no ) + ' ' + Integer.toString( inv_no ) + ' ' + Integer.toString( quantity ) ); } conn.release(); Demo.display( "SortTransactions completed successfully" ); } catch( ULjException exc ) { Demo.displayException( exc ); } } } |
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |