Expresso 5-6

com.jcorporate.expresso.ext.controller
Class RunSQL

java.lang.Object
  extended byorg.apache.struts.action.Action
      extended bycom.jcorporate.expresso.core.controller.Controller
          extended bycom.jcorporate.expresso.core.controller.DBController
              extended bycom.jcorporate.expresso.ext.controller.RunSQL
All Implemented Interfaces:
Serializable

public class RunSQL
extends DBController

RunSQL allows any arbitrary SQL string to be sent to the database & executed Must be carefully secured!

Author:
Michael Nash
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jcorporate.expresso.core.controller.Controller
CONTROLLER_PARAM_KEY, CTL_SUCC_CTL, CTL_SUCC_STATE, CTL_SUCC_TRAN, mLog, NEWSTATE_EXCEPTION_KEY, ORIGINAL_URL_KEY, REQUEST_KEY, RESPONSE_KEY, RETURN_TO_SENDER_TRAN, STATE_ERR_CTL, STATE_ERR_STATE, STATE_ERR_TRAN, STATE_PARAM_KEY, STATE_SUCC_CTL, STATE_SUCC_STATE, STATE_SUCC_TRAN
 
Fields inherited from class org.apache.struts.action.Action
ACTION_SERVLET_KEY, APPLICATION_KEY, DATA_SOURCE_KEY, defaultLocale, ERROR_KEY, EXCEPTION_KEY, FORM_BEANS_KEY, FORWARDS_KEY, LOCALE_KEY, MAPPING_KEY, MAPPINGS_KEY, MESSAGE_KEY, MESSAGES_KEY, MULTIPART_KEY, PLUG_INS_KEY, REQUEST_PROCESSOR_KEY, servlet, SERVLET_KEY, TRANSACTION_TOKEN_KEY
 
Constructor Summary
RunSQL()
          Default constructor.
 
Method Summary
 Block getTableDefinition(String dataContext, String def)
          Builds a table definition and enters it into a block.
 String getTitle()
          Return the title of this Controller
 void runGetDefinitionState(ControllerRequest request, ControllerResponse response)
          Prints the definition of a given table.
 void runPromptState(ControllerRequest request, ControllerResponse response)
          Present a form requesting the SQL to be executed
 void runRunState(ControllerRequest req, ControllerResponse res)
          Receive the SQL request from the client & send it to the database for execution.
 
Methods inherited from class com.jcorporate.expresso.core.controller.DBController
getString, isAllowed, stateAllowed
 
Methods inherited from class com.jcorporate.expresso.core.controller.Controller
addFinalState, addPromptTransitions, addRegDomainParamtoSession, addRequestedURLtoSession, addState, addStatePairing, endTimer, execute, findControllerForm, generateToken, getActionForward, getControllerChainingTransition, getControllerSecurityTransition, getFinalState, getInitialState, getLogger, getParamValues, getRequestURL, getSchema, getSchemaHierarchy, getSchemaInstance, getSchemaStack, getState, getStates, getString, getString, handleException, instantiate, isFinalState, isHandleState, isPromptState, isTokenValid, loadStateForm, newState, nextHandleState, nextPromptState, populateStateForm, postPerform, prePerform, previousPromptState, processRequestTransitions, processTransitions, redirectRequest, redirectRequest, remapFromExtension, resetToken, saveToken, setControllerChainingTransition, setControllerSecurityTransition, setCurrentState, setInitialState, setSchema, setSchema, setupDefaultValues, setupReturnToSender, setupSubclassLog, transition, transition, transition, unloadStateForm
 
Methods inherited from class org.apache.struts.action.Action
execute, generateToken, getDataSource, getDataSource, getLocale, getResources, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, perform, perform, resetToken, saveErrors, saveMessages, saveToken, setLocale, setServlet, toHex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RunSQL

public RunSQL()
Default constructor.

Method Detail

runPromptState

public void runPromptState(ControllerRequest request,
                           ControllerResponse response)
                    throws ControllerException
Present a form requesting the SQL to be executed

Parameters:
request - Standard request object
response - Standard response object
Throws:
ControllerException - upon error

runGetDefinitionState

public void runGetDefinitionState(ControllerRequest request,
                                  ControllerResponse response)
                           throws ControllerException,
                                  NonHandleableException
Prints the definition of a given table.

Parameters:
request - ControllerRequest
response - ControllerResponse
Throws:
ControllerException - upon error.
NonHandleableException - upon fatal error.

getTableDefinition

public Block getTableDefinition(String dataContext,
                                String def)
                         throws DBException
Builds a table definition and enters it into a block.

(c) Note: Initial code (c)2004, Centerline Computers Inc , Donated to the Expresso Framework project.

Parameters:
dataContext - String the database context.
def - String the table name.
Returns:
Block populated block with results.
Throws:
DBException - upon error.

runRunState

public void runRunState(ControllerRequest req,
                        ControllerResponse res)
                 throws ControllerException
Receive the SQL request from the client & send it to the database for execution. Present the results to the client.

Parameters:
req - Standard request object
res - Standard response object
Throws:
ControllerException - upon error

getTitle

public String getTitle()
Description copied from class: Controller
Return the title of this Controller

Overrides:
getTitle in class Controller
Returns:
java.lang.String The Title of the controller

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.