Class ObjectStoreInterMineImpl

    • Field Detail

      • log

        protected java.io.Writer log
      • logTableConnection

        protected java.sql.Connection logTableConnection
      • logTableBatch

        protected Batch logTableBatch
      • logTableName

        protected java.lang.String logTableName
      • logEverything

        protected boolean logEverything
      • statsBagTableTime

        protected long statsBagTableTime
      • statsGenTime

        protected long statsGenTime
      • statsOptTime

        protected long statsOptTime
      • statsEstTime

        protected long statsEstTime
      • statsExeTime

        protected long statsExeTime
      • statsConTime

        protected long statsConTime
      • verboseQueryLog

        protected boolean verboseQueryLog
      • logBeforeExecute

        protected boolean logBeforeExecute
      • sequenceBase

        protected int sequenceBase
      • sequenceOffset

        protected int sequenceOffset
      • logExplains

        protected boolean logExplains
      • disableResultsCache

        protected boolean disableResultsCache
      • minBagTableSize

        protected int minBagTableSize
      • bagConstraintTables

        protected java.util.Map<java.lang.Object,​java.lang.String> bagConstraintTables
      • goFasterCountMap

        protected java.util.Map<Query,​java.lang.Integer> goFasterCountMap
      • bagTablesToRemove

        protected java.lang.ref.ReferenceQueue<java.lang.String> bagTablesToRemove
      • description

        protected java.lang.String description
      • resultsCache

        protected java.util.Map<java.lang.String,​Results> resultsCache
      • singletonResultsCache

        protected java.util.Map<java.lang.String,​SingletonResults> singletonResultsCache
      • batchesCache

        protected java.util.Map<java.lang.String,​java.util.Map<java.lang.Integer,​ResultsBatches>> batchesCache
      • UNIQUE_INTEGER_SEQUENCE_NAME

        public static final java.lang.String UNIQUE_INTEGER_SEQUENCE_NAME
        The name of the SEQUENCE in the database to use when generating unique integers in getUniqueInteger().
        See Also:
        Constant Field Values
      • INT_BAG_TABLE_NAME

        public static final java.lang.String INT_BAG_TABLE_NAME
        The name of the table that holds the integer ObjectStoreBag elements.
        See Also:
        Constant Field Values
      • BAGID_COLUMN

        public static final java.lang.String BAGID_COLUMN
        The name of the bagid column in the osbag table.
        See Also:
        Constant Field Values
      • BAGVAL_COLUMN

        public static final java.lang.String BAGVAL_COLUMN
        The name of the value column in the osbag table.
        See Also:
        Constant Field Values
      • CLOB_TABLE_NAME

        public static final java.lang.String CLOB_TABLE_NAME
        The name of the table that stores Clobs.
        See Also:
        Constant Field Values
      • CLOBID_COLUMN

        public static final java.lang.String CLOBID_COLUMN
        The name of the clobid column in the clob table.
        See Also:
        Constant Field Values
      • CLOBPAGE_COLUMN

        public static final java.lang.String CLOBPAGE_COLUMN
        The name of the page number column in the clob table.
        See Also:
        Constant Field Values
      • CLOBVAL_COLUMN

        public static final java.lang.String CLOBVAL_COLUMN
        The name of the value column in the clob table.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ObjectStoreInterMineImpl

        protected ObjectStoreInterMineImpl​(Model model)
        Constructs an ObjectStoreInterMineImpl - for use by the ObjectStoreWriter only!
        Parameters:
        model - the model
        Throws:
        java.lang.NullPointerException - if model is null
        java.lang.IllegalArgumentException - if model is invalid
      • ObjectStoreInterMineImpl

        protected ObjectStoreInterMineImpl​(Database db,
                                           DatabaseSchema schema)
        Constructs an ObjectStoreInterMineImpl, with a schema.
        Parameters:
        db - the database in which the model resides
        schema - the schema
        Throws:
        java.lang.NullPointerException - if db or model are null
        java.lang.IllegalArgumentException - if db or model are invalid
    • Method Detail

      • getSchema

        public DatabaseSchema getSchema()
        Returns the DatabaseSchema used by this ObjectStore.
        Returns:
        a DatabaseSchema
      • getDatabase

        public Database getDatabase()
        Returns the Database used by this ObjectStore
        Returns:
        the db
      • everOptimise

        public boolean everOptimise()
        Returns whether optimisation should be permitted. For the ObjectStore, this will always be true, but for the ObjectStoreWriter, it may be false if there is written data that has not been committed yet.
        Returns:
        a boolean
      • getConnection

        public java.sql.Connection getConnection()
                                          throws java.sql.SQLException
        Returns a Connection. Please put them back. Whenever you receive a connection from the object-store, you MUST release its resources by calling releaseConnection. Failure to do so KILLS THE OBJECT STORE!
        Returns:
        a java.sql.Connection
        Throws:
        java.sql.SQLException - if there is a problem with that
      • performUnsafeOperation

        public <T> T performUnsafeOperation​(java.lang.String sql,
                                            SQLOperation<T> operation)
                                     throws java.sql.SQLException
        Convenience wrapper to manage the boilerplate when performing unsafe operations.
        Type Parameters:
        T - The type of thing to return.
        Parameters:
        sql - The sql to perform this operation.
        operation - The operation to perform with the prepared statement.
        Returns:
        A T of some kind
        Throws:
        java.sql.SQLException - if there is a problem running the query.
      • releaseConnection

        public void releaseConnection​(java.sql.Connection c)
        Allows one to put a connection back.
        Parameters:
        c - a Connection
      • getInstance

        public static ObjectStoreInterMineImpl getInstance​(java.lang.String osAlias,
                                                           java.util.Properties props)
                                                    throws ObjectStoreException
        Gets a ObjectStoreInterMineImpl instance for the given underlying properties
        Parameters:
        osAlias - the alias of this objectstore
        props - The properties used to configure a InterMine-based objectstore
        Returns:
        the ObjectStoreInterMineImpl for this repository
        Throws:
        java.lang.IllegalArgumentException - if props or model are invalid
        ObjectStoreException - if there is any problem with the instance
      • getLog

        public java.io.Writer getLog()
        Returns the log used by this objectstore.
        Returns:
        the log
      • setLog

        public void setLog​(java.io.Writer log)
        Set the log writer
        Parameters:
        log - the log
      • setLogTableName

        public void setLogTableName​(java.lang.String tableName)
                             throws java.sql.SQLException
        Allows the log table name to be set in this objectstore.
        Parameters:
        tableName - the table name
        Throws:
        java.sql.SQLException - if something goes wrong
      • setLogEverything

        public void setLogEverything​(boolean logEverything)
        Sets the logEverything configuration option.
        Parameters:
        logEverything - a boolean
      • getLogEverything

        public boolean getLogEverything()
        Gets the logEverything configuration option.
        Returns:
        a boolean
      • setVerboseQueryLog

        public void setVerboseQueryLog​(boolean verboseQueryLog)
        Sets the verboseQueryLog configuration option.
        Parameters:
        verboseQueryLog - a boolean
      • getVerboseQueryLog

        public boolean getVerboseQueryLog()
        Gets the verboseQueryLog configuration option.
        Returns:
        a boolean
      • setLogExplains

        public void setLogExplains​(boolean logExplains)
        Sets the logExplains configuration option.
        Parameters:
        logExplains - a boolean
      • getLogExplains

        public boolean getLogExplains()
        Gets the logExplains configuration option.
        Returns:
        a boolean
      • setLogBeforeExecute

        public void setLogBeforeExecute​(boolean logBeforeExecute)
        Sets the logBeforeExecute configuration option.
        Parameters:
        logBeforeExecute - a boolean
      • getLogBeforeExecute

        public boolean getLogBeforeExecute()
        Gets the logBeforeExecute configuration option.
        Returns:
        a boolean
      • setDisableResultsCache

        public void setDisableResultsCache​(boolean disableResultsCache)
        Sets the disableResultsCache configuration option.
        Parameters:
        disableResultsCache - a boolean
      • getDisableResultsCache

        public boolean getDisableResultsCache()
        Gets the disableResultsCache configuration option.
        Returns:
        a boolean
      • flushLogTable

        public void flushLogTable()
        Allows the log table to be flushed, guaranteeing that all log entries are committed to the database.
      • dbLog

        protected void dbLog​(long optimise,
                             long estimated,
                             long execute,
                             long permitted,
                             long convert,
                             Query q,
                             java.lang.String sql)
        Produce an entry in the DB log.
        Parameters:
        optimise - the number of milliseconds used to optimise the query
        estimated - the estimated number of milliseconds required to run the query
        execute - the number of milliseconds spent executing the query
        permitted - an acceptable number of milliseconds for the query to take
        convert - the number of milliseconds spent converting the results
        q - the Query run
        sql - the SQL string executed
      • setMinBagTableSize

        public void setMinBagTableSize​(int minBagTableSize)
        Set the cutoff value used to decide if a bag should be put in a table.
        Parameters:
        minBagTableSize - don't use a table to represent bags if the bag is smaller than this value
      • getMinBagTableSize

        public int getMinBagTableSize()
        Returns the cutoff value used to decide if a bag should be put in a table.
        Returns:
        an int
      • execute

        public Results execute​(Query q,
                               int batchSize,
                               boolean optimise,
                               boolean explain,
                               boolean prefetch)
        Execute a Query on this ObjectStore
        Specified by:
        execute in interface ObjectStore
        Overrides:
        execute in class ObjectStoreAbstractImpl
        Parameters:
        q - the Query to execute
        batchSize - the batch size to initialise the Results object with
        optimise - whether to optimise queries
        explain - whether to explain queries
        prefetch - whether to use the PrefetchManager
        Returns:
        the results of the Query
      • executeSingleton

        public SingletonResults executeSingleton​(Query q,
                                                 int batchSize,
                                                 boolean optimise,
                                                 boolean explain,
                                                 boolean prefetch)
        Execute a Query on this ObjectStore, returning a SingletonResults
        Specified by:
        executeSingleton in interface ObjectStore
        Overrides:
        executeSingleton in class ObjectStoreAbstractImpl
        Parameters:
        q - the Query to execute
        batchSize - the batch size to initialise the Results object with
        optimise - whether to optimise queries
        explain - whether to explain queries
        prefetch - whether to use the PrefetchManager
        Returns:
        the results of the Query
      • registerRequestId

        public void registerRequestId​(java.lang.Object id)
                               throws ObjectStoreException
        This method registers a Thread with a request ID.
        Parameters:
        id - the request ID
        Throws:
        ObjectStoreException - if this Thread is already registered
      • deregisterRequestId

        public void deregisterRequestId​(java.lang.Object id)
                                 throws ObjectStoreException
        This method deregisters a Thread from a request ID.
        Parameters:
        id - the request ID
        Throws:
        ObjectStoreException - if the Thread is not registered with this ID
      • registerStatement

        protected void registerStatement​(java.sql.Statement s)
                                  throws ObjectStoreException
        This method registers a Statement with the current Thread's request ID, or throws an exception if that request is black-listed, or does nothing if no request ID is present for this Thread.
        Parameters:
        s - a Statement
        Throws:
        ObjectStoreException - if the request is black-listed
      • cancelRequest

        public void cancelRequest​(java.lang.Object id)
                           throws ObjectStoreException
        This method cancels any Statement running in a given request ID, and blacklists that ID.
        Parameters:
        id - the request ID
        Throws:
        ObjectStoreException - if the cancel fails
      • deregisterStatement

        protected void deregisterStatement​(java.sql.Statement s)
                                    throws ObjectStoreException
        This method deregisters a Statement for the request ID of the current thread.
        Parameters:
        s - a Statement
        Throws:
        ObjectStoreException - if this Thread does not have this Statement registered
      • execute

        public java.util.List<ResultsRow<java.lang.Object>> execute​(Query q,
                                                                    int start,
                                                                    int limit,
                                                                    boolean optimise,
                                                                    boolean explain,
                                                                    java.util.Map<java.lang.Object,​java.lang.Integer> sequence)
                                                             throws ObjectStoreException
        Execute a Query on this ObjectStore, asking for a certain range of rows to be returned. This will usually only be called by the Results object returned from execute(Query q).
        Specified by:
        execute in interface ObjectStore
        Parameters:
        q - the Query to execute
        start - the start row
        limit - the maximum number of rows to return
        optimise - true if it is expected that optimising the query will improve performance
        explain - true if the ObjectStore should enforce maximum query running time constraints
        sequence - an object representing the state of the database corresponding to when the action that resulted in this execute was started. This number must match the ObjectStore's internal sequence number or a DataChangedException is thrown. The sequence number is incremented each time the data in the objectstore is changed
        Returns:
        a List of ResultRows
        Throws:
        ObjectStoreException - if an error occurs during the running of the Query
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides Object.finalize - release the DB log connection.
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable - never
      • doFinalise

        protected void doFinalise()
        Finalise this object.
      • shutdown

        public void shutdown()
        Called by the ShutdownHook on shutdown.
        Specified by:
        shutdown in interface Shutdownable
      • executeWithConnection

        protected java.util.List<ResultsRow<java.lang.Object>> executeWithConnection​(java.sql.Connection c,
                                                                                     Query q,
                                                                                     int start,
                                                                                     int limit,
                                                                                     boolean optimise,
                                                                                     boolean explain,
                                                                                     java.util.Map<java.lang.Object,​java.lang.Integer> sequence)
                                                                              throws ObjectStoreException
        Performs the actual execute, given a Connection.
        Parameters:
        c - the Connection
        q - the Query
        start - the start row number (inclusive, from zero)
        limit - maximum number of rows to return
        optimise - boolean
        explain - boolean
        sequence - object representing database state
        Returns:
        a List of ResultRow objects
        Throws:
        ObjectStoreException - sometimes
      • executeWithConnection

        protected java.util.List<ResultsRow<java.lang.Object>> executeWithConnection​(java.sql.Connection c,
                                                                                     Query q,
                                                                                     int start,
                                                                                     int limit,
                                                                                     boolean optimise,
                                                                                     boolean explain,
                                                                                     java.util.Map<java.lang.Object,​java.lang.Integer> sequence,
                                                                                     java.util.Set<PrecomputedTable> goFasterTables,
                                                                                     OptimiserCache goFasterCache)
                                                                              throws ObjectStoreException
        Performs the actual execute, given a Connection.
        Parameters:
        c - the Connection
        q - the Query
        start - the start row number (inclusive, from zero)
        limit - maximum number of rows to return
        optimise - boolean
        explain - boolean
        sequence - object representing database state
        goFasterTables - a Set of PrecomputedTables that can help with the query
        goFasterCache - an OptimiserCache that can help with the query
        Returns:
        a List of ResultRow objects
        Throws:
        ObjectStoreException - sometimes
      • generateSql

        protected java.lang.String generateSql​(java.sql.Connection c,
                                               Query q,
                                               int start,
                                               int limit)
                                        throws ObjectStoreException
        Create temporary tables for the bag in the BagConstraints of the given Query, then call SqlGenerator.generate().
        Parameters:
        c - a Connection to use
        q - the Query
        start - the start row number (inclusive, from zero)
        limit - maximum number of rows to return
        Returns:
        the SQL for the Query
        Throws:
        ObjectStoreException - if an error occurs
      • generateSqlForCount

        protected java.lang.String generateSqlForCount​(java.sql.Connection c,
                                                       Query q)
                                                throws ObjectStoreException
        Generate SQL only for counting; no need to order by and no need to calculate LIMIT and OFFSET Create temporary tables for the bag in the BagConstraints of the given Query, then call directly SqlGenerator.generate() using as Query type the value QUERY_FOR_COUNTING
        Parameters:
        c - a Connection to use
        q - the Query
        Returns:
        the SQL for the Query
        Throws:
        ObjectStoreException - if an error occurs
      • createTempBagTables

        protected void createTempBagTables​(java.sql.Connection c,
                                           Query q)
                                    throws ObjectStoreException
        Create temporary tables for use with Query that use bags. Each BagConstraint in the Query is examined and a temporary table containing values of the appropriate type from the bag is created. The new table names will be the values of the bagConstraintTables Map and the BagConstraint references will be the keys.
        Parameters:
        c - a Connection to use
        q - the Query
        Throws:
        ObjectStoreException - if there is a error in the ObjectStore
      • createTempBagTable

        protected ObjectStoreInterMineImpl.BagTableToRemove createTempBagTable​(java.sql.Connection c,
                                                                               ConstraintWithBag bagConstraint,
                                                                               boolean log,
                                                                               java.lang.String text)
                                                                        throws java.sql.SQLException
        Creates a temporary bag table for the given BagConstraint.
        Parameters:
        c - a Connection
        bagConstraint - a BagConstraint
        log - true to log this action
        text - extra data to place in the log
        Returns:
        a BagTableToRemove object
        Throws:
        java.sql.SQLException - if an error occurs
      • createTempBagTable

        protected ObjectStoreInterMineImpl.BagTableToRemove createTempBagTable​(java.sql.Connection c,
                                                                               QueryClassBag qcb,
                                                                               boolean log,
                                                                               java.lang.String text)
                                                                        throws java.sql.SQLException
        Creates a temporary bag table for the given QueryClassBag.
        Parameters:
        c - a Connection
        qcb - a QueryClassBag
        log - true to log this action
        text - extra data to place in the log
        Returns:
        a BagTableToRemove object
        Throws:
        java.sql.SQLException - if an error occurs
      • flushOldTempBagTables

        public void flushOldTempBagTables​(java.sql.Connection c)
        Removes any temporary bag tables that are no longer reachable.
        Parameters:
        c - the Connection to use
      • removeTempBagTable

        protected void removeTempBagTable​(java.sql.Connection c,
                                          ObjectStoreInterMineImpl.BagTableToRemove bttr)
        Removes a temporary bag table, given a BagTableToRemove object.
        Parameters:
        c - the Connection to use
        bttr - the BagTableToRemove object
      • estimateWithConnection

        protected ResultsInfo estimateWithConnection​(java.sql.Connection c,
                                                     Query q)
                                              throws ObjectStoreException
        Runs an EXPLAIN for the given query.
        Parameters:
        c - the Connection
        q - the Query to explain
        Returns:
        parsed results of EXPLAIN
        Throws:
        ObjectStoreException - if an error occurs explaining the query
      • count

        public int count​(Query q,
                         java.util.Map<java.lang.Object,​java.lang.Integer> sequence)
                  throws ObjectStoreException
        Counts the number of rows the query will produce
        Specified by:
        count in interface ObjectStore
        Parameters:
        q - InterMine Query on which to count rows
        sequence - an object representing the state of the database corresponding to when the action that resulted in this execute was started. This number must match the ObjectStore's internal sequence number or a DataChangedException is thrown. The sequence number is incremented each time the data in the objectstore is changed
        Returns:
        the number of rows that will be produced by query
        Throws:
        ObjectStoreException - if an error occurs counting the query
      • countWithConnection

        protected int countWithConnection​(java.sql.Connection c,
                                          Query q,
                                          java.util.Map<java.lang.Object,​java.lang.Integer> sequence)
                                   throws ObjectStoreException
        Counts the results in a query, given a Connection.
        Parameters:
        c - the Connection
        q - the Query
        sequence - int
        Returns:
        an int
        Throws:
        ObjectStoreException - sometimes
      • databaseAltered

        public void databaseAltered​(java.util.Set<java.lang.Object> tablesAltered)
        Internal method called by the ObjectStoreWriter, to notify the ObjectStore that some of the data in the database has changed.
        Parameters:
        tablesAltered - a Set of table names that may have been altered
      • flushObjectById

        public void flushObjectById()
        Completely empties the getObjectById cache. The objectstore must guarantee that the next time any object is mentioned, it must not be taken from the cache.
        Specified by:
        flushObjectById in interface ObjectStore
        Overrides:
        flushObjectById in class ObjectStoreAbstractImpl
      • internalGetObjectById

        protected InterMineObject internalGetObjectById​(java.lang.Integer id,
                                                        java.lang.Class<? extends InterMineObject> clazz)
                                                 throws ObjectStoreException
        Internal service method for getObjectById. This method is overridden in order to improve the performance of the operation - this implementation does not bother with the EXPLAIN call to the underlying SQL database.
        Overrides:
        internalGetObjectById in class ObjectStoreAbstractImpl
        Parameters:
        id - the ID of the object to get
        clazz - a class of the object
        Returns:
        an object from the database
        Throws:
        ObjectStoreException - if an error occurs during the running of the Query
      • internalGetObjectByIdWithConnection

        protected InterMineObject internalGetObjectByIdWithConnection​(java.sql.Connection c,
                                                                      java.lang.Integer id,
                                                                      java.lang.Class<?> clazz)
                                                               throws ObjectStoreException
        Gets an object by id given a Connection.
        Parameters:
        c - the Connection
        id - the id
        clazz - a Class of the object
        Returns:
        the object
        Throws:
        ObjectStoreException - if an error occurs
      • isMultiConnection

        public boolean isMultiConnection()
        Return whether or not this ObjectStore gives a performance improvement when multiple simultaneous are made. Note that ALL Objectstore must be multi-threading safe. If this method returns true, then the ObjectStore probably handles multiple connections to the database. The Results class uses this to work out whether or not to do prefetching.
        Specified by:
        isMultiConnection in interface ObjectStore
        Returns:
        true if one should do multiple simultaneous operations
      • precompute

        public java.util.List<java.lang.String> precompute​(Query q,
                                                           java.lang.String category)
                                                    throws ObjectStoreException
        Creates precomputed tables for the given query.
        Parameters:
        q - the Query for which to create the precomputed tables
        category - a String describing the category of the precomputed tables
        Returns:
        the names of the new precomputed tables
        Throws:
        ObjectStoreException - if anything goes wrong
      • precompute

        public java.util.List<java.lang.String> precompute​(Query q,
                                                           boolean allFields,
                                                           java.lang.String category)
                                                    throws ObjectStoreException
        Creates precomputed tables for the given query.
        Parameters:
        q - the Query for which to create the precomputed tables
        allFields - true if all fields of QueryClasses in the SELECT list should be included in the precomputed table's SELECT list.
        category - a String describing the category of the precomputed tables
        Returns:
        the names of the new precomputed tables
        Throws:
        ObjectStoreException - if anything goes wrong
      • precompute

        public java.util.List<java.lang.String> precompute​(Query q,
                                                           java.util.Collection<? extends QueryNode> indexes,
                                                           java.lang.String category)
                                                    throws ObjectStoreException
        Creates precomputed tables for the given query.
        Parameters:
        q - the Query for which to create the precomputed tables
        indexes - a Collection of QueryNode for which to create indexes
        category - a String describing the category of the precomputed tables
        Returns:
        the names of the new precomputed tables
        Throws:
        ObjectStoreException - if anything goes wrong
      • precompute

        public java.util.List<java.lang.String> precompute​(Query q,
                                                           java.util.Collection<? extends QueryNode> indexes,
                                                           boolean allFields,
                                                           java.lang.String category)
                                                    throws ObjectStoreException
        Creates precomputed tables for the given query.
        Parameters:
        q - the Query for which to create the precomputed tables
        indexes - a Collection of QueryNodes for which to create indexes
        allFields - true if all fields of QueryClasses in the SELECT list should be included in the precomputed table's SELECT list. If the indexes parameter is null, then indexes will be created for every field as well
        category - a String describing the category of the precomputed tables
        Returns:
        the names of the new precomputed tables
        Throws:
        ObjectStoreException - if anything goes wrong
      • precomputeWithConnection

        public java.util.List<java.lang.String> precomputeWithConnection​(java.sql.Connection c,
                                                                         Query q,
                                                                         java.util.Collection<? extends QueryNode> indexes,
                                                                         boolean allFields,
                                                                         java.lang.String category)
                                                                  throws ObjectStoreException
        Creates precomputed tables with the given query and connection.
        Parameters:
        c - the Connection
        q - the Query
        indexes - a Collection of QueryNodes for which to create indexes - they must all exist in the SELECT list of the query
        allFields - true if all fields of QueryClasses in the SELECT list should be included in the precomputed table's SELECT list. If the indexes parameter is null, then indexes will be created for every field as well
        category - a String describing the category of the precomputed tables
        Returns:
        the names of the new precomputed tables
        Throws:
        ObjectStoreException - if anything goes wrong
      • isPrecomputed

        public boolean isPrecomputed​(Query query,
                                     java.lang.String type)
                              throws ObjectStoreException
        Checks if a query is precomputed or not for the given type
        Parameters:
        query - the query
        type - the type
        Returns:
        true if and only if the given query is (already) precomputed
        Throws:
        ObjectStoreException - if the is a database problem
      • isPrecomputedWithConnection

        public boolean isPrecomputedWithConnection​(java.sql.Connection c,
                                                   Query query,
                                                   java.lang.String type)
                                            throws ObjectStoreException,
                                                   java.sql.SQLException
        Checks if a query is precomputed or not for the given type and connection
        Parameters:
        c - the connection
        query - the query
        type - the type
        Returns:
        true if and only if the given query is (already) precomputed
        Throws:
        ObjectStoreException - if there is a database problem
        java.sql.SQLException - if there is a database problem
      • goFaster

        public void goFaster​(Query q)
                      throws ObjectStoreException
        Makes a certain Query go faster, using extra resources. The user should release the resources later by calling releaseGoFaster on the same Query. Failure to release resources may result in an overall degradation in performance.
        Parameters:
        q - the Query to speed up
        Throws:
        ObjectStoreException - if something is wrong
      • goFasterWithConnection

        public void goFasterWithConnection​(Query q,
                                           java.sql.Connection c)
                                    throws ObjectStoreException
        Makes a certain Query go faster, using extra resources. The user should release the resources later by calling releaseGoFaster on the same Query. Failure to release resources may result in an overall degradation in performance.
        Parameters:
        q - the Query to speed up
        c - the Connection to use
        Throws:
        ObjectStoreException - if something is wrong
      • releaseGoFaster

        public void releaseGoFaster​(Query q)
                             throws ObjectStoreException
        Releases the resources used by goFaster().
        Parameters:
        q - the Query for which to release resources
        Throws:
        ObjectStoreException - if something goes wrong
      • getUniqueInteger

        public int getUniqueInteger​(java.sql.Connection c)
                             throws java.sql.SQLException
        Return a unique integer from a SEQUENCE in the database.
        Parameters:
        c - a Connection to use
        Returns:
        an integer that is unique in this database
        Throws:
        java.sql.SQLException - if something goes wrong
      • getSerialWithConnection

        protected java.lang.Integer getSerialWithConnection​(java.sql.Connection c)
                                                     throws java.sql.SQLException
        Gets an ID number which is unique in the database, given a Connection.
        Parameters:
        c - the Connection
        Returns:
        an Integer
        Throws:
        java.sql.SQLException - if a problem occurs
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object