Nested named row example
To use ClassGenerator for a nested
row, you first create the named row on the database server:
create row type manager (emp employee, salary int);
Next,
run ClassGenerator. In this case, the setup.std file
is not consulted, because you provide all the needed information at
the command line:
java ClassGenerator manager -c Manager -u "jdbc:davinci:1528/test:user=scott;
password=tiger;informixserver=picasso_ius"
The -c option defines the Java™ class you are creating, which is Manager (with uppercase M).
The preceding command generates the following Java™ class:
import java.sql.*;
import java.math.*;
public class Manager implements SQLData
{
public employee emp;
public int salary;
private String sql_type;
public String getSQLTypeName() { return "manager"; }
public void readSQL (SQLInput stream, String type) throws
SQLException
{
sql_type = type;
emp = (employee)stream.readObject();
salary = stream.readInt();
}
public void writeSQL (SQLOutput stream) throws SQLException
{
stream.writeObject(emp);
stream.writeInt(salary);
}
}