public class Query
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
String[] |
getInsertValues()
Once query has been parsed, this returns a String array with the
values found in INSERT query.
|
String |
getRelationName()
Fetches the relation/table name from the query.
|
String[] |
getSelectFields()
Once query has been parsed, this returns a String array with the
fields found in a SELECT query.
|
String |
getUpdateField()
Once query has been parsed, this returns a String representing the 'field'
in the UPDATE query.
|
String |
getUpdateValue()
Once query has been parsed, this returns a String representing the 'value'
in the UPDATE query.
|
int |
getWhereID()
Fetches the 'ID' field specified in the WHERE part of the query.
|
boolean |
isDelete()
Method used to check if parsed query is a DELETE query
|
boolean |
isInsert()
Method used to check if parsed query is an INSERT query
|
boolean |
isSelect()
Method used to check if parsed query is a SELECT query
|
boolean |
isUpdate()
Method used to check if parsed query is an UPDATE query
|
static Query |
readQuery(String q)
Static method that analyzes the passed query and attempts to parse and
return it in Query object form.
|
static Query |
readQuery(String exitToken,
boolean ignoreCase)
Static method that repeatedly prompts a user for a query until
a correctly formatted query is inputted.
|
public String[] getSelectFields()
public String[] getInsertValues()
public String getUpdateField()
public String getUpdateValue()
public int getWhereID()
public String getRelationName()
public boolean isSelect()
public boolean isUpdate()
public boolean isDelete()
public boolean isInsert()
public static Query readQuery(String exitToken, boolean ignoreCase)
exitToken
- String representation of the token to be used in order to exitignoreCase
- boolean indicating whether to ignore case for the exit tokenpublic static Query readQuery(String q)
q
- String representation of query to be interpreted