Class DatabaseSelect

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
    Direct Known Subclasses:
    Room

    public class DatabaseSelect
    extends Source
    Select the columns from rows that match the specified pattern via the specified database manager. The output is an array of records, one for each row that matches the pattern. In each record, there is field for each column, where the name of the field is the name of the column and the value is the value from the matching row. If no rows match the specified pattern, then the output is an empty array of the appropriate type.
    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (eal)
    • Field Detail

      • columns

        public PortParameter columns
        A record indicating what to query for. The names of the fields are the names of the columns to retrieve from the database, and the value of the field is the type. This is a record that defaults to {LNAME=string, DESKNO=string}, indicating that two columns, LNAME (for last name) and DESKNO (for desk number) should be retrieved from the database.
      • databaseManager

        public StringParameter databaseManager
        Name of the DatabaseManager to use. This defaults to "DatabaseManager".
      • distinct

        public Parameter distinct
        Indicator of whether to return only distinct records. This is a boolean that defaults to false.
      • orderBy

        public StringParameter orderBy
        Optional ordering of the results. For example, to order first by DESKNO (ascending) and then by LNAME (descending), you would change the value of this parameter to "DESKNO asc, LNAME desc". This parameter is a string that defaults to empty, meaning that the ordering of the results is arbitrary.
      • pattern

        public PortParameter pattern
        A pattern specifying which rows to select from the database. Any pattern understood in the 'where' clause of an SQL statement is acceptable. This is a string that defaults to "trim(room)='545Q' and trim(bldg)='Cory'", indicating that the retrieved records should have "Cory" in the bldg column and "545Q" in the room column.
      • table

        public StringParameter table
        Table to use within the database. This is a string that defaults to "v_spaces".