001    package railo.runtime.type.scope.storage.db;
002    
003    import java.sql.SQLException;
004    
005    import railo.commons.io.log.Log;
006    import railo.runtime.config.Config;
007    import railo.runtime.db.DatasourceConnection;
008    import railo.runtime.exp.PageException;
009    import railo.runtime.type.Query;
010    import railo.runtime.type.Struct;
011    import railo.runtime.type.scope.storage.StorageScopeEngine;
012    import railo.runtime.type.scope.storage.StorageScopeListener;
013    import railo.runtime.type.scope.storage.clean.DatasourceStorageScopeCleaner;
014    
015    public interface SQLExecutor {
016    
017            /**
018             * does a select statement on the datasource to get data
019             * @param config Config of the current context
020             * @param cfid CFID of the current user
021             * @param applicationName name of the current application context
022             * @param dc Datasource Connection to use
023             * @param type storage type (Scope.SCOPE_CLIENT,Scope.SCOPE_SESSION)
024             * @param log 
025             * @param createTableIfNotExist do create the table if not existing
026             * @return data matching criteria
027             * @throws PageException
028             * @throws SQLException 
029             */
030            public Query select(Config config, String cfid,String applicationName, DatasourceConnection dc, int type, Log log, boolean createTableIfNotExist) throws PageException,SQLException;
031    
032            /**
033             * updates the data in the datasource for a specific user (CFID), if the data not exist, a new record is created
034             * @param config Config of the current context
035             * @param cfid CFID of the current user
036             * @param applicationName name of the current application context
037             * @param dc Datasource Connection to use
038             * @param type storage type (Scope.SCOPE_CLIENT,Scope.SCOPE_SESSION)
039             * @param data data to store
040             * @param timeSpan timespan in millis 
041             * @param log 
042             * @throws PageException
043             * @throws SQLException
044             */
045            public void update(Config config, String cfid,String applicationName, DatasourceConnection dc,int type,Struct data,long timeSpan, Log log) throws PageException,SQLException;
046    
047            /**
048             * deletes the data in the datasource for a specific user (CFID), if there is no data for this user nothing is happeing
049             * @param config Config of the current context
050             * @param cfid CFID of the current user
051             * @param applicationName name of the current application context
052             * @param dc Datasource Connection to use
053             * @param type storage type (Scope.SCOPE_CLIENT,Scope.SCOPE_SESSION)
054             * @param log 
055             * @throws PageException
056             * @throws SQLException
057             */
058            public void delete(Config config, String cfid, String applicationName, DatasourceConnection dc, int type, Log log) throws PageException,SQLException;
059     
060            public void clean(Config config, DatasourceConnection dc, int type, StorageScopeEngine engine, DatasourceStorageScopeCleaner cleaner, StorageScopeListener listener, Log log) throws PageException,SQLException;   
061    
062    }