planetj.database
Class SQLContext

java.lang.Object
  |
  +--planetj.dataengine.AbstractContext
        |
        +--planetj.database.SQLContext
All Implemented Interfaces:
Cloneable, IContext, INavigationObject, Serializable
Direct Known Subclasses:
ApplicationSQLContext, AssociationContext

public class SQLContext
extends AbstractContext
implements Serializable, Cloneable

Contains information about an SQL command, including parameters on how to run the command, the command itself, and how to organize the command's results.

See Also:
Serialized Form

Field Summary
static int ALL_ROWS
           
static int CACHE_EXPIRATION_TIME_1_DAY
           
static int CACHE_EXPIRATION_TIME_1_HOUR
           
static int CACHE_EXPIRATION_TIME_1_WEEK
           
static int CACHE_EXPIRATION_TIME_15_MINUTES
           
static int CACHE_EXPIRATION_TIME_30_MINUTES
           
static int CACHE_EXPIRATION_TIME_NEVER
           
static int CACHING_CHECK
          This SQLContext should check the cache instead of going to the DB if possible, but any results retrieved from the DB should not be stored in the cache
static int CACHING_CHECK_AND_STORE
          This SQLContext should check the cache instead of going to the DB if possible, and should store any data from the DB in the cache if possible.
static int CACHING_NONE
          This SQLContext should not use caching
static int CACHING_STORE
          This SQLContext should not check the cache, but if possible should store any data retrieved from the DB in the cache
static String className
           
static short LIBRARY_AS_SPECIFIED
          This statment already has the libraries it is going against specified
static short LIBRARY_SYSTEM
          This statement is again the system library
static short LIBRARY_UNKNOWN
          It is not known if this statement is against the user or system library.
static short LIBRARY_USER
          This statement is against the user library
 
Fields inherited from class planetj.dataengine.AbstractContext
DEFAULT_TYPE, PARAM_ESCAPE_NUMBERED, PARAM_ESCAPE_TABLE, PARAM_ESCAPE_USAGE_ID, PARAM_ESCAPE_USER, PARAM_ESCAPE_USER_USAGE_ID, PARAM_NUMBERED, PARAM_TABLE, PARAM_USAGE_ID, PARAM_USER, PARAM_USER_USAGE_ID
 
Constructor Summary
SQLContext()
          SQLContext constructor
SQLContext(String pSystemAlias)
          SQLContext constructor
SQLContext(String pSystemAlias, IUser user)
          SQLContext constructor
 
