    All Packages    This Package  Previous  Next

# Class sqlj.runtime.profile.EntryInfo

    java.lang.Object
       |
       +----sqlj.runtime.profile.EntryInfo

public abstract class EntryInfo
extends Object
implements Serializable, ObjectInputValidation

A profile EntryInfo object contains the constant information describing a static sql operation constructed at translation time, including the sql string in JDBC format, the return type of the operation, the types of each bind parameter, and the way in which the operation is to be executed at runtime.

##

BLOCK
  Constant returned by `getRole` indicating that the operation is a BEGIN..END block.
CALL
  Constant returned by `getRole` indicating the operation is a call to a stored procedure.
CALLABLE_STATEMENT
  Constant returned by `getStatementType` indicating that the runtime statements associated with this entry may include out-parameters (and calls to getXXX methods).
COMMIT
  Constant returned by `getRole` indicating that the operation is a COMMIT statement.
EXECUTE
  Constant returned by `getExecuteType` indicating that the runtime statements associated with this entry will be executed via the `execute()` method.
EXECUTE_QUERY
  Constant returned by `getExecuteType` indicating that the runtime statements associated with this entry will be executed via the `executeRTQuery()` method.
EXECUTE_UPDATE
  Constant returned by `getExecuteType` indicating that the runtime statements associated with this entry will be executed via the `executeUpdate()` method.
NAMED_RESULT
  Constant returned by `getResultSetType` indicating that this entry produces a result set whose columns will be bound by name to the columns in this operation.
NO_RESULT
  Constant returned by `getResultSetType` indicating that this entry does not produce a result set.
OTHER
  Constant returned by `getRole` indicating that the operation cannot be categorized by any of the other constant roles returned by `getRole`.
POSITIONED
  Constant returned by `getRole` indicating that the operation contains a "WHERE CURRENT OF" clause (positioned update or delete, for example).
POSITIONED_RESULT
  Constant returned by `getResultSetType` indicating that this entry produces a result set whose columns will be bound by position to the columns in this operation.
PREPARED_STATEMENT
  Constant returned by `getStatementType` indicating that the runtime statements associated with this entry do not have any out-parameters.
QUERY
  Constant returned by `getRole` indicating the operation is a SELECT statement.
QUERY_FOR_UPDATE
  Constant returned by `getRole` indicating that the operation produces a result set which will later be used in a positioned update.
ROLLBACK
  Constant returned by `getRole` indicating that the operation is a ROLLBACK statement.
SET_TRANSACTION
  Constant returned by `getRole` indicating that the operation is a SET TRANSACTION statement.
SINGLE_ROW_QUERY
  Constant returned by `getRole` indicating that the operation produces a result set which is expected to contain a single row.
STATEMENT
  Constant returned by `getRole` indicating the operation is a general SQL statement not categorized by other roles (e.g., DML, DDL, etc).
VALUES
  Constant returned by `getRole` indicating the operation is a call to a stored function.

##

EntryInfo()

##

executeTypeToString(int)
  Returns a string representation of an execute type constant.
getDescriptor()
  Returns an object which describes any additional information particular to this entry.
getExecuteType()
  Describes the way in which the all executable statement objects associated with this entry will be executed at runtime.
getLineNumber()
  Returns the starting line number of the operation represented by this entry.
getParamCount()
getParamInfo(int)
getResultSetCount()
  Returns the number of columns in the result set produced by this entry, which is always non-negative.
getResultSetInfo(int)
  Returns a description of the result set column at index "ndx".
getResultSetName()
  Returns the name of the Java Class associated with the strongly typed result set populated by this entry.
getResultSetType()
  Describes the type of result set that is produced by this operation, if any.
getRole()
  Returns the role of the operation to be executed.
getSQLString()
  Returns the text of the operation to be performed in JDBC format.
getStatementType()
  Describes the type of statement.
getTransactionDescriptor()
  If this entry is a SET TRANSACTION statement, a descriptor is returned that contains the access mode and isolation level of the statement.
isDefinedRole(int)
  Returns true if the passed int parameter represents a defined role, false otherwise.
isValidDescriptor(Object, int)
  Returns true if the passed descriptor is of valid type (and value) for an entry which has the given role, false otherwise.
isValidExecuteType(int)
  Returns true if the passed int parameter represents a valid execute type, false otherwise.
isValidResultSetType(int)
  Returns true if the passed int parameter represents a valid result set type, false otherwise.
isValidRole(int)
  Returns true if the passed int parameter represents a valid role, false otherwise.
isValidStatementType(int)
  Returns true if the passed int parameter represents a valid statement type, false otherwise.
resultSetTypeToString(int)
  Returns a string representation of a result set type constant.
roleToString(int)
  Returns a string representation of a role constant.
