|
Awake SQL v1.2.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.awakefw.sql.api.server.StatementAnalyser
public class StatementAnalyser
Class that allows the analysis of the string content of a SQL statement,
mainly for security reasons.
Analysis methods include:
DELETE/INSERT/SELECT/UPDATE, CREATE/ALTER/DROP...DELETE/INSERT/SELECT/UPDATE).CREATE/ALTER/DROP/TRUNCATE/COMMENT/RENAME).GRANT/REVOKE).
| Constructor Summary | |
|---|---|
StatementAnalyser(String sql,
List<Object> parameterValues)
Constructor. |
|
| Method Summary | |
|---|---|
Object |
getFirstParameter()
Returns the value in string of the first parameter of the parameters list. |
Object |
getLastParameter()
Returns the value in string of the last parameter of the parameters list. |
Object |
getParameter(int index)
Returns the value as object of the parameter index in the list. |
int |
getParameterCount()
Returns the number of parameters in the statement |
String |
getSql()
Returns the string content of the SQL statement. |
String |
getStatementType()
Extract the statement type from a sql order. |
String |
getTableNameFromDmlStatement()
Returns the table name in use type from a DML SQL order. |
boolean |
isDcl()
Says if the statement is a DCL (Data Control Language) statement ( GRANT/REVOKE). |
boolean |
isDdl()
Says if the statement is a DDL (Data Definition Language) statement ( CREATE/ALTER/DROP/TRUNCATE/COMMENT/RENAME) |
boolean |
isDelete()
Says if the statement is a DELETE. |
boolean |
isDml()
Says if the statement is a DML (Data Manipulation Language) statement ( DELETE/INSERT/SELECT/UPDATE). |
boolean |
isInsert()
Says if the statement is an INSERT. |
boolean |
isPreparedStatement()
Returns true if the statement is a prepared statement with at least one '?' |
boolean |
isSelect()
Says if the statement is a SELECT. |
boolean |
isUpdate()
Says if the statement is an UPDATE. |
boolean |
isWithComments()
Says if a statement contains SQL comments. |
boolean |
isWithSemicolons()
Says if a statement contains Semicolons (';') that are not trailing. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StatementAnalyser(String sql,
List<Object> parameterValues)
sql - the string content of the SQL statement.parameterValues - the parameter values of a prepared statement in the natural
order, empty list for a (non prepared) statement| Method Detail |
|---|
public Object getFirstParameter()
IndexOutOfBoundsException - if there is no parameterpublic Object getLastParameter()
IndexOutOfBoundsException - if there is no parameterpublic Object getParameter(int index)
index - index of parameter as in a list: starts at 0.
IndexOutOfBoundsException - if the index is out of range (
index < 0 || index >= size())public int getParameterCount()
public String getSql()
public String getStatementType()
DELETE, INSERT, SELECT, UPDATE,
etc...
public String getTableNameFromDmlStatement()
throws IllegalArgumentException
SELECT
statement) for a DML statement. Returns null if statement is not
DML.
IllegalArgumentExceptionpublic boolean isDcl()
GRANT/REVOKE).
public boolean isDdl()
CREATE/ALTER/DROP/TRUNCATE/COMMENT/RENAME)
public boolean isDelete()
DELETE.
DELETEpublic boolean isDml()
DELETE/INSERT/SELECT/UPDATE).
public boolean isInsert()
INSERT.
INSERTpublic boolean isPreparedStatement()
public boolean isSelect()
SELECT.
SELECTpublic boolean isUpdate()
UPDATE.
UPDATEpublic boolean isWithComments()
public boolean isWithSemicolons()
|
Awake SQL v1.2.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||