Method Summary
 void addListener(IDataEngineListener listener)
          Adds a listener to this SQLContext.
 void addTable(Table newTable)
          Adds a table to this query.
 void clear()
          Wipes out the info in this SQLContext, restoring the default values.
 void clearTables()
          Clears the tables to this query.
 Object clone()
          Creates an unlocked copy of this SQLContext
 SQLContext cloneContext()
          Creates an unlocked copy of this SQLContext
 SQLContext cloneContext(boolean clearExecutingContext)
          Creates an unlocked copy of this SQLContext
 boolean equals(Object o)
           
 Object execute()
          Executes the SQL statement contained in this context and returns the results.
 int getCachingLevel()
          Gets the current caching level, describing whether the cache should be checked, and whether results should be stored in the cache.
 long getCachingTimeMillis()
          Gets the amount of time in milliseconds this context's results are to be cached.
 Connection getConnection()
          Gets theCconnection that should be used for queries which use thix QuerContext.
 Connection getConnection(boolean pCreate)
          Gets the connection that should be used for DataEngine operations which use this SQLContext
 String getConnectionAlias()
          Deprecated. Just use getSystemAlias() instead
 Object getConnectionOwner()
          If the Connection contained in this object was created in this SQLContext, then this object is returned.
 int getFirstRowIndex()
          Insert the method's description here.
 SQLContext getKeyContext()
          Gets the SQLContext to be used as a key in the cache.
 List getLogicalFieldNames()
          Gets a List of the names of logical Fields in this SQLContext.
 String getMetaDataAlias()
           
 int getNumberOfTables()
          Gets the number of tables being queried.
 PropertyGroupList getPropertyGroups()
          Get all the property groups stored in this RowCollection's attributes.
 ReportBreakCollection getReportBreakCollection()
          Gets the ReportBreakCollection defining the reports that will be generated in the RowCollection resulting from queries which use this SQLContext
 Class getRowClass()
          Gets the type of Row objects that will be included in the RowCollection resulting from the query.
 RowCollection getRowCollection()
          Gets the RowCollection object into which retrieved rows will be inserted.
 Class getRowCollectionClass()
          Gets the type of RowCollection that will contain this query's results.
 int getRowCount()
          Gets the number of rows to add to the RowCollection.
 IRowCreator getRowCreator()
          Gets the object used to create the Rows the query should return.
 String getSafeSQL()
          Returns this context's SQL, with all single quotes, double quotes, and backslashes replaced with underscores
 Row getSourceRow()
          If this SQLContext is an update, insert, or delete statement which pertains to one specific row, then this method gets that row.
 String getSQL()
          Gets this SQLContext's SQL String.
 DeleteStatement getSQLDeleteStatement()
          Get the context's current delete statement.
 InsertStatement getSQLInsertStatement()
          Get the context's current insert statement.
 Iterator getSQLParameters()
          Returns an iteration of all the ISQLParameters in this context.
 SelectStatement getSQLSelectStatement()
          Get the context's current select statement.
 SQLStatement getSQLStatement()
          Gets the SQL Statement object for this SQLContext
 UpdateStatement getSQLUpdateStatement()
          Get the context's current update statement.
 String getSystemAlias()
          Gets the system alias for the SQL operation.
 Table getTable()
          Gets the table which is being queried.
 Table getTable(int pTableIndex)
          Gets the table being queried with the given index.
 TableCollection getTables()
          Gets the tables being queried.
 long getTimestamp()
          Gets when this SQLContext was last run
 String getTitle()
          Gets the title of this SQLContext, which will also be the title of any RowCollections retrieved via this SQLContext
 Row getUsageIdRow()
          Gets the row whose data should be used to replace literal usage id's in the SQL (indicated with a ##?)
 short getUseWOWLibrary()
          Tests which WOW library should be used to execute this context.
 int hashCode()
           
 boolean hasListeners()
          Tests if there are any objects listening to this SQLContext.
 boolean isAlterTableStatement()
          Check if this context contains an alter table statement.
 boolean isAssociatedJoinOperationPresent()
          Tests if the RC returned by this SQLContext has one or more columns whose FD's have an associated join operation
 boolean isAutoRefresh()
          Tests if RowCollections retrieved with this SQLContext should automatically refresh themselves when the DataEngine is used to update the database.
 boolean isBatch()
          Tests if this SQLContext should be executed in batch mode
 boolean isCacheResults()
          Tests if queries resulting from this SQLContext should be cached or not.
 boolean isCallStatement()
          Tests if the SQL for this SQLContext begins with "CALL "
 boolean isCheckCache()
          Tests if queries associated with this SQLContext should check the cache first, before going to the database.
 boolean isCheckFieldDataFileForFDs()
          Return whether or not to check the Field data file when retrieving FieldDescriptors for newly created Fields in each Row.
 boolean isDeleteStatement()
          Return whehter or not this context contains a delete statement.
 boolean isGroupByStatement()
          Check to see if this context's sql contains a group by.
 boolean isInsertStatement()
          Return whehter or not this context contains a select statement.
 boolean isResultSetRetained()
          This tells whether or not the result set for this context should be retained for future accesses.
 boolean isRowCollectionContext()
          Tests if executing this SQLContext will result in a RowCollection
 boolean isRunInBackground()
          Tests if SQL commands using this context should run in a background thread.
 boolean isSelectStatement()
          Return whehter or not this context contains a select statement.
 boolean isSourceRowPresent()
          Tests if this SQLContext contains a source row
 boolean isSystemAliasSpecified()
          This tells whether or not the connection alias for this context is specified
 boolean isUnionStatement()
          Check to see if this context's sql contains a union.
 boolean isUpdateStatement()
          Return whehter or not this context contains an update statement.
 boolean isUsePreparedStatement()
          Tests if statements run with this SQLContext should use prepared statements.
 void parameterAltered()
          Callback method so that parameters can inform their context when they are alerted
 void removeListener(IDataEngineListener listener)
          Removes a listener from this SQLContext.
 void removeTable(Table pTable)
          Adds a table to this query.
 void returnConnection()
          Frees the connection, but only if this SQLContext orginally retrieved the connection.
 void setAssociatedJoinOperationPresent(boolean ajoin)
          Sets if the RC returned by this SQLContext has one or more columns whose FD's have an associated join operation.
 SQLContext setAutoRefresh(boolean newAutoRefresh)
          Sets if RowCollections retrieved with this SQLContext should automatically refresh themselves when the DataEngine is used to update the database.
 void setBatch(boolean newBatch)
          Sets if this SQLContext should be executed in batch mode
 SQLContext setCacheResults(boolean newResultsCached)
          Sets whether or not results from a query based on this context should be cached.
 SQLContext setCachingLevel(int newCachingLevel)
          Sets the current caching level, describing whether the cache should be checked, and whether results should be stored in the cache.
 SQLContext setCachingTimeMillis(long milliseconds)
          Sets the time in milliseconds the results from executing this context are to be cached.
 SQLContext setCheckCache(boolean newCacheChecked)
          Sets whether or not queries resulting from this SQLContext should check the cache first, or go directly to the database.
 SQLContext setCheckFieldDataFileForFDs(boolean pCheckFieldDataFileForFDs)
          Sets whether or not to check the Field data file when retrieving FieldDescriptors for newly created Fields in each Row.
 void setCode(String code)
          Sets this context's code string.
 void setCode(String code, boolean shadowize)
          Sets this context's code string.
 SQLContext setConnection(Connection newConnection)
          Sets the connection for this SQLContext.
 SQLContext setFirstRowIndex(int newFirstRow)
          Insert the method's description here.
 void setParameterValue(int position, Object value, int dataType)
          Provides a value to a parameter for this context's code string.
 SQLContext setReportBreakCollection(PropertyGroupList pProperties)
          Sets the ReportBreakCollection defining the reports that will be generated in the RowCollection resulting from queries which use this SQLContext
 SQLContext setReportBreakCollection(ReportBreakCollection newReportBreakCollection)
          Sets the ReportBreakCollection defining the reports that will be generated in the RowCollection resulting from queries which use this SQLContext
 SQLContext setResultSetRetained(boolean value)
          Sets whether or not the result set for this context should be retained for future accesses.
 SQLContext setRowClass(Class newRowClass)
          Sets the type of Row objects that will be included in the RowCollection resulting from the query.
 SQLContext setRowCollection(RowCollection newRowCollection)
          Sets the RowCollection object into which retrieved rows will be inserted.
 SQLContext setRowCollectionClass(Class newRowCollectionClass)
          Sets the type of RowCollection that will contain this query's results.
 SQLContext setRowCount(int rows)
          Sets the number of rows to include in the RowCollection.
 SQLContext setRowCreator(IRowCreator newRowCreator)
          Sets the object used to create the Rows the query should return.
 void setRowValues(Row source, Row target)
          Provides values for all of this context's named parameters.
 SQLContext setRunInBackground(boolean newRunInBackground)
          Sets if SQL commands using this context should run in a background thread.
 void setSourceRow(Row newSourceRow)
          If this SQLContext is an update, insert, or delete statement which pertains to one specific row, then this method sets that row
 SQLContext setSQL(String newSQL)
          Sets the sql statement for this query.
 SQLContext setSQL(String newSQL, boolean shadowize)
          Sets the sql statement for this query.
 SQLContext setSystemAlias(String pAlias)
          Sets the system alias for the SQL operation.
 SQLContext setTables(List pTables)
          Deprecated. Pass in a TableCollection instead
 SQLContext setTables(TableCollection pTables)
          Sets the tables to this query.
 SQLContext setTitle(String pTitle)
          Sets the title of this SQLContext, which will also be the title of any RowCollections retrieved via this SQLContext
 void setUsageIdRow(Row row)
          Sets the row whose data should be used to replace literal usage id's in the SQL (indicated with a ##?)
 SQLContext setUsePreparedStatement(boolean usePS)
          Sets if statements run with this SQLContext should use prepared statements.
 void setUseWOWLibrary(short newWOWSystemLibrary)
          Sets which WOW library should be used to execute this context.
 String toString()
          Gets a String representation of this context
 
