public class SqlResourceImpl extends Object implements SqlResource
Constructor and Description |
---|
SqlResourceImpl(String name,
SqlResourceDefinition definition,
SqlResourceMetaData metaData,
SqlBuilder sqlBuilder,
List<Trigger> triggers) |
Modifier and Type | Method and Description |
---|---|
SqlResourceDefinition |
getDefinition()
Returns SQL resource information defined by the user, including query, validated attributes and trigger.
|
SqlResourceMetaData |
getMetaData()
Returns meta data for SQL resource.
|
String |
getName()
Returns SQL resource name.
|
List<Trigger> |
getTriggers()
Returns triggers classes.
|
List<Map<String,Object>> |
read(Request request)
Executes query returning results as an object collection.
|
String |
read(Request request,
String mediaType)
Executes query returning results as a string.
|
static String |
removeWhitespaceFromSql(String sql) |
WriteResponse |
write(Request request)
Executes database write (insert, update or delete).
|
public SqlResourceImpl(String name, SqlResourceDefinition definition, SqlResourceMetaData metaData, SqlBuilder sqlBuilder, List<Trigger> triggers) throws SqlResourceException
SqlResourceException
public SqlResourceDefinition getDefinition()
SqlResource
getDefinition
in interface SqlResource
public SqlResourceMetaData getMetaData()
SqlResource
getMetaData
in interface SqlResource
public String getName()
SqlResource
getName
in interface SqlResource
public List<Trigger> getTriggers()
SqlResource
getTriggers
in interface SqlResource
public List<Map<String,Object>> read(Request request) throws SqlResourceException
read
in interface SqlResource
request
- Request objectSqlResourceException
- if a database access error occurspublic String read(Request request, String mediaType) throws SqlResourceException
read
in interface SqlResource
request
- Request objectmediaType
- response format, use internet media type e.g. application/xmlSqlResourceException
- if a database access error occurspublic WriteResponse write(Request request) throws SqlResourceException
write
in interface SqlResource
request
- Request objectSqlResourceException
- if the request is invalid or a database access error or trigger exception occursCopyright © 2011-2018 restSQL Project Contributors