Package com.arcadedb.query.sql.parser
Class StatementCache
- java.lang.Object
-
- com.arcadedb.query.sql.parser.StatementCache
-
public class StatementCache extends Object
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 (luigi.dellaquila-(at)-gmail.com)
-
-
Constructor Summary
Constructors Constructor Description StatementCache(Database db, int size)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
contains(String statement)
Statement
get(String statement)
protected Statement
parse(String statement)
parses an SQL statement and returns the corresponding executorprotected static void
throwParsingException(ParseException e, String statement)
protected static void
throwParsingException(TokenMgrError e, String statement)
-
-
-
Constructor Detail
-
StatementCache
public StatementCache(Database db, int size)
- Parameters:
size
- the size of the cache
-
-
Method Detail
-
get
public Statement get(String statement)
- Parameters:
statement
- an SQL statement- Returns:
- the corresponding executor, taking it from the internal cache, if it exists
-
parse
protected Statement parse(String statement) throws CommandSQLParsingException
parses an SQL statement and returns the corresponding executor- Parameters:
statement
- the SQL statement- Returns:
- the corresponding executor
- Throws:
CommandSQLParsingException
- if the input parameter is not a valid SQL statement
-
throwParsingException
protected static void throwParsingException(ParseException e, String statement)
-
throwParsingException
protected static void throwParsingException(TokenMgrError e, String statement)
-
contains
public boolean contains(String statement)
-
clear
public void clear()
-
-