Methods inherited from class planetj.dataengine.AbstractContext
clearParameterValues, equals, getCode, getDataTimestamp, getDisplayParameters, getExecutingContext, getNavigationKey, getNavigationListKey, getOriginalCode, getParameter, getParameter, getParameterCollection, getParameterCount, getParameterCount, getParameterDisplayFields, getParameterDisplayFields, getParameters, getParameters, getParameterSource, getParameterValidationExceptions, getPropertyGroup, getPropertyGroups, getRowParameters, isCloneNeeded, isContainsDisplayParameters, isContainsParameters, isLocked, isParameterized, loadUserAndExecutingContextValues, loadUserValues, lock, removeNavigationKey, setDataTimestamp, setExecutingContext, setNavigationKey, setParameterCollection, setParameterDisplayValues, setParameterValue, setParameterValue, setParameterValues, setParameterValues
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CACHING_NONE

public static final int CACHING_NONE
This SQLContext should not use caching

See Also:
Constant Field Values

CACHING_CHECK

public static final int CACHING_CHECK
This SQLContext should check the cache instead of going to the DB if possible, but any results retrieved from the DB should not be stored in the cache

See Also:
Constant Field Values

CACHING_STORE

public static final int CACHING_STORE
This SQLContext should not check the cache, but if possible should store any data retrieved from the DB in the cache

