eva/3 Application BuilderDeveloping Additional eva/3 ComponentsUser CommandsExamples for Tasks of an CommandExamples for database commands 

Read from Tables

The classes ObjectLoader, TableDescriptor and HSRecordSet allow to access tables.

Example:

try{    
    // Get the TableDescriptor of the table adress
    TableDescriptor tDescriptor = (TableDescriptor)ObjectLoader.getTableDescriptor("adress"); 
    // Get the ColumnDescriptors of the columns oin the table
    ColumnDescriptor [] adressDescriptor = tDescriptor.getColumnDescriptors(); 
    // Loop to print out the names of the tables
    for(int i = 0; i < adressDescriptor.length; i++){ 
        System.out.println(adressDescriptor[i].getName());
    }   
    // The data of the table will be writen in the HSRecordSet     
    HSRecordSet rs = new HSRecordSet(tDescriptor);
    rs.next();    
    // The first Object in the second row will be read and printed out
    System.out.println(rs.getObject(2));
    // The HSRecordSet will be closed
    rs.dispose(); 
} catch (Exception e) {    
    e.printStackTrace();
}

The methods

QueryDescriptor getQueryDescriptor(String name)

and

ViewDescriptor getViewDescriptor(String name)

of the ObjectLoader class can be used to access database querys or database views.