Class DBCountExpr

All Implemented Interfaces:
ColumnExpr

public class DBCountExpr extends DBColumnExpr
This class is used to add the "count" statement to the SQL-Command.

There is no need to explicitly create instances of this class.
Instead use or @link DBColumnExpr#count()

  • Constructor Details

    • DBCountExpr

      public DBCountExpr(DBRowSet rowset)
      Constructs a DBCountExpr.
      Parameters:
      rowset - the rowset
    • DBCountExpr

      public DBCountExpr(DBColumnExpr expr, boolean distinct)
      Constructs a DBCountExpr.
      Parameters:
      expr - the column
      distinct - set true for distinct count
  • Method Details

    • getDatabase

      public final DBDatabase getDatabase()
      Returns the current DBDatabase object.
      Specified by:
      getDatabase in class DBObject
      Returns:
      the current DBDatabase object
    • getDataType

      public DataType getDataType()
      Returns the data type: DT_INTEGER.
      Specified by:
      getDataType in interface ColumnExpr
      Specified by:
      getDataType in class DBColumnExpr
      Returns:
      the data type: DT_INTEGER
      See Also:
    • getEnumType

      public Class<Enum<?>> getEnumType()
      Not an Enum. Returns null
      Returns:
      the enum type
    • getName

      public String getName()
      Returns the String "count".
      Specified by:
      getName in interface ColumnExpr
      Specified by:
      getName in class DBColumnExpr
      Returns:
      the String "count"
    • getRowSet

      public DBRowSet getRowSet()
      Returns the underlying rowset
      Specified by:
      getRowSet in class DBColumnExpr
      Returns:
      a column used for this expression
    • getUpdateColumn

      public DBColumn getUpdateColumn()
      Returns the underlying column
      Specified by:
      getUpdateColumn in interface ColumnExpr
      Specified by:
      getUpdateColumn in class DBColumnExpr
      Returns:
      the underlying column
    • isAggregate

      public boolean isAggregate()
      Returns true since the count function is an aggregate function.
      Specified by:
      isAggregate in class DBColumnExpr
      Returns:
      always true
    • equals

      public boolean equals(Object other)
      Returns true if other is equal to this expression
      Overrides:
      equals in class Object
    • addReferencedColumns

      public void addReferencedColumns(Set<DBColumn> list)
      Description copied from class: DBExpr
      Internal function to obtain all DBColumnExpr-objects used by this expression.
      Specified by:
      addReferencedColumns in class DBExpr
      Parameters:
      list - list to which all used column expressions must be added
      See Also:
    • addSQL

      public void addSQL(DBSQLBuilder sql, long context)
      Creates the SQL-Command adds the String "count(*)" to the SQL-Command.
      Specified by:
      addSQL in class DBExpr
      Parameters:
      sql - the SQL-Command
      context - the current SQL-Command context
    • addXml

      public Element addXml(Element parent, long flags)
      this adds the column description to the parent element
      Specified by:
      addXml in class DBColumnExpr
      Parameters:
      parent - the parent element to which to append the column description
      flags - currently not used
      Returns:
      the newly created child element