See Also:
Constant Field Values

CACHING_CHECK_AND_STORE

public static final int CACHING_CHECK_AND_STORE
This SQLContext should check the cache instead of going to the DB if possible, and should store any data from the DB in the cache if possible. This is the logical OR of the CACHING_CHECK and CACHING_STORE constants

See Also:
Constant Field Values

className

public static final String className

ALL_ROWS

public static final int ALL_ROWS
See Also:
Constant Field Values

CACHE_EXPIRATION_TIME_NEVER

public static final int CACHE_EXPIRATION_TIME_NEVER
See Also:
Constant Field Values

CACHE_EXPIRATION_TIME_15_MINUTES

public static final int CACHE_EXPIRATION_TIME_15_MINUTES
See Also:
Constant Field Values

CACHE_EXPIRATION_TIME_30_MINUTES

public static final int CACHE_EXPIRATION_TIME_30_MINUTES
See Also:
Constant Field Values

CACHE_EXPIRATION_TIME_1_HOUR

public static final int CACHE_EXPIRATION_TIME_1_HOUR
See Also:
Constant Field Values

CACHE_EXPIRATION_TIME_1_DAY

public static final int CACHE_EXPIRATION_TIME_1_DAY
See Also:
Constant Field Values

CACHE_EXPIRATION_TIME_1_WEEK

public static final int CACHE_EXPIRATION_TIME_1_WEEK
See Also:
Constant Field Values

LIBRARY_SYSTEM

public static final short LIBRARY_SYSTEM
This statement is again the system library

See Also:
Constant Field Values

LIBRARY_USER

public static final short LIBRARY_USER
This statement is against the user library

See Also:
Constant Field Values

LIBRARY_UNKNOWN

public static final short LIBRARY_UNKNOWN
It is not known if this statement is against the user or system library. The DataEngine will decide

See Also:
Constant Field Values

LIBRARY_AS_SPECIFIED

public static final short LIBRARY_AS_SPECIFIED
This statment already has the libraries it is going against specified

See Also:
Constant Field Values
Constructor Detail

SQLContext

public SQLContext()
SQLContext constructor


SQLContext

public SQLContext(String pSystemAlias)
SQLContext constructor

Parameters:
pSystemAlias - The system alias for this SQLContext

SQLContext

public SQLContext(String pSystemAlias,
                  IUser user)
SQLContext constructor

Parameters:
pSystemAlias - The system alias for this SQLContext
Method Detail

addListener

public void addListener(IDataEngineListener listener)
Adds a listener to this SQLContext. The listener will be informed when this SQLContext is used to run a SQL statement. Usually, listeners are used when the statement is being run in the background. If the statement is not run in the background, then the listeners are all informed of the result before the DataEngine method which caused the statement to run returns.


addTable

public void addTable(Table newTable)
Adds a table to this query. Use this method to indicate which tables are being accessed by this operation.


clear

public void clear()
           throws DataEngineException
Wipes out the info in this SQLContext, restoring the default values.

Overrides:
clear in class AbstractContext
Returns:
This object.
DataEngineException

clearTables

public void clearTables()
Clears the tables to this query.


clone

public Object clone()
Creates an unlocked copy of this SQLContext

Specified by:
clone in interface INavigationObject
Overrides:
clone in class AbstractContext

cloneContext

public SQLContext cloneContext()
Creates an unlocked copy of this SQLContext


cloneContext

public SQLContext cloneContext(boolean clearExecutingContext)
Creates an unlocked copy of this SQLContext


equals

public boolean equals(Object o)
Overrides:
equals in class Object

execute

public Object execute()
               throws CMException
Executes the SQL statement contained in this context and returns the results.

Specified by:
execute in class AbstractContext
CMException

getCachingLevel

public int getCachingLevel()
Gets the current caching level, describing whether the cache should be checked, and whether results should be stored in the cache. The default is CACHING_NONE.


