|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sqlj.runtime.ref.ConnectionContextImpl | +--sqlj.runtime.ref.DefaultContext
The default context class provides a complete default implementation of
a connection context. This is the same class definition that would have
been generated by the reference translator for the clause:
#sql public context DefaultContext;
The reference implementation defaults to this class when no connection
context instance variable exists in an executable sql clause and no
other default class name was provided to the translator.
Constructor Summary |
DefaultContext(java.sql.Connection conn)
Creates a new default context instance which uses the passed connection as its underlying connection. |
DefaultContext(ConnectionContext other)
Creates a new default context instance which uses the same underlying connection as the passed connection context instance. |
DefaultContext(java.lang.String url,
boolean autoCommit)
Creates a new default context instance whose underlying connection is created based on the passed url. |
DefaultContext(java.lang.String url,
java.util.Properties info,
boolean autoCommit)
Creates a new default context instance whose underlying connection is created based on the passed url, and properties information. |
DefaultContext(java.lang.String url,
java.lang.String user,
java.lang.String password,
boolean autoCommit)
Creates a new default context instance whose underlying connection is created based on the passed url, user and password. |
Method Summary |
Type | Method |
---|---|
static DefaultContext |
getDefaultContext()
Returns the default context instance associated with this context class. |
static sqlj.runtime.profile.Profile |
getProfile(java.lang.Object profileKey)
Returns a top-level profile associated with profile key returned by an earlier call to getProfileKey in this context class. |
static java.lang.Object |
getProfileKey(sqlj.runtime.profile.Loader loader,
java.lang.String profileName)
Returns a key associated with the profile having the given name. |
java.util.Dictionary |
getTypeMap()
Returns the type map on this connection context type. |
static void |
setDefaultContext(DefaultContext ctx)
Sets the default connection context to be used for this class. |
Methods inherited from class sqlj.runtime.ref.ConnectionContextImpl |
close,
close,
getConnectedProfile,
getConnection,
getDefaultStmtCacheSize,
getExecutionContext,
getOracleConnection,
getStmtCacheSize,
isClosed,
loadProps,
loadTypeMap,
setDefaultStmtCacheSize,
setStmtCacheSize |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public DefaultContext(java.sql.Connection conn) throws java.sql.SQLException
Note that the passed connection will not be closed if a call to this constructor results in an exception
conn
- the underlying connection for this context instance.public DefaultContext(java.lang.String url, java.lang.String user, java.lang.String password, boolean autoCommit) throws java.sql.SQLException
Note that if an exception occurs during construction, the underlying connection created during this call will be automatically closed.
url
- the database urluser
- the usernamepassword
- the user passwordautoCommit
- true if the connection should be created in
auto-commit mode, false otherwiseDriverManager.getConnection(String,String,String)
,
Connection.setAutoCommit(boolean)
public DefaultContext(java.lang.String url, java.util.Properties info, boolean autoCommit) throws java.sql.SQLException
Note that if an exception occurs during construction, the underlying connection created during this call will be automatically closed.
url
- the database urlinfo
- a list of properties for the connectionautoCommit
- true if the connection should be created in
auto-commit mode, false otherwiseautoCommit
- true if the connection should be created in
auto-commit mode, false otherwiseDriverManager.getConnection(String,java.util.Properties)
,
Connection.setAutoCommit(boolean)
public DefaultContext(java.lang.String url, boolean autoCommit) throws java.sql.SQLException
Note that if an exception occurs during construction, the underlying connection created during this call will be automatically closed.
url
- the database urlautoCommit
- true if the connection should be created in
auto-commit mode, false otherwiseDriverManager.getConnection(String)
,
Connection.setAutoCommit(boolean)
public DefaultContext(ConnectionContext other) throws java.sql.SQLException
Note that the passed other ConnectionContext (and its underlying connection) will not be closed if a call to this constructor results in an exception.
other
- the context with which to share an underlying connection.DefaultContext(Connection)
,
ConnectionContext.getConnection()
Method Detail |
public static java.lang.Object getProfileKey(sqlj.runtime.profile.Loader loader, java.lang.String profileName) throws java.sql.SQLException
loader
- the profile loader from which the profile should be
loaded if it doesn't already exist.profileName
- the fully qualified name of the profile.getProfile(Object)
,
ConnectionContext.getConnectedProfile(Object)
public static sqlj.runtime.profile.Profile getProfile(java.lang.Object profileKey)
getProfileKey
in this context class.
Each connection context class maintains a set of profiles that
collectively define all possible sql operations that may be performed
on this context.profileKey
- the key asscoiated with the desired profile.getProfileKey(sqlj.runtime.profile.Loader, java.lang.String)
public static DefaultContext getDefaultContext()
setDefaultContext
, that context is returned.
Otherwise, if a default JDBC connection exists in the current runtime
context, a new default context object is created, installed and
returned which uses the default JDBC connection as its underlying
connection. If no default connection exists in the runtime, null is
returned.setDefaultContext(sqlj.runtime.ref.DefaultContext)
,
RuntimeContext.getDefaultConnection()
public static void setDefaultContext(DefaultContext ctx)
ctx
- the new default context instance.public java.util.Dictionary getTypeMap() throws java.sql.SQLException
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |