Simple named row example
To use ClassGenerator, you first create
the named row on the database server as shown in this example:
create row type employee (name char (20), age int);
Next,
run ClassGenerator:
java ClassGenerator employee
The
class generator generates employee.java, as shown
next, and retrieves the database URL information from setup.std,
which has the following contents:
URL jdbc:davinci:1528
database test
user scott
passwd tiger
informixserver picasso_ius
Following is the generated .java file:
import java.sql.*;
import java.math.*;
public class employee implements SQLData
{
public String name;
public int age;
private String sql_type;
public String getSQLTypeName() { return "employee"; }
public void readSQL (SQLInput stream, String type) throws
SQLException
{
sql_type = type;
name = stream.readString();
age = stream.readInt();
}
public void writeSQL (SQLOutput stream) throws SQLException
{
stream.writeString(name);
stream.writeInt(age);
}
}