getCachingTimeMillis

public long getCachingTimeMillis()
Gets the amount of time in milliseconds this context's results are to be cached.

Returns:
milliseconds results are cached

getConnection

public Connection getConnection()
                         throws DataEngineException
Gets theCconnection that should be used for queries which use thix QuerContext. If no Connection has been set then a new one is taken from the pool and returned. After the caller is done using the Connection, the returnConnection() method should be invoked to free the connection. Do NOT invoke the DataBaseManager.freeConnection() method directly, as the Connection may have been set in this object in another section of code, with the expectation that the Connection will still be useable.

DataEngineException

getConnection

public Connection getConnection(boolean pCreate)
                         throws DataEngineException
Gets the connection that should be used for DataEngine operations which use this SQLContext

Parameters:
pCreate - If this is false and no connection exists, null is returned. If this is true and no Connection has been set then a new one is taken from the pool and returned. After the caller is done using the Connection, the returnConnection() method should be invoked to free the connection. Do NOT invoke the DataBaseManager.freeConnection() method directly, as the Connection may have been set in this object in another section of code, with the expectation that the Connection will still be useable.
DataEngineException

getConnectionAlias

public String getConnectionAlias()
Deprecated. Just use getSystemAlias() instead


getConnectionOwner

public Object getConnectionOwner()
If the Connection contained in this object was created in this SQLContext, then this object is returned. Otherwise, null is returned.


getFirstRowIndex

public int getFirstRowIndex()
Insert the method's description here. Creation date: (12/5/01 2:57:15 PM)

Returns:
int

getKeyContext

public SQLContext getKeyContext()
                         throws DataEngineException
Gets the SQLContext to be used as a key in the cache. This is an internal method, and should only be invoked by the caching subsystem. The idea is to return either this same object, or a clone of this object depending on who the "owner" of this object is.

DataEngineException

getLogicalFieldNames

public List getLogicalFieldNames()
Gets a List of the names of logical Fields in this SQLContext. A logical Field is a field whose value is not a single value stored in the database, but is instead the result of some operation. To specify that a logical Field should be retrieved you must prefix its name with two exclaimation points in an SQL statement. For example, the SQL:
SELECT FNAME, LNAME, !!ORDERS FROM PLANETJ.CUSTOMERS
would select three fields from the CUSTOMERS table. The ORDERS field is an logical Field, FNAME and LNAME are physical database fields. The actual SQL sent to the database would not include the orders field.

Returns:
A List containing Field.FieldLocation objects specifying the names of the logical fields in this context (or an empty List if there are no logical fields).

getMetaDataAlias

public String getMetaDataAlias()

getNumberOfTables

public int getNumberOfTables()
Gets the number of tables being queried.

Returns:
the number of tables being queried.

getPropertyGroups

public PropertyGroupList getPropertyGroups()
Get all the property groups stored in this RowCollection's attributes.

Specified by:
getPropertyGroups in interface IContext
Specified by:
getPropertyGroups in class AbstractContext

getReportBreakCollection

public ReportBreakCollection getReportBreakCollection()
Gets the ReportBreakCollection defining the reports that will be generated in the RowCollection resulting from queries which use this SQLContext


getRowClass

public Class getRowClass()
Gets the type of Row objects that will be included in the RowCollection resulting from the query. If the Row type can't be determined until after the query has been run, set a Row creator instead of a Row class.

Returns:
The Class object for the rows in the query results.

getRowCollection

public RowCollection getRowCollection()
Gets the RowCollection object into which retrieved rows will be inserted. If this is null (which is the default) then a new RowCollection object is created to hold the rows.


getRowCollectionClass

public Class getRowCollectionClass()
Gets the type of RowCollection that will contain this query's results.

Returns:
The Class object for the collection of rows in the query results.

getRowCount

public int getRowCount()
Gets the number of rows to add to the RowCollection. By default, all the rows are retrieved.


getRowCreator

public IRowCreator getRowCreator()
Gets the object used to create the Rows the query should return. By default this is blank, only change it if the type of Row that should be returned can't be determined until after the query has run.


getSafeSQL

public String getSafeSQL()
Returns this context's SQL, with all single quotes, double quotes, and backslashes replaced with underscores


getSourceRow

public Row getSourceRow()
If this SQLContext is an update, insert, or delete statement which pertains to one specific row, then this method gets that row. Otherwise null is returned.


getSQL

public String getSQL()
Gets this SQLContext's SQL String.