statementTypeToString(int)
  Returns a string representation of a statement type constant.
validateObject()
  Performs validation on the internal state of this entry info object.

##

PREPARED_STATEMENT

     public static final int PREPARED_STATEMENT

  Constant returned by `getStatementType` indicating that the runtime statements associated with this entry do not have any out-parameters. The runtime statements associated with this entry will not expect any getXXX calls to be made.

  See Also:
    getStatementType

CALLABLE_STATEMENT

     public static final int CALLABLE_STATEMENT

  Constant returned by `getStatementType` indicating that the runtime statements associated with this entry may include out-parameters (and calls to getXXX methods).

  See Also:
    getStatementType

EXECUTE_UPDATE

     public static final int EXECUTE_UPDATE

  Constant returned by `getExecuteType` indicating that the runtime statements associated with this entry will be executed via the `executeUpdate()` method. Such statements return no result set, and thus have no result set info in this entry.

  See Also:
    executeUpdate, getExecuteType

EXECUTE_QUERY

     public static final int EXECUTE_QUERY

  Constant returned by `getExecuteType` indicating that the runtime statements associated with this entry will be executed via the `executeRTQuery()` method. Such statements always return a result set which is described by the `getResultSetInfo` method of this entry.

  See Also:
    executeRTQuery, getResultSetInfo, getExecuteType

EXECUTE

     public static final int EXECUTE

  Constant returned by `getExecuteType` indicating that the runtime statements associated with this entry will be executed via the `execute()` method. This constant is used only when the runtime will dynamically determine whether or not an operation returns a result set. An entry of this type is expected to be rare since most static SQL environments should be able to deduce whether an operation will return a result set or not.

  See Also:
    execute, getExecuteType

QUERY

     public static final int QUERY

  Constant returned by `getRole` indicating the operation is a SELECT statement.

  See Also:
    getRole

STATEMENT

     public static final int STATEMENT

  Constant returned by `getRole` indicating the operation is a general SQL statement not categorized by other roles (e.g., DML, DDL, etc).

  See Also:
    getRole

CALL

     public static final int CALL

  Constant returned by `getRole` indicating the operation is a call to a stored procedure.

  See Also:
    getRole

VALUES

     public static final int VALUES

  Constant returned by `getRole` indicating the operation is a call to a stored function.

  See Also:
    getRole

POSITIONED

     public static final int POSITIONED

  Constant returned by `getRole` indicating that the operation contains a "WHERE CURRENT OF" clause (positioned update or delete, for example).

  See Also:
    getRole

QUERY_FOR_UPDATE

     public static final int QUERY_FOR_UPDATE

  Constant returned by `getRole` indicating that the operation produces a result set which will later be used in a positioned update.

  See Also:
    getRole

SINGLE_ROW_QUERY

     public static final int SINGLE_ROW_QUERY

  Constant returned by `getRole` indicating that the operation produces a result set which is expected to contain a single row.

  See Also:
    getRole

BLOCK

     public static final int BLOCK

  Constant returned by `getRole` indicating that the operation is a BEGIN..END block.

  See Also:
    getRole

COMMIT

     public static final int COMMIT

  Constant returned by `getRole` indicating that the operation is a COMMIT statement.

  See Also:
    getRole

ROLLBACK

     public static final int ROLLBACK

  Constant returned by `getRole` indicating that the operation is a ROLLBACK statement.

  See Also:
    getRole

SET_TRANSACTION

     public static final int SET_TRANSACTION

  Constant returned by `getRole` indicating that the operation is a SET TRANSACTION statement. For such an entry, the `getDescriptor` method returns a SetTransactionDescriptor that further describes the transaction access mode and isolation level.

  See Also:
    getRole, getDescriptor, SetTransactionDescriptor

OTHER

     public static final int OTHER

  Constant returned by `getRole` indicating that the operation cannot be categorized by any of the other constant roles returned by `getRole`. The value of this constant also defines the upper limit that future role constants added to the EntryInfo class may obtain. Thus, if additional vendor-specific roles are defined, they should be defined with values larger than that of this constant.

  See Also:
    getRole

NO_RESULT

     public static final int NO_RESULT

  Constant returned by `getResultSetType` indicating that this entry does not produce a result set. If the result type indicates NO_RESULT, then `getResultSetInfo` will always return null, `getResultSetCount` will always return 0, and `getExecuteType` will always return EXECUTE_UPDATE.

  See Also:
    getResultSetType, getResultSetInfo, getResultSetCount, getExecuteType

