at the exact
same time, so both try to do an sps.prepare() at the
same time during code generation, so we synchronize
most everything except getters on immutable objects
just to be on the safe side.
| Fields inherited from interface org.apache.derby.catalog.Dependable |
ALIAS, COLUMNS_IN_TABLE, CONGLOMERATE, CONSTRAINT, DEFAULT, FILE, HEAP, INDEX, PREPARED_STATEMENT, SCHEMA, STORED_PREPARED_STATEMENT, TABLE, TRIGGER, VIEW |
|
Constructor Summary |
SPSDescriptor(DataDictionary dataDictionary,
java.lang.String name,
org.apache.derby.catalog.UUID uuid,
org.apache.derby.catalog.UUID suuid,
org.apache.derby.catalog.UUID compSchemaUUID,
char type,
boolean valid,
java.lang.String text,
java.lang.String usingText,
java.lang.Object[] paramDefaults,
boolean initiallyCompilable)
Constructor for a SPS Descriptor |
SPSDescriptor(DataDictionary dataDictionary,
java.lang.String name,
org.apache.derby.catalog.UUID uuid,
org.apache.derby.catalog.UUID suuid,
org.apache.derby.catalog.UUID compSchemaUUID,
char type,
boolean valid,
java.lang.String text,
java.lang.String usingText,
java.sql.Timestamp compileTime,
org.apache.derby.iapi.sql.execute.ExecPreparedStatement preparedStatement,
boolean initiallyCompilable)
Constructor for a SPS Descriptor. |
|
Method Summary |
private void |
compileStatement(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc,
TableDescriptor triggerTable)
|
java.lang.String |
getClassType()
Get the provider's type. |
java.sql.Timestamp |
getCompileTime()
The time this prepared statement was compiled |
org.apache.derby.catalog.UUID |
getCompSchemaId()
Get the compilation type schema id when this view
was first bound. |
org.apache.derby.catalog.DependableFinder |
getDependableFinder()
Return the stored form of this provider |
java.lang.String |
getDescriptorName()
|
java.lang.String |
getDescriptorType()
Each descriptor must identify itself with its type; i.e index, check
constraint whatever. |
java.lang.String |
getName()
Gets the name of the sps. |
org.apache.derby.catalog.UUID |
getObjectID()
Get the provider's UUID |
java.lang.String |
getObjectName()
Return the name of this Provider. |
java.lang.Object[] |
getParameterDefaults()
Get the default parameter values for this
statement. |
org.apache.derby.iapi.types.DataTypeDescriptor[] |
getParams()
Get the array of date type descriptors for
this statement. |
org.apache.derby.iapi.sql.execute.ExecPreparedStatement |
getPreparedStatement()
Get the preparedStatement for this statement. |
org.apache.derby.iapi.sql.execute.ExecPreparedStatement |
getPreparedStatement(boolean recompIfInvalid)
Get the preparedStatement for this statement. |
java.lang.String |
getQualifiedName()
Gets the full, qualified name of the statement. |
SchemaDescriptor |
getSchemaDescriptor()
Gets the SchemaDescriptor for this SPS Descriptor. |
java.lang.String |
getText()
Get the text used to create this statement. |
char |
getType()
Gets an identifier telling what type of table this is. |
java.lang.String |
getTypeAsString()
Simple little helper function to convert your type
to a string, which is easier to use. |
java.lang.String |
getUsingText()
Get the text of the USING clause used on CREATE
or ALTER statement. |
org.apache.derby.catalog.UUID |
getUUID()
Gets the UUID of the SPS. |
boolean |
initiallyCompilable()
Is the statement initially compilable? |
boolean |
isValid()
Check that all of the dependent's dependencies are valid. |
void |
loadGeneratedClass()
Load the underlying generatd class. |
void |
makeInvalid(int action,
org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc)
Mark the dependent as invalid (due to at least one of
its dependencies being invalid). |
void |
makeValid(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc)
Attempt to revalidate the dependent. |
void |
prepareAndRelease(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc)
Generate the class for this SPS and immediately
release it. |
void |
prepareAndRelease(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc,
TableDescriptor triggerTable)
FOR TRIGGERS ONLY
|
void |
prepareToInvalidate(org.apache.derby.iapi.sql.depend.Provider p,
int action,
org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc)
Prepare to mark the dependent as invalid (due to at least one of
its dependencies being invalid). |
private org.apache.derby.catalog.UUID |
recreateUUID(java.lang.String idString)
Get the UUID for the given string |
void |
revalidate(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc)
Invalidate and revalidate. |
void |
setCompileTime()
Set the compile time to now |
void |
setParameterDefaults(java.lang.Object[] values)
Set the parameter defaults for this statement. |
void |
setParams(org.apache.derby.iapi.types.DataTypeDescriptor[] params)
Set the list of parameters for this statement |
void |
setUsingText(java.lang.String usingText)
Set the text of the USING clause. |
void |
setUUID(org.apache.derby.catalog.UUID uuid)
Sets the UUID of the SPS. |
java.lang.String |
toString()
Prints the contents of the TableDescriptor |
private void |
updateSYSSTATEMENTS(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc,
int mode,
org.apache.derby.iapi.store.access.TransactionController tc)
|
static boolean |
validType(char type)
Validate the type. |
SPS_TYPE_TRIGGER
public static final char SPS_TYPE_TRIGGER
- Statement types.
- SPS_TYPE_TRIGGER - trigger (NOT IMPLEMENTED)
- SPS_TYPE_EXPLAIN - explain (NOT IMPLEMENTED)
- SPS_TYPE_REGULAR - catchall
- See Also:
- Constant Field Values
SPS_TYPE_REGULAR
public static final char SPS_TYPE_REGULAR
- See Also:
- Constant Field Values
SPS_TYPE_EXPLAIN
public static final char SPS_TYPE_EXPLAIN
- See Also:
- Constant Field Values
RECOMPILE
private static final int RECOMPILE
- interface to this class is:
- public void prepare() throws StandardException;
- public void prepareAndRelease(LanguageConnectionContext lcc)
throws StandardException;
- public void prepareAndRelease(...);
- public String getQualifiedName();
- public char getType();
- public String getTypeAsString();
- public boolean isValid();
- public boolean initiallyCompilable();
- public java.sql.Timestamp getCompileTime();
- public void setCompileTime();
- public String getText();
- public String getUsingText();
- public void setUsingText(String usingText);
- public void setUUID(UUID uuid);
- public DataTypeDescriptor[] getParams() throws StandardException;
- public void setParams(DataTypeDescriptor[] params);
- Object[] getParameterDefaults() throws StandardException;
- void setParameterDefaults(Object[] values);
- public UUID getCompSchemaId();
- public ExecPreparedStatement getPreparedStatement()
throws StandardException;
- public ExecPreparedStatement getPreparedStatement(boolean recompIfInvalid)
throws StandardException;
- public void revalidate(LanguageConnectionContext lcc)
throws StandardException;
- See Also:
- Constant Field Values
INVALIDATE
private static final int INVALIDATE
- See Also:
- Constant Field Values
sd
private SchemaDescriptor sd
name
private java.lang.String name
uuid
private org.apache.derby.catalog.UUID uuid
compSchemaId
private org.apache.derby.catalog.UUID compSchemaId
type
private char type
valid
private boolean valid
text
private java.lang.String text
usingText
private java.lang.String usingText
preparedStatement
private org.apache.derby.iapi.sql.execute.ExecPreparedStatement preparedStatement
params
private org.apache.derby.iapi.types.DataTypeDescriptor[] params
compileTime
private java.sql.Timestamp compileTime
paramDefaults
private java.lang.Object[] paramDefaults
initiallyCompilable
private boolean initiallyCompilable
lookedUpParams
private boolean lookedUpParams
uuidFactory
private org.apache.derby.iapi.services.uuid.UUIDFactory uuidFactory
SPSDescriptor
public SPSDescriptor(DataDictionary dataDictionary,
java.lang.String name,
org.apache.derby.catalog.UUID uuid,
org.apache.derby.catalog.UUID suuid,
org.apache.derby.catalog.UUID compSchemaUUID,
char type,
boolean valid,
java.lang.String text,
java.lang.String usingText,
java.lang.Object[] paramDefaults,
boolean initiallyCompilable)
throws org.apache.derby.iapi.error.StandardException
- Constructor for a SPS Descriptor
SPSDescriptor
public SPSDescriptor(DataDictionary dataDictionary,
java.lang.String name,
org.apache.derby.catalog.UUID uuid,
org.apache.derby.catalog.UUID suuid,
org.apache.derby.catalog.UUID compSchemaUUID,
char type,
boolean valid,
java.lang.String text,
java.lang.String usingText,
java.sql.Timestamp compileTime,
org.apache.derby.iapi.sql.execute.ExecPreparedStatement preparedStatement,
boolean initiallyCompilable)
throws org.apache.derby.iapi.error.StandardException
- Constructor for a SPS Descriptor. Used when
constructing an SPS descriptor from a row
in SYSSTATEMENTS.
prepareAndRelease
public final void prepareAndRelease(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc,
TableDescriptor triggerTable)
throws org.apache.derby.iapi.error.StandardException
- FOR TRIGGERS ONLY
Generate the class for this SPS and immediately
release it. This is useful for cases where we
don't want to immediately execute the statement
corresponding to this sps (e.g. CREATE STATEMENT).
SIDE EFFECTS: will update and SYSDEPENDS
with the prepared statement dependency info.
prepareAndRelease
public final void prepareAndRelease(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc)
throws org.apache.derby.iapi.error.StandardException
- Generate the class for this SPS and immediately
release it. This is useful for cases where we
don't want to immediately execute the statement
corresponding to this sps (e.g. CREATE STATEMENT).
SIDE EFFECTS: will update and SYSDEPENDS
with the prepared statement dependency info.
compileStatement
private void compileStatement(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc,
TableDescriptor triggerTable)
throws org.apache.derby.iapi.error.StandardException
getName
public final java.lang.String getName()
- Gets the name of the sps.
- Specified by:
getName in interface UniqueSQLObjectDescriptor
getQualifiedName
public final java.lang.String getQualifiedName()
- Gets the full, qualified name of the statement.
getSchemaDescriptor
public final SchemaDescriptor getSchemaDescriptor()
- Gets the SchemaDescriptor for this SPS Descriptor.
- Specified by:
getSchemaDescriptor in interface UniqueSQLObjectDescriptor
getType
public final char getType()
- Gets an identifier telling what type of table this is.
Types match final ints in this interface. Currently
returns SPS_TYPE_REGULAR or SPS_TYPE_TRIGGER.
getTypeAsString
public final java.lang.String getTypeAsString()
- Simple little helper function to convert your type
to a string, which is easier to use.
initiallyCompilable
public boolean initiallyCompilable()
- Is the statement initially compilable?
validType
public static final boolean validType(char type)
- Validate the type. NOTE: Only SPS_TYPE_REGULAR
and SPS_TYPE_TRIGGER are currently valid.
getCompileTime
public final java.sql.Timestamp getCompileTime()
- The time this prepared statement was compiled
setCompileTime
public final void setCompileTime()
- Set the compile time to now
getText
public final java.lang.String getText()
- Get the text used to create this statement.
Returns original text in a cleartext string.
getUsingText
public final java.lang.String getUsingText()
- Get the text of the USING clause used on CREATE
or ALTER statement.
setUsingText
public final void setUsingText(java.lang.String usingText)
- Set the text of the USING clause. Used by
ALTER statement.
setUUID
public final void setUUID(org.apache.derby.catalog.UUID uuid)
- Sets the UUID of the SPS.
getUUID
public final org.apache.derby.catalog.UUID getUUID()
- Gets the UUID of the SPS.
- Specified by:
getUUID in interface UniqueTupleDescriptor
getParams
public final org.apache.derby.iapi.types.DataTypeDescriptor[] getParams()
throws org.apache.derby.iapi.error.StandardException
- Get the array of date type descriptors for
this statement. Currently, we do a lookup
if we don't already have the parameters saved.
When SPSes are cached, the parameters should
be set up when the sps is constructed.
setParams
public final void setParams(org.apache.derby.iapi.types.DataTypeDescriptor[] params)
- Set the list of parameters for this statement
getParameterDefaults
public final java.lang.Object[] getParameterDefaults()
throws org.apache.derby.iapi.error.StandardException
- Get the default parameter values for this
statement. Default parameter values are
supplied by a USING clause on either a
CREATE or ALTER STATEMENT statement.
setParameterDefaults
public final void setParameterDefaults(java.lang.Object[] values)
- Set the parameter defaults for this statement.
getPreparedStatement
public final org.apache.derby.iapi.sql.execute.ExecPreparedStatement getPreparedStatement()
throws org.apache.derby.iapi.error.StandardException
- Get the preparedStatement for this statement.
If stmt is invalid or hasn't been compiled yet,
it will be recompiled.
getPreparedStatement
public final org.apache.derby.iapi.sql.execute.ExecPreparedStatement getPreparedStatement(boolean recompIfInvalid)
throws org.apache.derby.iapi.error.StandardException
- Get the preparedStatement for this statement.
Expects the prepared statement to have already
been added to SYS.SYSSTATEMENTS.
Side Effects: will update SYS.SYSSTATEMENTS with
the new plan if it needs to be recompiled.
getCompSchemaId
public final org.apache.derby.catalog.UUID getCompSchemaId()
- Get the compilation type schema id when this view
was first bound.
toString
public final java.lang.String toString()
- Prints the contents of the TableDescriptor
getDependableFinder
public final org.apache.derby.catalog.DependableFinder getDependableFinder()
- Return the stored form of this provider
- Specified by:
getDependableFinder in interface org.apache.derby.catalog.Dependable
getObjectName
public final java.lang.String getObjectName()
- Return the name of this Provider. (Useful for errors.)
- Specified by:
getObjectName in interface org.apache.derby.catalog.Dependable
getObjectID
public final org.apache.derby.catalog.UUID getObjectID()
- Get the provider's UUID
- Specified by:
getObjectID in interface org.apache.derby.catalog.Dependable
getClassType
public final java.lang.String getClassType()
- Get the provider's type.
- Specified by:
getClassType in interface org.apache.derby.catalog.Dependable
isValid
public final boolean isValid()
- Check that all of the dependent's dependencies are valid.
- Specified by:
isValid in interface org.apache.derby.iapi.sql.depend.Dependent
prepareToInvalidate
public final void prepareToInvalidate(org.apache.derby.iapi.sql.depend.Provider p,
int action,
org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc)
throws org.apache.derby.iapi.error.StandardException
- Prepare to mark the dependent as invalid (due to at least one of
its dependencies being invalid).
- Specified by:
prepareToInvalidate in interface org.apache.derby.iapi.sql.depend.Dependent
makeInvalid
public final void makeInvalid(int action,
org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc)
throws org.apache.derby.iapi.error.StandardException
- Mark the dependent as invalid (due to at least one of
its dependencies being invalid).
- Specified by:
makeInvalid in interface org.apache.derby.iapi.sql.depend.Dependent
makeValid
public final void makeValid(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc)
throws org.apache.derby.iapi.error.StandardException
- Attempt to revalidate the dependent. For prepared statements,
this could go through its dependencies and check that they
are up to date; if not, it would recompile the statement.
Any failure during this attempt should throw
StandardException.unableToRevalidate().
- Specified by:
makeValid in interface org.apache.derby.iapi.sql.depend.Dependent
revalidate
public final void revalidate(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc)
throws org.apache.derby.iapi.error.StandardException
- Invalidate and revalidate. The functional equivalent
of calling makeInvalid() and makeValid(), except it
is optimized.
loadGeneratedClass
public void loadGeneratedClass()
throws org.apache.derby.iapi.error.StandardException
- Load the underlying generatd class. This is not expected
to be used outside of the datadictionary package. It
is used for optimizing class loading for sps
cacheing.
updateSYSSTATEMENTS
private void updateSYSSTATEMENTS(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc,
int mode,
org.apache.derby.iapi.store.access.TransactionController tc)
throws org.apache.derby.iapi.error.StandardException
recreateUUID
private org.apache.derby.catalog.UUID recreateUUID(java.lang.String idString)
- Get the UUID for the given string
getDescriptorType
public java.lang.String getDescriptorType()
- Description copied from class:
TupleDescriptor
- Each descriptor must identify itself with its type; i.e index, check
constraint whatever.
- Overrides:
getDescriptorType in class TupleDescriptor
getDescriptorName
public java.lang.String getDescriptorName()
- Overrides:
getDescriptorName in class TupleDescriptor