getSQLDeleteStatement

public DeleteStatement getSQLDeleteStatement()
Get the context's current delete statement. If the context's SQLStatement is not a delete statement, null is returned.


getSQLInsertStatement

public InsertStatement getSQLInsertStatement()
Get the context's current insert statement. If the context's SQLStatement is not an insert statement, null is returned.


getSQLParameters

public Iterator getSQLParameters()
Returns an iteration of all the ISQLParameters in this context. The Iterator cannot not be altered.


getSQLSelectStatement

public SelectStatement getSQLSelectStatement()
Get the context's current select statement. If the context's SQLStatement is not a select statement, null is returned.


getSQLStatement

public SQLStatement getSQLStatement()
Gets the SQL Statement object for this SQLContext


getSQLUpdateStatement

public UpdateStatement getSQLUpdateStatement()
Get the context's current update statement. If the context's SQLStatement is not a update statement, null is returned.


getSystemAlias

public String getSystemAlias()
Gets the system alias for the SQL operation.


getTable

public Table getTable()
Gets the table which is being queried.

Returns:
A table which is being queried. If there is more than one such table, there is no guarantee which table will be returned.

getTable

public Table getTable(int pTableIndex)
Gets the table being queried with the given index.

Returns:
A table which is being queried.

getTables

public TableCollection getTables()
Gets the tables being queried.

Returns:
A list of tables being queried.

getTimestamp

public long getTimestamp()
Gets when this SQLContext was last run


getTitle

public String getTitle()
Gets the title of this SQLContext, which will also be the title of any RowCollections retrieved via this SQLContext


getUsageIdRow

public Row getUsageIdRow()
Gets the row whose data should be used to replace literal usage id's in the SQL (indicated with a ##?)


getUseWOWLibrary

public short getUseWOWLibrary()
Tests which WOW library should be used to execute this context. The value is one of the constants defined in this class


hashCode

public int hashCode()
Overrides:
hashCode in class Object

hasListeners

public boolean hasListeners()
Tests if there are any objects listening to this SQLContext.


isAlterTableStatement

public boolean isAlterTableStatement()
Check if this context contains an alter table statement.

Returns:
true if this context contains an alter table statement; false otherwise.

isAssociatedJoinOperationPresent

public boolean isAssociatedJoinOperationPresent()
Tests if the RC returned by this SQLContext has one or more columns whose FD's have an associated join operation


isAutoRefresh

public boolean isAutoRefresh()
Tests if RowCollections retrieved with this SQLContext should automatically refresh themselves when the DataEngine is used to update the database. This property is true by default. Currently this refresh occurs only before the RowCollection is displayed to the user.


isBatch

public boolean isBatch()
Tests if this SQLContext should be executed in batch mode


isCacheResults

public boolean isCacheResults()
Tests if queries resulting from this SQLContext should be cached or not. The default is false.


isCallStatement

public boolean isCallStatement()
Tests if the SQL for this SQLContext begins with "CALL "


isCheckCache

public boolean isCheckCache()
Tests if queries associated with this SQLContext should check the cache first, before going to the database. The default is false.


isCheckFieldDataFileForFDs

public boolean isCheckFieldDataFileForFDs()
Return whether or not to check the Field data file when retrieving FieldDescriptors for newly created Fields in each Row.

Returns:
boolean.

isDeleteStatement

public boolean isDeleteStatement()
Return whehter or not this context contains a delete statement.

Returns:
boolean

isGroupByStatement

public boolean isGroupByStatement()
Check to see if this context's sql contains a group by.

Returns:
boolean

isInsertStatement

public boolean isInsertStatement()
Return whehter or not this context contains a select statement.

Returns:
boolean

isResultSetRetained

public boolean isResultSetRetained()
This tells whether or not the result set for this context should be retained for future accesses.

Returns:
boolean

isRowCollectionContext

public boolean isRowCollectionContext()
Tests if executing this SQLContext will result in a RowCollection


isRunInBackground

public boolean isRunInBackground()
Tests if SQL commands using this context should run in a background thread. If a query is set to run in the background, then all of the DataEngine.getRows() methods will return null immediately, and run the query in the background. Any of this SQLContext's listeners will be informed when the query has completed.

The DataEngine.update() methods work in a similar fashion.


isSelectStatement

public boolean isSelectStatement()
Return whehter or not this context contains a select statement.

Returns:
boolean

isSourceRowPresent

public boolean isSourceRowPresent()
Tests if this SQLContext contains a source row