NAMED_RESULT

     public static final int NAMED_RESULT

  Constant returned by `getResultSetType` indicating that this entry produces a result set whose columns will be bound by name to the columns in this operation. If the result type indicates NAMED_RESULT, then `getResultSetInfo` returns a type info object whose `getName` method reflects the name of the column expected, and `getExecuteType` will always return EXECUTE_QUERY.

  See Also:
    getResultSetType, getResultSetInfo, getExecuteType

POSITIONED_RESULT

     public static final int POSITIONED_RESULT

  Constant returned by `getResultSetType` indicating that this entry produces a result set whose columns will be bound by position to the columns in this operation. If the result type indicates POSITIONED_RESULT, then `getResultSetInfo` for a particular index returns a type info object describing the column type expected at that index in this operation, and `getExecuteType` will always return EXECUTE_QUERY.

  See Also:
    getResultSetType, getResultSetInfo, getExecuteType

##

EntryInfo

     public EntryInfo()

##

getSQLString

     public abstract String getSQLString()

  Returns the text of the operation to be performed in JDBC format. All host variables have been replaced with '?'. Any INTO-lists have been removed. A positional update will include a clause of the form "WHERE CURRENT OF ?". Comments and hints are preserved as they appeared in the original source file. Function and procedure calls are in the JDBC-prescribed format: `{ call proc(?) }`, and `{ ? = call fn(?) }`.

  Returns:
    the text of the operation to be performed, in jdbc format.

getStatementType

     public abstract int getStatementType()

  Describes the type of statement. The value returned will be one of the following constants.

  - PREPARED_STATEMENT
  - CALLABLE_STATEMENT

isValidStatementType

     public static boolean isValidStatementType(int statementType)

  Returns true if the passed int parameter represents a valid statement type, false otherwise. Valid statement type values are those which may be returned by the `getStatementType` method.

  See Also:
    getStatementType

statementTypeToString

     public static String statementTypeToString(int type)

  Returns a string representation of a statement type constant. If the value passed is not a valid statement type, a string representation of the value as an int is returned. This method is most often used in debugging profile entry representations.

  See Also:
    getStatementType, isValidStatementType

getExecuteType

     public abstract int getExecuteType()

  Describes the way in which the all executable statement objects associated with this entry will be executed at runtime. The value returned will be one of the following constants.

  - EXECUTE_UPDATE
  - EXECUTE_QUERY
  - EXECUTE

isValidExecuteType

     public static boolean isValidExecuteType(int execType)

  Returns true if the passed int parameter represents a valid execute type, false otherwise. Valid execute type values are those which may be returned by the `getStatementType` method.

  See Also:
    getExecuteType

executeTypeToString

     public static String executeTypeToString(int executeType)

  Returns a string representation of an execute type constant. If the value passed is not a valid execute type, a string representation of the value as an int is returned. This method is most often used in debugging profile entry representations.

  See Also:
    getStatementType

getRole

     public abstract int getRole()

  Returns the role of the operation to be executed. The role categorizes the operation, and is used to determine how the operation is to be treated at runtime. The value returned may be one of the following constants.

  - QUERY
  - STATEMENT
  - CALL
  - VALUES
  - POSITIONED
  - QUERY_FOR_UPDATE
  - SINGLE_ROW_QUERY
  - BLOCK
  - COMMIT
  - ROLLBACK
  - SET_TRANSACTION
  - OTHER

  If the role returned is not one of the above constants, it will be a value which is larger than the value of the constant `OTHER`. Such a result indicates a vendor defined role which may not be reliably processed by all vendors.

  Note: regardless of the role, `getParameterInfo` calls may always be used to describe any parameters for the operation.

isDefinedRole

     public static boolean isDefinedRole(int role)

  Returns true if the passed int parameter represents a defined role, false otherwise. A defined role is a role which has been defined with a constant field in this class. An enumeration of such constants is found in the `getRole` method documentation.

  See Also:
    getRole

isValidRole

     public static boolean isValidRole(int role)

  Returns true if the passed int parameter represents a valid role, false otherwise. Valid roles values are any roles which are defined, or any values greater than the `OTHER` constant.

  See Also:
    getRole, isDefinedRole, OTHER

roleToString

     public static String roleToString(int role)

  Returns a string representation of a role constant. If the value passed is not a valid role or is a custom role, a string representation of the value as an int is returned. This method is most often used in debugging profile entry representations.

  See Also:
    getRole, isValidRole

getResultSetType

     public abstract int getResultSetType()

  Describes the type of result set that is produced by this operation, if any. This method should be used to determine how the results described by `getResultSetInfo()` are to be interpreted. The value returned will be one of the following constants.

  - NO_RESULT
  - NAMED_RESULT
  - POSITIONED_RESULT

  See Also:
    getResultSetInfo

