Class AbstractDMLQuery

java.lang.Object
com.j_spaces.jdbc.AbstractDMLQuery
All Implemented Interfaces:
Query, Cloneable
Direct Known Subclasses:
DeleteQuery, InsertQuery, ProcedureQuery, SelectQuery, UpdateQuery

public abstract class AbstractDMLQuery extends Object implements Query, Cloneable
Author:
Michael Mitrani, 2Train4, 2004 This abstract class is the super class for DML queries like: SELECT, DELETE, UPDATE and INSERT
  • Field Details

  • Constructor Details

    • AbstractDMLQuery

      public AbstractDMLQuery()
  • Method Details

    • build

      public void build() throws SQLException
      Build query internal structures - called after parsing
      Specified by:
      build in interface Query
      Throws:
      SQLException
    • validateBuiltTemplates

      protected void validateBuiltTemplates() throws SQLException
      Throws:
      SQLException
    • isContainsQuery

      public boolean isContainsQuery()
    • setContainsQuery

      public void setContainsQuery(boolean containsQuery)
    • getReadModifier

      public int getReadModifier()
      Returns:
      the readModifier
    • setReadModifier

      public void setReadModifier(int readModifier)
      Parameters:
      readModifier - the readModifier to set
    • setPrepared

      public void setPrepared(boolean isPrepared)
      Parameters:
      isPrepared - is this a PreparedStatment or not.
    • isPrepared

      public boolean isPrepared()
      Specified by:
      isPrepared in interface Query
      Returns:
      isPrepared is this a PreparedStatment or not.
    • getQueryColumns

      public List<SelectColumn> getQueryColumns()
      Returns the list of columns in this query as Strings. if the list is empty it means all columns (the '*' notation).
    • getQueryColumnByAlias

      public SelectColumn getQueryColumnByAlias(String alias)
    • addColumn

      public void addColumn(String column)
      Add a column to the list of columns.
      Parameters:
      column - the column to add
    • setTableName

      public void setTableName(String table)
      sets the table name of the query.
    • getTableName

      public String getTableName()
      Returns:
      String the table name of the query
    • setExpTree

      public void setExpTree(ExpNode rootNode)
      Sets the root node of the expression tree.
    • getExpTree

      public ExpNode getExpTree()
      Returns:
      the root node of the expression tree.
    • isJoined

      public boolean isJoined()
    • clone

      public abstract AbstractDMLQuery clone()
      Overrides:
      clone in class Object
    • setRownum

      public void setRownum(RowNumNode rownum)
    • getRownum

      public RowNumNode getRownum()
    • getPreparedValues

      public Object[] getPreparedValues()
    • setPreparedValues

      public void setPreparedValues(Object[] preparedValues)
    • getSession

      public QuerySession getSession()
    • setSession

      public void setSession(QuerySession session)
      Specified by:
      setSession in interface Query
    • setTemplatePreparedValues

      public void setTemplatePreparedValues(ITypeDesc typeDesc, Object[] fieldValues)
    • addTableWithAlias

      public QueryTableData addTableWithAlias(String table, String alias)
    • getTableByAlias

      public String getTableByAlias(String alias)
      Return a table name according to its alias.
      Returns:
      The table name
    • isBuildOnly

      public boolean isBuildOnly()
    • setBuildOnly

      public void setBuildOnly(boolean isBuildOnly)
    • isConvertResultToArray

      public boolean isConvertResultToArray()
      Returns:
      true if convert result to array
    • setConvertResultToArray

      public void setConvertResultToArray(boolean convertResultToArray)
      Parameters:
      convertResultToArray -
    • buildTemplates

      public void buildTemplates() throws SQLException
      Convert the expression tree to space queries in form of IEntryPacket templates
      Throws:
      SQLException
    • getTemplatePacketIfExists

      public QueryTemplatePacket getTemplatePacketIfExists()
    • getTypeInfo

      public ITypeDesc getTypeInfo()
      Returns:
      ITypeDesc
    • prepare

      public void prepare(ISpaceProxy space, Transaction txn) throws SQLException
      Set the prepared values on the expression tree
      Throws:
      SQLException
    • executeSubQueries

      protected void executeSubQueries(ISpaceProxy space, Transaction txn) throws SQLException
      Throws:
      SQLException
    • isReturnResult

      public boolean isReturnResult()
    • setReturnResult

      public void setReturnResult(boolean returnResult)
    • getRownumLimit

      protected int getRownumLimit()
      Returns:
      row number limit
    • filterByRownum

      protected void filterByRownum(Collection<IEntryPacket> entries)
    • getOperationID

      public OperationID getOperationID()
      Returns:
      the operationID
    • setOperationID

      public void setOperationID(OperationID operationID)
      Parameters:
      operationID - the operationID to set
    • getQueryResultType

      public QueryResultTypeInternal getQueryResultType()
    • setQueryResultType

      public void setQueryResultType(QueryResultTypeInternal queryResultType)
    • setSecurityInterceptor

      public void setSecurityInterceptor(SecurityInterceptor securityInterceptor)
      Specified by:
      setSecurityInterceptor in interface Query
    • getSecurityInterceptor

      public SecurityInterceptor getSecurityInterceptor()
      Returns:
      the securityInterceptor
    • getTablesData

      public List<QueryTableData> getTablesData()
    • getTablesNames

      public String getTablesNames()
    • getTableData

      public QueryTableData getTableData(String tableName)
    • getTableData

      public QueryTableData getTableData()
    • validateQuery

      public void validateQuery(ISpaceProxy space) throws SQLException
      Description copied from interface: Query
      Each query should have its own specific validations. this is the place to do them. if some validation fail, an SQLException will be thrown.
      Specified by:
      validateQuery in interface Query
      Throws:
      SQLException
    • validateQuery

      public void validateQuery(SpaceTypeManager typeManager) throws SQLException
      Specified by:
      validateQuery in interface Query
      Throws:
      SQLException
    • getBuilder

      public QueryTemplateBuilder getBuilder()
    • getTimeout

      public long getTimeout()
    • setTimeout

      public void setTimeout(long timeout)
    • getIfExists

      public boolean getIfExists()
    • setIfExists

      public void setIfExists(boolean ifExists)
    • setRouting

      public void setRouting(Object routing)
      Sets the routing value of the query.
    • getRouting

      public Object getRouting()
      Gets the routing value of the query.
    • setProjectionTemplate

      public void setProjectionTemplate(AbstractProjectionTemplate projectionTemplate)
    • getProjectionTemplate

      public AbstractProjectionTemplate getProjectionTemplate()
    • isDirtyState

      public boolean isDirtyState()
      Gets whether the query is in dirty state
    • isSelectQuery

      public boolean isSelectQuery()
      Gets whether this query is a SELECT query.
    • isForceUnderTransaction

      public boolean isForceUnderTransaction()
      Gets whether this query is forced to be executed under transaction.
      Specified by:
      isForceUnderTransaction in interface Query
    • containsSubQueries

      public boolean containsSubQueries()
      Description copied from interface: Query
      Gets whether this query contains sub queries.
      Specified by:
      containsSubQueries in interface Query
    • setContainsSubQueries

      public void setContainsSubQueries(boolean containsSubQueries)
    • executePreparedValuesBatch

      public BatchResponsePacket executePreparedValuesBatch(ISpaceProxy space, Transaction transaction, GPreparedStatement.PreparedValuesCollection preparedValuesCollection) throws SQLException
      Executes a query with batched prepared values. This is the default implementation - NOT optimized.
      Returns:
      BatchResponsePacket
      Throws:
      SQLException
    • setMaxResults

      public void setMaxResults(int maxResults)
    • setMinEntriesToWaitFor

      public void setMinEntriesToWaitFor(int minEntriesToWaitFor)
    • getMinEntriesToWaitFor

      public int getMinEntriesToWaitFor()
    • assignParameters

      public void assignParameters(SQLQuery<?> sqlQuery, IDirectSpaceProxy proxy)
    • getExplainPlan

      public ExplainPlan getExplainPlan()
    • setExplainPlan

      public void setExplainPlan(ExplainPlan _explainPlan)
    • writeExternal

      protected void writeExternal(ObjectOutput out) throws IOException
      Throws:
      IOException
    • readExternal

      protected void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Throws:
      IOException
      ClassNotFoundException