isSystemAliasSpecified

public boolean isSystemAliasSpecified()
This tells whether or not the connection alias for this context is specified

Returns:
boolean

isUnionStatement

public boolean isUnionStatement()
Check to see if this context's sql contains a union.

Returns:
boolean

isUpdateStatement

public boolean isUpdateStatement()
Return whehter or not this context contains an update statement.

Returns:
boolean

isUsePreparedStatement

public boolean isUsePreparedStatement()
Tests if statements run with this SQLContext should use prepared statements.


parameterAltered

public void parameterAltered()
                      throws DataEngineException
Callback method so that parameters can inform their context when they are alerted

Specified by:
parameterAltered in interface IContext
Overrides:
parameterAltered in class AbstractContext
DataEngineException

removeListener

public void removeListener(IDataEngineListener listener)
Removes a listener from this SQLContext. If the listener hasn't been added to this SQLContext, nothing happens.


removeTable

public void removeTable(Table pTable)
Adds a table to this query. Use this method to indicate which tables are being accessed by this operation.


returnConnection

public void returnConnection()
                      throws DataEngineException
Frees the connection, but only if this SQLContext orginally retrieved the connection. If the setConntection() method was explicitly invoked, then it is the invoker's responsibility to return the connection to the pool, and this method does nothing.

DataEngineException

setAssociatedJoinOperationPresent

public void setAssociatedJoinOperationPresent(boolean ajoin)
Sets if the RC returned by this SQLContext has one or more columns whose FD's have an associated join operation. Normally this value is determined by the dataengine automatically, but you can use this method to override the default behavior.


setAutoRefresh

public SQLContext setAutoRefresh(boolean newAutoRefresh)
Sets if RowCollections retrieved with this SQLContext should automatically refresh themselves when the DataEngine is used to update the database. This is true by default. Currently this refresh occurs only before the RowCollection is displayed to the user.


setBatch

public void setBatch(boolean newBatch)
Sets if this SQLContext should be executed in batch mode


setCacheResults

public SQLContext setCacheResults(boolean newResultsCached)
Sets whether or not results from a query based on this context should be cached. The default is false. Using the cache will improve performance, but may give you stale data if the data you are retrieving is frequently updated.


setCachingLevel

public SQLContext setCachingLevel(int newCachingLevel)
Sets the current caching level, describing whether the cache should be checked, and whether results should be stored in the cache. The default is CACHING_NONE.


setCachingTimeMillis

public SQLContext setCachingTimeMillis(long milliseconds)
Sets the time in milliseconds the results from executing this context are to be cached.


setCheckCache

public SQLContext setCheckCache(boolean newCacheChecked)
Sets whether or not queries resulting from this SQLContext should check the cache first, or go directly to the database. The default is not to check the cache. Using the cache will improve performance, but may give you stale data if the data you are retrieving is frequently updated.


setCheckFieldDataFileForFDs

public SQLContext setCheckFieldDataFileForFDs(boolean pCheckFieldDataFileForFDs)
Sets whether or not to check the Field data file when retrieving FieldDescriptors for newly created Fields in each Row.

Parameters:
pCheckFieldDataFileForFDs - boolean.

setCode

public void setCode(String code)
Sets this context's code string.

Overrides:
setCode in class AbstractContext

setCode

public void setCode(String code,
                    boolean shadowize)
Sets this context's code string.

Overrides:
setCode in class AbstractContext

setConnection

public SQLContext setConnection(Connection newConnection)
                         throws DataEngineException
Sets the connection for this SQLContext. Note that you are still responsible for returning this connection to the pool when you are through with it.

Parameters:
newConnection - The connection object for this SQL context
Returns:
this object
Throws:
Thrown - if there is a problem converting the connection to a DataEngineConnection. If you pass in a DataEngineConnection, or null you don't have to worry about an exception being thrown.
DataEngineException

setFirstRowIndex

public SQLContext setFirstRowIndex(int newFirstRow)
Insert the method's description here. Creation date: (12/5/01 2:57:15 PM)

Parameters:
newFirstRow - int

setParameterValue

public final void setParameterValue(int position,
                                    Object value,
                                    int dataType)
                             throws CMException
Provides a value to a parameter for this context's code string. (If this context does not use parameters, then this method is irrelevant.) The object you pass in will be mapped to its proper data type.

Parameters:
position - The index of the parameter whose value is being supplied. The first parameter is 0, the second is 1, etc.
value - The value to give to the parameter. This value may be null. After the value is passed to this method it must never be changed. If it is possible for this value to change, you should clone it and pass a clone which will not change to this method.
dataType - The data type for the parameter whose value is being supplied.
CMException

