Class GridSqlQueryParser


  • public class GridSqlQueryParser
    extends Object
    H2 Query parser.
    • Constructor Detail

      • GridSqlQueryParser

        public GridSqlQueryParser​(boolean useOptimizedSubqry,
                                  IgniteLogger log)
        Parameters:
        useOptimizedSubqry - If we have to find correct order for table filters in FROM clause. Relies on uniqueness of table filter aliases.
        log - Logger.
    • Method Detail

      • checkMultipleStatements

        public static boolean checkMultipleStatements​(PreparedStatement stmt)
        Parameters:
        stmt - Prepared statement to check.
        Returns:
        true in case of multiple statements.
      • prepared

        public static org.h2.command.Prepared prepared​(PreparedStatement stmt)
        Parameters:
        stmt - Prepared statement.
        Returns:
        Parsed select.
      • failIfSelectForUpdateQuery

        public static void failIfSelectForUpdateQuery​(org.h2.command.Prepared p)
        Parameters:
        p - Prepared.
      • query

        public static org.h2.command.dml.Query query​(org.h2.command.Prepared qry)
        Parameters:
        qry - Prepared.
        Returns:
        Query.
      • isDml

        public static boolean isDml​(org.h2.command.Prepared stmt)
        Check whether statement is DML statement.
        Parameters:
        stmt - Statement.
        Returns:
        True if this is DML.
      • isLocalQuery

        public boolean isLocalQuery()
        Check if query may be run locally on all caches mentioned in the query.
        Returns:
        true if query may be run locally on all caches mentioned in the query, i.e. there's no need to run distributed query.
      • getFirstPartitionedCache

        public GridCacheContext getFirstPartitionedCache()
        Get first (i.e. random, as we need any one) partitioned cache from parsed query to determine expected query parallelism.
        Returns:
        Context for the first of partitioned caches mentioned in the query, or null if it does not involve partitioned caches.
      • cacheIds

        public List<Integer> cacheIds()
        Returns:
        All known cache IDs.
      • parseQuery

        public static GridSqlQuery parseQuery​(org.h2.command.Prepared prepared,
                                              boolean useOptimizedSubqry,
                                              IgniteLogger log)
        Parse query.
        Parameters:
        prepared - Prepared statement.
        useOptimizedSubqry - Whether to user optimized subquery.
        Returns:
        Parsed query.
      • parse

        public final GridSqlStatement parse​(org.h2.command.Prepared stmt)
        Parameters:
        stmt - Prepared statement.
        Returns:
        Parsed AST.
      • isStreamableInsertStatement

        public static boolean isStreamableInsertStatement​(org.h2.command.Prepared prep)
        Check if passed statement is insert statement eligible for streaming.
        Parameters:
        prep - Prepared statement.
        Returns:
        True if streamable insert.
      • isExplainUpdate

        public static boolean isExplainUpdate​(org.h2.command.Prepared statement)
        Determines if specified prepared statement is an EXPLAIN of update operation: UPDATE, DELETE, etc. (e.g. not a SELECT query).
        Parameters:
        statement - statement to probe.
        Returns:
        True if statement is EXPLAIN UPDATE, EXPLAIN DELETE or etc.; false otherwise.
      • checkTypeSupported

        public static void checkTypeSupported​(int type,
                                              String errMsg)