/*@lineinfo:filename=LocationTyp*//*@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 LocationTyp implements CustomDatum, CustomDatumFactory
{
public static final String _SQL_NAME = "SCOTT.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, 12, 12, 91, 91
};
static CustomDatumFactory[] _factory = new CustomDatumFactory[6];
static final LocationTyp _LocationTypFactory = new LocationTyp();
public static CustomDatumFactory getFactory()
{
return _LocationTypFactory;
}
/* constructors */
public LocationTyp()
{
_struct = new MutableStruct(new Object[6], _sqlType, _factory);
try
{
_ctx = new _Ctx(DefaultContext.getDefaultContext());
}
catch (Exception e)
{
_ctx = null;
}
}
public LocationTyp(ConnectionContext c) throws SQLException
{
_struct = new MutableStruct(new Object[6], _sqlType, _factory);
_ctx = new _Ctx(c == null ? DefaultContext.getDefaultContext()
: c);
}
public LocationTyp(Connection c) throws SQLException
{
_struct = new MutableStruct(new Object[6], _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;
LocationTyp o = new LocationTyp();
o._struct = new MutableStruct((STRUCT) d, _sqlType, _factory);
o._ctx = new _Ctx(((STRUCT) d).getConnection());
return o;
}
/* accessor methods */
public java.math.BigDecimal getLocationId() throws SQLException
{ return (java.math.BigDecimal) _struct.getAttribute(0); }
public void setLocationId(java.math.BigDecimal locationId) throws SQLException
{ _struct.setAttribute(0, locationId); }
public java.math.BigDecimal getParentLocationId() throws SQLException
{ return (java.math.BigDecimal) _struct.getAttribute(1); }
public void setParentLocationId(java.math.BigDecimal parentLocationId) throws SQLException
{ _struct.setAttribute(1, parentLocationId); }
public String getCode() throws SQLException
{ return (String) _struct.getAttribute(2); }
public void setCode(String code) throws SQLException
{ _struct.setAttribute(2, code); }
public String getName() throws SQLException
{ return (String) _struct.getAttribute(3); }
public void setName(String name) throws SQLException
{ _struct.setAttribute(3, name); }
public java.sql.Timestamp getStartDate() throws SQLException
{ return (java.sql.Timestamp) _struct.getAttribute(4); }
public void setStartDate(java.sql.Timestamp startDate) throws SQLException
{ _struct.setAttribute(4, startDate); }
public java.sql.Timestamp getEndDate() throws SQLException
{ return (java.sql.Timestamp) _struct.getAttribute(5); }
public void setEndDate(java.sql.Timestamp endDate) throws SQLException
{ _struct.setAttribute(5, endDate); }
public java.math.BigDecimal getId ()
throws SQLException
{
java.math.BigDecimal __jPt_result;
/*@lineinfo:generated-code*//*@lineinfo:125^5*/
// ************************************************************
// #sql [_ctx] __jPt_result = { VALUES(LOCATION_TYP.GET_ID()) };
// ************************************************************
{
sqlj.runtime.ConnectionContext __sJT_connCtx = _ctx;
if (__sJT_connCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_CONN_CTX();
sqlj.runtime.ExecutionContext __sJT_execCtx = __sJT_connCtx.getExecutionContext();
if (__sJT_execCtx == null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_EXEC_CTX();
synchronized (__sJT_execCtx) {
sqlj.runtime.profile.RTStatement __sJT_stmt = __sJT_execCtx.registerStatement(__sJT_connCtx, LocationTyp_SJProfileKeys.getKey(0), 0);
try
{
__sJT_execCtx.executeUpdate();
java.math.BigDecimal __sJT_result;
__sJT_result = __sJT_stmt.getBigDecimal(1);
__jPt_result = __sJT_result;
}
finally
{
__sJT_execCtx.releaseStatement();
}
}
}
// ************************************************************
/*@lineinfo:user-code*//*@lineinfo:125^64*/
return __jPt_result;
}
}/*@lineinfo:generated-code*/class LocationTyp_SJProfileKeys
{
private static LocationTyp_SJProfileKeys inst = null;
public static java.lang.Object getKey(int keyNum)
throws java.sql.SQLException
{
if (inst == null)
{
inst = new LocationTyp_SJProfileKeys();
}
return inst.keys[keyNum];
}
private final sqlj.runtime.profile.Loader loader = sqlj.runtime.RuntimeContext.getRuntime().getLoaderForClass(getClass());
private java.lang.Object[] keys;
private LocationTyp_SJProfileKeys()
throws java.sql.SQLException
{
keys = new java.lang.Object[1];
keys[0] = LocationTyp._Ctx.getProfileKey(loader, "LocationTyp_SJProfile0");
}
}
|