/*@lineinfo:filename=PersonLocationTyp*//*@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 PersonLocationTyp implements CustomDatum, CustomDatumFactory
{
public static final String _SQL_NAME = "SCOTT.PERSON_LOCATION_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 =
{
2, 2, 91, 91
};
static CustomDatumFactory[] _factory = new CustomDatumFactory[4];
static final PersonLocationTyp _PersonLocationTypFactory = new PersonLocationTyp();
public static CustomDatumFactory getFactory()
{
return _PersonLocationTypFactory;
}
/* constructors */
public PersonLocationTyp()
{
_struct = new MutableStruct(new Object[4], _sqlType, _factory);
try
{
_ctx = new _Ctx(DefaultContext.getDefaultContext());
}
catch (Exception e)
{
_ctx = null;
}
}
public PersonLocationTyp(ConnectionContext c) throws SQLException
{
_struct = new MutableStruct(new Object[4], _sqlType, _factory);
_ctx = new _Ctx(c == null ? DefaultContext.getDefaultContext()
: c);
}
public PersonLocationTyp(Connection c) throws SQLException
{
_struct = new MutableStruct(new Object[4], _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;
PersonLocationTyp o = new PersonLocationTyp();
o._struct = new MutableStruct((STRUCT) d, _sqlType, _factory);
o._ctx = new _Ctx(((STRUCT) d).getConnection());
return o;
}
/* accessor methods */
public java.math.BigDecimal getPersonId() throws SQLException
{ return (java.math.BigDecimal) _struct.getAttribute(0); }
public void setPersonId(java.math.BigDecimal personId) throws SQLException
{ _struct.setAttribute(0, personId); }
public java.math.BigDecimal getLocationId() throws SQLException
{ return (java.math.BigDecimal) _struct.getAttribute(1); }
public void setLocationId(java.math.BigDecimal locationId) throws SQLException
{ _struct.setAttribute(1, locationId); }
public java.sql.Timestamp getStartDate() throws SQLException
{ return (java.sql.Timestamp) _struct.getAttribute(2); }
public void setStartDate(java.sql.Timestamp startDate) throws SQLException
{ _struct.setAttribute(2, startDate); }
public java.sql.Timestamp getEndDate() throws SQLException
{ return (java.sql.Timestamp) _struct.getAttribute(3); }
public void setEndDate(java.sql.Timestamp endDate) throws SQLException
{ _struct.setAttribute(3, endDate); }
}/*@lineinfo:generated-code*/ |