|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--planetj.dataengine.AbstractContext | +--planetj.database.SQLContext
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.
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 java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int CACHING_NONE
public static final int CACHING_CHECK
public static final int CACHING_STORE
public static final int CACHING_CHECK_AND_STORE
public static final String className
public static final int ALL_ROWS
public static final int CACHE_EXPIRATION_TIME_NEVER
public static final int CACHE_EXPIRATION_TIME_15_MINUTES
public static final int CACHE_EXPIRATION_TIME_30_MINUTES
public static final int CACHE_EXPIRATION_TIME_1_HOUR
public static final int CACHE_EXPIRATION_TIME_1_DAY
public static final int CACHE_EXPIRATION_TIME_1_WEEK
public static final short LIBRARY_SYSTEM
public static final short LIBRARY_USER
public static final short LIBRARY_UNKNOWN
public static final short LIBRARY_AS_SPECIFIED
Constructor Detail |
public SQLContext()
public SQLContext(String pSystemAlias)
pSystemAlias
- The system alias for this SQLContextpublic SQLContext(String pSystemAlias, IUser user)
pSystemAlias
- The system alias for this SQLContextMethod Detail |
public void addListener(IDataEngineListener listener)
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.
public void addTable(Table newTable)
public void clear() throws DataEngineException
clear
in class AbstractContext
DataEngineException
public void clearTables()
public Object clone()
clone
in interface INavigationObject
clone
in class AbstractContext
public SQLContext cloneContext()
public SQLContext cloneContext(boolean clearExecutingContext)
public boolean equals(Object o)
equals
in class Object
public Object execute() throws CMException
execute
in class AbstractContext
CMException
public int getCachingLevel()
public long getCachingTimeMillis()
public Connection getConnection() throws DataEngineException
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
public Connection getConnection(boolean pCreate) throws DataEngineException
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
public String getConnectionAlias()
public Object getConnectionOwner()
public int getFirstRowIndex()
public SQLContext getKeyContext() throws DataEngineException
DataEngineException
public List getLogicalFieldNames()
SELECT FNAME, LNAME, !!ORDERS FROM PLANETJ.CUSTOMERS
public String getMetaDataAlias()
public int getNumberOfTables()
public PropertyGroupList getPropertyGroups()
getPropertyGroups
in interface IContext
getPropertyGroups
in class AbstractContext
public ReportBreakCollection getReportBreakCollection()
public Class getRowClass()
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.
public RowCollection getRowCollection()
public Class getRowCollectionClass()
RowCollection
that will contain this query's results.
public int getRowCount()
public IRowCreator getRowCreator()
public String getSafeSQL()
public Row getSourceRow()
public String getSQL()
public DeleteStatement getSQLDeleteStatement()
public InsertStatement getSQLInsertStatement()
public Iterator getSQLParameters()
public SelectStatement getSQLSelectStatement()
public SQLStatement getSQLStatement()
public UpdateStatement getSQLUpdateStatement()
public String getSystemAlias()
public Table getTable()
public Table getTable(int pTableIndex)
public TableCollection getTables()
public long getTimestamp()
public String getTitle()
public Row getUsageIdRow()
public short getUseWOWLibrary()
public int hashCode()
hashCode
in class Object
public boolean hasListeners()
public boolean isAlterTableStatement()
public boolean isAssociatedJoinOperationPresent()
public boolean isAutoRefresh()
public boolean isBatch()
public boolean isCacheResults()
public boolean isCallStatement()
public boolean isCheckCache()
public boolean isCheckFieldDataFileForFDs()
public boolean isDeleteStatement()
public boolean isGroupByStatement()
public boolean isInsertStatement()
public boolean isResultSetRetained()
public boolean isRowCollectionContext()
public boolean isRunInBackground()
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.DataEngine.update()
methods work in a similar fashion.
public boolean isSelectStatement()
public boolean isSourceRowPresent()
public boolean isSystemAliasSpecified()
public boolean isUnionStatement()
public boolean isUpdateStatement()
public boolean isUsePreparedStatement()
public void parameterAltered() throws DataEngineException
parameterAltered
in interface IContext
parameterAltered
in class AbstractContext
DataEngineException
public void removeListener(IDataEngineListener listener)
public void removeTable(Table pTable)
public void returnConnection() throws DataEngineException
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
public void setAssociatedJoinOperationPresent(boolean ajoin)
public SQLContext setAutoRefresh(boolean newAutoRefresh)
public void setBatch(boolean newBatch)
public SQLContext setCacheResults(boolean newResultsCached)
public SQLContext setCachingLevel(int newCachingLevel)
public SQLContext setCachingTimeMillis(long milliseconds)
public SQLContext setCheckCache(boolean newCacheChecked)
public SQLContext setCheckFieldDataFileForFDs(boolean pCheckFieldDataFileForFDs)
pCheckFieldDataFileForFDs
- boolean.public void setCode(String code)
setCode
in class AbstractContext
public void setCode(String code, boolean shadowize)
setCode
in class AbstractContext
public SQLContext setConnection(Connection newConnection) throws DataEngineException
newConnection
- The connection object for this SQL context
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
public SQLContext setFirstRowIndex(int newFirstRow)
newFirstRow
- intpublic final void setParameterValue(int position, Object value, int dataType) throws CMException
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
public SQLContext setReportBreakCollection(ReportBreakCollection newReportBreakCollection)
public SQLContext setReportBreakCollection(PropertyGroupList pProperties) throws DataEngineException
pProperties
- A PropertyGroupList containing properties which specify a
ReportBreakCollection
DataEngineException
public SQLContext setResultSetRetained(boolean value)
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.
public SQLContext setRowClass(Class newRowClass)
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.
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.public SQLContext setRowCollection(RowCollection newRowCollection)
public SQLContext setRowCollectionClass(Class newRowCollectionClass)
RowCollection
that will contain this query's results.
newRowCollectionClass
- The Class object for the collection of rows in the query results. This class must
be a subclass of the RowCollection
class.public SQLContext setRowCount(int rows)
public SQLContext setRowCreator(IRowCreator newRowCreator)
public void setRowValues(Row source, Row target) throws CMException
CMException
public SQLContext setRunInBackground(boolean newRunInBackground)
DataEngine.getRows()
methods will
return null immediately, and run the query in the background. Any
listeners
will be informed when the query has completed.DataEngine.update()
methods work in a similar fashion.
public void setSourceRow(Row newSourceRow)
public SQLContext setSQL(String newSQL)
public SQLContext setSQL(String newSQL, boolean shadowize)
public SQLContext setSystemAlias(String pAlias)
public SQLContext setTables(List pTables)
public SQLContext setTables(TableCollection pTables)
public SQLContext setTitle(String pTitle)
public void setUsageIdRow(Row row)
public SQLContext setUsePreparedStatement(boolean usePS)
public void setUseWOWLibrary(short newWOWSystemLibrary)
public String toString()
toString
in class AbstractContext
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |