org.gusdb.wdk.model
Class ResultFactory

java.lang.Object
  extended by org.gusdb.wdk.model.ResultFactory

public class ResultFactory
extends java.lang.Object

How the QueryInstance table works. A QueryInstance is "persistent" (ie, a row is added, and a result table is created), if any of these applies (in priority order): - the query is cacheable - the "cached" bit is set - dispose of row/resultTable when whole cache is dropped (new - the query will be in the history (even if not cacheable, to provide a stable history, ie, results don't change even if the db did) - dispose of row/resultTable when user's history is purged - the query is being used in a boolean operation - this depends on the query being in the history A row in QueryInstance is, by definition, persistent. If its "cacheable" flag is on, its cacheable. If not, it is still available to the history. We can think of "cacheability" as "shared for all users."


Field Summary
static java.lang.String RESULT_TABLE_I
           
 
Constructor Summary
ResultFactory(RDBMSPlatformI platform, java.lang.String schemaName, java.lang.String instanceTableName)
           
 
Method Summary
 void createCache(int numParams, boolean noSchemaOutput)
           
 void dropCache(boolean noSchemaOutput)
          Drop all tables and sequences associated with the cache
 ResultList getPersistentResultPage(QueryInstance instance, int startRow, int endRow)
           
 ResultList getResult(QueryInstance instance)
           
 java.lang.String getResultAsTableName(QueryInstance instance)
           
 java.lang.String getSqlForCache(QueryInstance instance)
           
static void main(java.lang.String[] args)
           
 void resetCache(boolean noSchemaOutput)
          Remove all cached entries; it first deletes all the temporary tables (found by querying the Queries table) and then deletes all of its rows from the Queries table.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESULT_TABLE_I

public static final java.lang.String RESULT_TABLE_I
See Also:
Constant Field Values
Constructor Detail

ResultFactory

public ResultFactory(RDBMSPlatformI platform,
                     java.lang.String schemaName,
                     java.lang.String instanceTableName)
Method Detail

getResult

public ResultList getResult(QueryInstance instance)
                     throws WdkModelException
Throws:
WdkModelException

getPersistentResultPage

public ResultList getPersistentResultPage(QueryInstance instance,
                                          int startRow,
                                          int endRow)
                                   throws WdkModelException
Throws:
WdkModelException

getResultAsTableName

public java.lang.String getResultAsTableName(QueryInstance instance)
                                      throws WdkModelException
Returns:
Full name of table containing result
Throws:
WdkModelException

getSqlForCache

public java.lang.String getSqlForCache(QueryInstance instance)
                                throws WdkModelException
Throws:
WdkModelException

createCache

public void createCache(int numParams,
                        boolean noSchemaOutput)
                 throws WdkModelException
Parameters:
numParams - Number of parameters allowed in a cached query
Throws:
WdkModelException

resetCache

public void resetCache(boolean noSchemaOutput)
                throws WdkModelException
Remove all cached entries; it first deletes all the temporary tables (found by querying the Queries table) and then deletes all of its rows from the Queries table. This is *not* transaction safe. A better way would be to copy the names of the result tables to a "dropThese" table and delete the associated rows in the cache table both within one transaction; then separately, as a post-process, drop the tables in the dropThese table.

Throws:
WdkModelException

dropCache

public void dropCache(boolean noSchemaOutput)
               throws WdkModelException
Drop all tables and sequences associated with the cache

Throws:
WdkModelException

main

public static void main(java.lang.String[] args)