Class SqlExecuteCommand
java.lang.Object
org.labkey.remoteapi.Command<CommandResponse, org.apache.hc.client5.http.classic.methods.HttpPost>
- All Implemented Interfaces:
HasRequiredVersion
Command for executing arbitrary LabKey SQL.
LabKey SQL is variant of standard SQL that supports most of the SELECT-related operations. For more information on LabKey SQL, see the following page:
https://www.labkey.org/Documentation/wiki-page.view?name=labkeySql
Uses stream-lined sql-execute.api instead of query-executesql.api
-
Nested Class Summary
Nested classes/interfaces inherited from class Command
Command.CommonParameters, Command.Response -
Field Summary
Fields inherited from class Command
CONTENT_TYPE_JSON -
Constructor Summary
ConstructorsConstructorDescriptionSqlExecuteCommand(String schemaName) Constructs an ExecuteSqlCommand, initialized with a schema name.SqlExecuteCommand(String schemaName, String sql) Constructs an ExecuteSqlCommand, initialized with a schema name and SQL query. -
Method Summary
Modifier and TypeMethodDescriptionorg.json.JSONObjectReturns the JSON object to post or null for no JSON.Map of name (string)/value pairs for the values of parameters if the SQL references underlying queries that are parameterized.getSql()Returns the current SQL query.voidsetQueryParameters(Map<String, String> parameters) Map of name (string)/value pairs for the values of parameters if the SQL references underlying queries that are parameterized.voidsetSchemaName(String schemaName) Sets the current schema name.voidSets the SQL query to execute.Methods inherited from class PostCommand
createRequestMethods inherited from class Command
_execute, createParameterMap, createResponse, execute, getActionName, getControllerName, getHttpRequest, getParameters, getParamValueAsString, getRequiredVersion, getTimeout, setRequiredVersion, setTimeout
-
Constructor Details
-
SqlExecuteCommand
Constructs an ExecuteSqlCommand, initialized with a schema name.When using this constructor, you must call the
setSql(String)method before executing the command.- Parameters:
schemaName- The schema name to query.
-
SqlExecuteCommand
-
-
Method Details
-
getSchemaName
-
setSchemaName
Sets the current schema name.- Parameters:
schemaName- The new schema name to query.
-
getSql
-
setSql
-
getQueryParameters
-
setQueryParameters
-
getLineSeparator
-
getFieldSeparator
-
getJsonObject
public org.json.JSONObject getJsonObject()Description copied from class:PostCommandReturns the JSON object to post or null for no JSON. Override this method to provide parameters as JSON.- Overrides:
getJsonObjectin classPostCommand<CommandResponse>- Returns:
- The JSON object to post.
-