FileDocCategorySizeDatePackage
PersonTypRef.javaAPI DocExample1307Fri Feb 23 14:16:22 GMT 2001None

PersonTypRef.java

import java.sql.SQLException;
import oracle.jdbc.driver.OracleConnection;
import oracle.jdbc.driver.OracleTypes;
import oracle.sql.CustomDatum;
import oracle.sql.CustomDatumFactory;
import oracle.sql.Datum;
import oracle.sql.REF;
import oracle.sql.STRUCT;

public class PersonTypRef implements CustomDatum, CustomDatumFactory
{
  public static final String _SQL_BASETYPE = "SCOTT.PERSON_TYP";
  public static final int _SQL_TYPECODE = OracleTypes.REF;

  REF _ref;

  static final PersonTypRef _PersonTypRefFactory = new PersonTypRef();
  public static CustomDatumFactory getFactory()
  {
    return _PersonTypRefFactory;
  }

  /* constructor */
  public PersonTypRef()
  {
  }

  /* CustomDatum interface */
  public Datum toDatum(OracleConnection c) throws SQLException
  {
    return _ref;
  }

  /* CustomDatumFactory interface */
  public CustomDatum create(Datum d, int sqlType) throws SQLException
  {
    if (d == null) return null;
    PersonTypRef r = new PersonTypRef();
    r._ref = (REF) d;
    return r;
  }
  public PersonTyp getValue() throws SQLException
  {
     return (PersonTyp) PersonTyp.getFactory().create(
       _ref.getSTRUCT(), OracleTypes.REF);
  }

  public void setValue(PersonTyp c) throws SQLException
  {
    _ref.setValue((STRUCT) c.toDatum(_ref.getConnection()));
  }
}