setReportBreakCollection

public SQLContext setReportBreakCollection(ReportBreakCollection newReportBreakCollection)
Sets the ReportBreakCollection defining the reports that will be generated in the RowCollection resulting from queries which use this SQLContext


setReportBreakCollection

public SQLContext setReportBreakCollection(PropertyGroupList pProperties)
                                    throws DataEngineException
Sets the ReportBreakCollection defining the reports that will be generated in the RowCollection resulting from queries which use this SQLContext

Parameters:
pProperties - A PropertyGroupList containing properties which specify a ReportBreakCollection
DataEngineException

setResultSetRetained

public SQLContext setResultSetRetained(boolean value)
Sets whether or not the result set for this context should be retained for future accesses.

Parameters:
value - boolean If true, the result set will be retained in the row collection for future access. We will also turn all caching for this context off. If false, the row collection will not be retained.
Returns:
planetj.database.SQLContext

setRowClass

public SQLContext setRowClass(Class newRowClass)
Sets the type of Row objects that will be included in the RowCollection resulting from the query. If the Row type can't be determined until after the query has been run, set a Row creator instead of a Row class.

Parameters:
newRowClass - The type of Row objects that will be returned in the result. This class must be a subclass of planetj.database.Row. Do not pass an abstract class.

setRowCollection

public SQLContext setRowCollection(RowCollection newRowCollection)
Sets the RowCollection object into which retrieved rows will be inserted. If this is null (which is the default) then a new RowCollection object is created to hold the rows.


setRowCollectionClass

public SQLContext setRowCollectionClass(Class newRowCollectionClass)
Sets the type of RowCollection that will contain this query's results.

Parameters:
newRowCollectionClass - The Class object for the collection of rows in the query results. This class must be a subclass of the RowCollection class.

setRowCount

public SQLContext setRowCount(int rows)
Sets the number of rows to include in the RowCollection. By default, all the rows are retrieved.


setRowCreator

public SQLContext setRowCreator(IRowCreator newRowCreator)
Sets the object used to create the Rows the query should return. By default this is blank, only change it if the type of Row that should be returned can't be determined until after the query has run.


setRowValues

public void setRowValues(Row source,
                         Row target)
                  throws CMException
Provides values for all of this context's named parameters. For each named parameter, if the source Row contains a field with the same name, then the Field's value is used to set the parameter comparison's proper field in the target Row. Unnamed parameters are ignored.

CMException

setRunInBackground

public SQLContext setRunInBackground(boolean newRunInBackground)
Sets if SQL commands using this context should run in a background thread. If a query is set to run in the background, then all of the DataEngine.getRows() methods will return null immediately, and run the query in the background. Any listeners will be informed when the query has completed.

The DataEngine.update() methods work in a similar fashion.


setSourceRow

public void setSourceRow(Row newSourceRow)
If this SQLContext is an update, insert, or delete statement which pertains to one specific row, then this method sets that row


setSQL

public SQLContext setSQL(String newSQL)
Sets the sql statement for this query.


setSQL

public SQLContext setSQL(String newSQL,
                         boolean shadowize)
Sets the sql statement for this query.


setSystemAlias

public SQLContext setSystemAlias(String pAlias)
Sets the system alias for the SQL operation. You don't need to set this if you set either the table or the statement instead.


setTables

public SQLContext setTables(List pTables)
Deprecated. Pass in a TableCollection instead

Sets the tables to this query. Use this method to indicate which tables are being accessed by this operation.


setTables

public SQLContext setTables(TableCollection pTables)
Sets the tables to this query. Use this method to indicate which tables are being accessed by this operation.


setTitle

public SQLContext setTitle(String pTitle)
Sets the title of this SQLContext, which will also be the title of any RowCollections retrieved via this SQLContext


setUsageIdRow

public void setUsageIdRow(Row row)
Sets the row whose data should be used to replace literal usage id's in the SQL (indicated with a ##?)


setUsePreparedStatement

public SQLContext setUsePreparedStatement(boolean usePS)
Sets if statements run with this SQLContext should use prepared statements.


setUseWOWLibrary

public void setUseWOWLibrary(short newWOWSystemLibrary)
Sets which WOW library should be used to execute this context. The value is one of the constants defined in this class.


toString

public String toString()
Gets a String representation of this context

Overrides:
toString in class AbstractContext