FileDocCategorySizeDatePackage
LocationTypRef.javaAPI DocExample1333Fri Feb 23 14:16:22 GMT 2001None

LocationTypRef.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 LocationTypRef implements CustomDatum, CustomDatumFactory
{
  public static final String _SQL_BASETYPE = "SCOTT.LOCATION_TYP";
  public static final int _SQL_TYPECODE = OracleTypes.REF;

  REF _ref;

  static final LocationTypRef _LocationTypRefFactory = new LocationTypRef();
  public static CustomDatumFactory getFactory()
  {
    return _LocationTypRefFactory;
  }

  /* constructor */
  public LocationTypRef()
  {
  }

  /* 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;
    LocationTypRef r = new LocationTypRef();
    r._ref = (REF) d;
    return r;
  }
  public LocationTyp getValue() throws SQLException
  {
     return (LocationTyp) LocationTyp.getFactory().create(
       _ref.getSTRUCT(), OracleTypes.REF);
  }

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