isValidResultSetType

     public static boolean isValidResultSetType(int resultSetType)

  Returns true if the passed int parameter represents a valid result set type, false otherwise. Valid result set type values are those which may be returned by the `getResultSetType` method.

  See Also:
    getResultSetType

resultSetTypeToString

     public static String resultSetTypeToString(int type)

  Returns a string representation of a result set type constant. If the value passed is not a valid result set type, a string representation of the value as an int is returned. This method is most often used in debugging profile entry representations.

  See Also:
    getResultSetType, isValidResultSetType

getResultSetCount

     public abstract int getResultSetCount()

  Returns the number of columns in the result set produced by this entry, which is always non-negative. If the operation does not produce a result set or produces a dynamic result set, 0 is returned. Otherwise, `getResultSetInfo` can be used to determine the type of each result column.

  Returns:
    the number of columns in the result set produced by this entry, if any.
  See Also:
    getResultSetInfo, getResultSetType

getResultSetInfo

     public abstract TypeInfo getResultSetInfo(int ndx)

  Returns a description of the result set column at index "ndx". This may be useful to jdbc implementations which are able to pre-register query result types. The mode of the types described by this method will always be OUT. To determine whether the results will by bound by name or by position, use `getResultSetType()`.

  Note that if `getResultSetCount` returns 0, this method will always return null.

  Parameters:
    ndx - the index of the result set column to describe, range 1 to getResultSetCount().
  Returns:
    a description of the result set column at index "ndx", or null if "ndx" out of range.
  See Also:
    getName, getResultSetType

getResultSetName

     public abstract String getResultSetName()

  Returns the name of the Java Class associated with the strongly typed result set populated by this entry. If this entry does not populate a strongly typed result set (e.g. resultSetType=NO_RESULT), null is returned.

  The `getJavaType` method of a profile can be used to load the class represented by the result set name using the current profile loader.

  Returns:
    the name of the Java Class representation of the type.
  See Also:
    getJavaType, getResultSetType

getParamCount

     public abstract int getParamCount()

  Returns:
    the number of parameters for this entry, 0 or greater.

getParamInfo

     public abstract TypeInfo getParamInfo(int ndx)

  Parameters:
    ndx - the index of the parameter to describe, range 1 to getParamCount().
  Returns:
    a description of the parameter at index "ndx", or null if "ndx" out of range.

getDescriptor

     public abstract Object getDescriptor()

  Returns an object which describes any additional information particular to this entry. The object returned will vary according to the role of the sql statement contained in this entry. The following list describes the type of descriptor returned as a function of the role of this entry.

  POSITIONED
    Returns an Integer whose value is the 1-based index of the CURRENT OF cursor parameter in this entry. For example, if the sql string is UPDATE TAB SET COL1=? WHERE CURRENT OF ?, then 2 would be returned. The index can be passed to `getParamInfo` to describe the cursor type.
  SET_TRANSACTION
    Returns a SetTransactionDescriptor that describes the access mode and isolation level of the SET TRANSACTION statement.
  All Other Roles
    Returns null descriptor.

  Returns:
    a descriptor object for this entry.
  See Also:
    getRole, getParamInfo, SetTransactionDescriptor, getTransactionDescriptor

getTransactionDescriptor

     public SetTransactionDescriptor getTransactionDescriptor()

  If this entry is a SET TRANSACTION statement, a descriptor is returned that contains the access mode and isolation level of the statement. Otherwise, null is returned.

  See Also:
    SET_TRANSACTION, getDescriptor

isValidDescriptor

     public static boolean isValidDescriptor(Object descriptor,
                                             int role)

  Returns true if the passed descriptor is of valid type (and value) for an entry which has the given role, false otherwise. The expected descriptor types are defined by the getDescriptor method. Note that in the case of user-defined roles, any descriptor value is permitted.

  See Also:
    getDescriptor

getLineNumber

     public abstract int getLineNumber()

  Returns the starting line number of the operation represented by this entry. The location returned is the line in the original source file, as given by the `getSourceFile` method of the profile data for this entry. Source file lines are numbered starting at 1. If line number information is not available, 0 is returned.

  See Also:
    getSourceFile

validateObject

     public void validateObject() throws InvalidObjectException

  Performs validation on the internal state of this entry info object. In particular, the statement type, execute type, role, result set type, and descriptor are validated. An exception is thrown if this type contains invalid state.

  To allow for compatibility with future versions, this method is not automatically called during object deserialization. Profile runtime library implementors should call this method as needed at runtime to verify the state of the object. For example, this method could be called from a readObject implementation of an EntryInfo subclass.

  It is recommended that subclasses use this method during object construction once state is complete to validate the entry.

  See Also:
    isValidStatementType, isValidExecuteType, isValidRole, isValidResultSetType, isValidDescriptor

    All Packages    This Package  Previous  Next