FileDocCategorySizeDatePackage
PersonIdentifierTypeTyp.javaAPI DocExample5295Fri Feb 23 14:19:08 GMT 2001None

PersonIdentifierTypeTyp.java

/*@lineinfo:filename=PersonIdentifierTypeTyp*//*@lineinfo:user-code*//*@lineinfo:1^1*/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.STRUCT;
import oracle.jpub.runtime.MutableStruct;
import sqlj.runtime.ref.DefaultContext;
import sqlj.runtime.ConnectionContext;
import java.sql.Connection;

public class PersonIdentifierTypeTyp implements CustomDatum, CustomDatumFactory
{
  public static final String _SQL_NAME = "SCOTT.PERSON_IDENTIFIER_TYPE_TYP";
  public static final int _SQL_TYPECODE = OracleTypes.STRUCT;

  /*@lineinfo:generated-code*//*@lineinfo:18^3*/

//  ************************************************************
//  SQLJ context declaration:
//  ************************************************************

static class _Ctx 
extends sqlj.runtime.ref.ConnectionContextImpl
implements sqlj.runtime.ConnectionContext
{
  public _Ctx(java.sql.Connection conn) 
    throws java.sql.SQLException 
  {
    super(profiles, conn);
  }
  public _Ctx(java.lang.String url, java.lang.String user, java.lang.String password, boolean autoCommit) 
    throws java.sql.SQLException 
  {
    super(profiles, url, user, password, autoCommit);
  }
  public _Ctx(java.lang.String url, java.util.Properties info, boolean autoCommit) 
    throws java.sql.SQLException 
  {
    super(profiles, url, info, autoCommit);
  }
  public _Ctx(java.lang.String url, boolean autoCommit) 
    throws java.sql.SQLException 
  {
    super(profiles, url, autoCommit);
  }
  public _Ctx(sqlj.runtime.ConnectionContext other) 
    throws java.sql.SQLException 
  {
    super(profiles, other);
  }
  public static _Ctx getDefaultContext() 
  {
    if (defaultContext == null)
    {
      java.sql.Connection conn = sqlj.runtime.RuntimeContext.getRuntime().getDefaultConnection();
      if (conn != null)
      {
        try 
        {
          defaultContext = new _Ctx(conn);
        }
        catch (java.sql.SQLException e) 
        {
        }
      }
    }
    return defaultContext;
  }
  public static void setDefaultContext(_Ctx ctx) 
  {
    defaultContext = ctx;
  }
  private static _Ctx defaultContext = null;
  public static java.lang.Object getProfileKey(sqlj.runtime.profile.Loader loader, java.lang.String profileName) 
    throws java.sql.SQLException 
  {
    return profiles.getProfileKey(loader, profileName);
  }
  private static final sqlj.runtime.ref.ProfileGroup profiles = new sqlj.runtime.ref.ProfileGroup();
  public static sqlj.runtime.profile.Profile getProfile(java.lang.Object profileKey) 
  {
    return profiles.getProfile(profileKey);
  }
}


//  ************************************************************

/*@lineinfo:user-code*//*@lineinfo:18^26*/
  _Ctx _ctx;

  MutableStruct _struct;

  static int[] _sqlType =
  {
    12, 12, 91
  };

  static CustomDatumFactory[] _factory = new CustomDatumFactory[3];

  static final PersonIdentifierTypeTyp _PersonIdentifierTypeTypFactory = new PersonIdentifierTypeTyp();
  public static CustomDatumFactory getFactory()
  {
    return _PersonIdentifierTypeTypFactory;
  }

  /* constructors */
  public PersonIdentifierTypeTyp()
  {
    _struct = new MutableStruct(new Object[3], _sqlType, _factory);
    try
    {
      _ctx = new _Ctx(DefaultContext.getDefaultContext());
    }
    catch (Exception e)
    {
      _ctx = null;
    }
  }

  public PersonIdentifierTypeTyp(ConnectionContext c) throws SQLException
  {
    _struct = new MutableStruct(new Object[3], _sqlType, _factory);
    _ctx = new _Ctx(c == null ? DefaultContext.getDefaultContext()
                              : c);
  }
  public PersonIdentifierTypeTyp(Connection c) throws SQLException
  {
    _struct = new MutableStruct(new Object[3], _sqlType, _factory);
    _ctx = new _Ctx(c);
  }

  /* CustomDatum interface */
  public Datum toDatum(OracleConnection c) throws SQLException
  {
    _ctx = new _Ctx(c);
    return _struct.toDatum(c, _SQL_NAME);
  }

  /* CustomDatumFactory interface */
  public CustomDatum create(Datum d, int sqlType) throws SQLException
  {
    if (d == null) return null;
    PersonIdentifierTypeTyp o = new PersonIdentifierTypeTyp();
    o._struct = new MutableStruct((STRUCT) d, _sqlType, _factory);
    o._ctx = new _Ctx(((STRUCT) d).getConnection());
    return o;
  }

  /* accessor methods */
  public String getCode() throws SQLException
  { return (String) _struct.getAttribute(0); }

  public void setCode(String code) throws SQLException
  { _struct.setAttribute(0, code); }


  public String getDescription() throws SQLException
  { return (String) _struct.getAttribute(1); }

  public void setDescription(String description) throws SQLException
  { _struct.setAttribute(1, description); }


  public java.sql.Timestamp getInactiveDate() throws SQLException
  { return (java.sql.Timestamp) _struct.getAttribute(2); }

  public void setInactiveDate(java.sql.Timestamp inactiveDate) throws SQLException
  { _struct.setAttribute(2, inactiveDate); }

}/*@lineinfo:generated-code*/