core/src/main/java/com/orientechnologies/orient/core/sql/parser/OStatementCache.java
public static OStatement get(String statement, ODatabaseDocumentInternal db) {
    if (db == null) {
      return parse(statement);
    }

    OStatementCache resource = db.getSharedContext().getStatementCache();
    return resource.get(statement);
  }
public static OStatement get(String statement, ODatabaseDocumentInternal db) {
    if (db == null) {
      return parse(statement);
    }

    OStatementCache resource = db.getSharedContext().getStatementCache();
    return resource.get(statement);
  }
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

@param statement the SQL statement
@param db        the current DB instance. If null, cache is ignored and a new executor is created through statement parsing

@return a statement executor from the cache