/*@lineinfo:filename=PersonIdentifierTyp*//*@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 PersonIdentifierTyp implements CustomDatum, CustomDatumFactory
{
public static final String _SQL_NAME = "SCOTT.PERSON_IDENTIFIER_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
};
static CustomDatumFactory[] _factory = new CustomDatumFactory[2];
static final PersonIdentifierTyp _PersonIdentifierTypFactory = new PersonIdentifierTyp();
public static CustomDatumFactory getFactory()
{
return _PersonIdentifierTypFactory;
}
/* constructors */
public PersonIdentifierTyp()
{
_struct = new MutableStruct(new Object[2], _sqlType, _factory);
try
{
_ctx = new _Ctx(DefaultContext.getDefaultContext());
}
catch (Exception e)
{
_ctx = null;
}
}
public PersonIdentifierTyp(ConnectionContext c) throws SQLException
{
_struct = new MutableStruct(new Object[2], _sqlType, _factory);
_ctx = new _Ctx(c == null ? DefaultContext.getDefaultContext()
: c);
}
public PersonIdentifierTyp(Connection c) throws SQLException
{
_struct = new MutableStruct(new Object[2], _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;
PersonIdentifierTyp o = new PersonIdentifierTyp();
o._struct = new MutableStruct((STRUCT) d, _sqlType, _factory);
o._ctx = new _Ctx(((STRUCT) d).getConnection());
return o;
}
/* accessor methods */
public String getId() throws SQLException
{ return (String) _struct.getAttribute(0); }
public void setId(String id) throws SQLException
{ _struct.setAttribute(0, id); }
public String getIdType() throws SQLException
{ return (String) _struct.getAttribute(1); }
public void setIdType(String idType) throws SQLException
{ _struct.setAttribute(1, idType); }
}/*@lineinfo:generated-code*/ |