Class OStatementCache
java.lang.Object
com.orientechnologies.orient.core.sql.parser.OStatementCache
This class is an LRU cache for already parsed SQL statement executors. It stores itself in the
storage as a resource. It also acts an an entry point for the SQL parser.
- Author:
- Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleanstatic OStatementget(String statement, OStatementCache resource) returns an already parsed SQL executor, taking it from the cache if it exists or creating a new one (parsing and then putting it into the cache) if it doesn'tgetStatement(String statement) protected static OStatementparses an SQL statement and returns the corresponding executorprotected static voidthrowParsingException(ParseException e, String statement) protected static voidthrowParsingException(TokenMgrError e, String statement)
-
Constructor Details
-
OStatementCache
public OStatementCache(int size) - Parameters:
size- the size of the cache
-
-
Method Details
-
contains
- Parameters:
statement- an SQL statement- Returns:
- true if the corresponding executor is present in the cache
-
get
returns an already parsed SQL executor, taking it from the cache if it exists or creating a new one (parsing and then putting it into the cache) if it doesn't- Parameters:
statement- the SQL statementdb- the current DB instance. If null, cache is ignored and a new executor is created through statement parsing- Returns:
- a statement executor from the cache
-
getStatement
- Parameters:
statement- an SQL statement- Returns:
- the corresponding executor, taking it from the internal cache, if it exists
-
parse
parses an SQL statement and returns the corresponding executor- Parameters:
statement- the SQL statement- Returns:
- the corresponding executor
- Throws:
OCommandSQLParsingException- if the input parameter is not a valid SQL statement
-
throwParsingException
-
throwParsingException
-
clear
public void clear()
-