Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## toolkit.db.api
Class QueryInfo

    java.lang.Object
      toolkit.db.api.QueryInfo

    public class QueryInfo

extends java.lang.Object

Class QueryInfo wraps all information of a query. Users can retrieve information from it and build the query statement string of their own.

Constructor Summary
`QueryInfo()` Constructs an empty QueryInfo.

Method Summary
`void` | `addAnd(java.lang.String sLeftExpr, java.lang.String sOperator, java.lang.String sRightExpr, java.lang.String sLogic, boolean bEndOfGroup)` Adds an AndInfo.
`void` | `addColumn(java.lang.String sColumnMappingName, java.lang.String sColumnName, java.lang.String sExpression, boolean bCompCol, java.lang.String sTableMappingName, int iColumnIndex)` Adds a ColumnInfo.
`void` | `addFormula(java.lang.String sName, java.lang.String sExpression, boolean bNonSQLCriterion)` Adds a FormulaInfo.
`void` | `addFormula(java.lang.String sName, java.lang.String sExpression, java.lang.String value, boolean bNonSQLCriterion)` Adds a FormulaInfo.
`void` | `addJoin(java.lang.String sColumnFrom, java.lang.String sOperator, java.lang.String sColumnTo, int iJoinType, boolean bSQL92, boolean bSelfJoin)` Adds a JoinInfo.
`void` | `addOrderBy(java.lang.String sColumnMappingName, java.lang.String order)` Adds an OrderByInfo.
`void` | `addParameter(java.lang.String sName, java.lang.String sType, java.lang.String sValue)` Adds a ParameterInfo.
`void` | `addQbeCriterion(java.lang.String sColumnMappingName, int iRowNumber, java.lang.String sExpression)` Adds a QBE criterion to this query.
`void` | `addSubLink(java.lang.String sSubColumnMappingName, java.lang.String sOperator, java.lang.String sValue)` Adds a SubLinkInfo.
`void` | `addTable(java.lang.String sMappingName, java.lang.String sTableName, java.lang.String sCorrelationName, java.lang.String sSchemaName, java.lang.String sCatalogName)` Adds a TableInfo.
`AndInfo[]` | `getAnds()` Gets the array of the AndInfo in this query.
`ColumnInfo` | `getColumn(java.lang.String name)` Gets the ColumnInfo by the specified name.
`ColumnInfo[]` | `getColumns()` Gets the array of the ColumnInfo of all columns in this query, no matter it is a selected column or not.
`ConnectionInfo` | `getConnection()` Gets ConnectionInfo of this query.
`java.lang.Object` | `getEntityByName(java.lang.String sMappingName)` Gets an entity (column, parameter or formula) by the specified name.
`FormulaInfo[]` | `getFormulas()` Gets the array of the FormulaInfo of this query.
`JoinInfo[]` | `getJoins()` Gets array of JoinInfo in this query.
`OrderByInfo[]` | `getOrderBys()` Gets the array of the OrderByInfo of this query.
`ParameterInfo[]` | `getParameters()` Gets the array of the ParameterInfo of this query.
`QBEInfo[]` | `getQbes()` Gets the array of the QBEInfo in this query.
`java.lang.String` | `getQueryName()` Gets the name of this query.
`ColumnInfo[]` | `getSelectColumns()` Gets the array of the ColumnInfo of the referenced selected columns in this query.
`ColumnInfo[]` | `getSelectColumns(boolean referencedOnly)` Gets the array of the ColumnInfo of the selected columns in this query.
`SubLinkInfo[]` | `getSubLinks()` Gets the array of the SubLinkInfo of this query.
`TableInfo[]` | `getTables()` Gets a Vector of TableInfo of all used tables in this query.
`java.lang.String` | `getWherePortionString()` Gets the where portion string.
`boolean` | `isDistinct()` Gets whether this query is selected distinct.
`boolean` | `isIgnorePredicateIfParamIsNull()` Gets the value of the option "ignore predicate if parameter is null" of this query.
`void` | `removeAllParameters()` Remove all ParameterInfo in this QeuryInfo.
`void` | `removeAllSubLinks()` Removes all SubLinkInfo in this query.
`ParameterInfo` | `removeParameter(java.lang.String sParameterName)` Removes a specified ParameterInfo.
`SubLinkInfo` | `removeSubLink(java.lang.String sSubColName)` Removes a specified SubLinkInfo.
`void` | `setConnection(java.lang.String sDriver, java.lang.String sURL, java.lang.String sUser, java.lang.String sPassword, java.lang.String sDateFormat, java.lang.String sTimeFormat, java.lang.String sTimestampFormat, int iTransactionIsolation, int iReadOnly, int iQualifiedNamePattern, int iExtraNamePattern, int iEncodingPattern)` Sets connectionInfo's variables to the specified values.
`void` | `setDistinct(boolean bDistinct)` Sets the flag of the selected distinct of this query to the specified value.
`void` | `setIgnorePredicateIfParamIsNull(boolean bIgnorePredicateIfParamIsNull)` Sets the flag of the option "Ignore Predicate If Param Is Null" of this query to the specified value.
`void` | `setQueryName(java.lang.String sQueryName)` Sets the name of this query to the specified value.
`void` | `setWherePortionString(java.lang.String sWherePortion)` Sets where the portion string.
`void` | `updateParameterValue(java.lang.String sParameterName, java.lang.String sValue)` Updates the value of a specific ParameterInfo in a query.
`void` | `updateSubLinkValue(java.lang.String sSubColName, java.lang.String sValue)` Updates the value of a specific SubLinkInfo in a query.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### QueryInfo

    public QueryInfo()

  Constructs an empty QueryInfo.

Method Detail

### setQueryName

    public void setQueryName(java.lang.String sQueryName)

  Sets the name of this query to the specified value.

  Parameters:
    `sQueryName` - Name of the query.

### getQueryName

    public java.lang.String getQueryName()

  Gets the name of this query.

  Returns:
    the name of this query.

### setConnection

    public void setConnection(java.lang.String sDriver,
                              java.lang.String sURL,
                              java.lang.String sUser,
                              java.lang.String sPassword,
                              java.lang.String sDateFormat,
                              java.lang.String sTimeFormat,
                              java.lang.String sTimestampFormat,
                              int iTransactionIsolation,
                              int iReadOnly,
                              int iQualifiedNamePattern,
                              int iExtraNamePattern,
                              int iEncodingPattern)

  Sets connectionInfo's variables to the specified values.

  Parameters:
    `sDriver` - Driver name used to connect to the database.
    `sURL` - JDBC url.
    `sUser` - The user name used to connect to the database.
    `sPassword` - The user's password.
    `sDateFormat` - Format of date type.
    `sTimeFormat` - Format of time type.
    `sTimestampFormat` - Format of timestemp type.
    `iTransactionIsolation` - Transaction level of the connectionInfo.
    `iReadOnly` - Read-only property of the connectionInfo.
    `iQualifiedNamePattern` - Qualified pattern of the table name.
    `iExtraNamePattern` - Qualified name pattern.
    `iEncodingPattern` - Encoding option when getting string from ResultSet. `#ConnectionInfo`

### getConnection

    public ConnectionInfo getConnection()

  Gets ConnectionInfo of this query.

  Returns:
    the ConnectionInfo of this query. `#ConnectionInfo`

### setDistinct

    public void setDistinct(boolean bDistinct)

  Sets the flag of the selected distinct of this query to the specified value.

  Parameters:
    `bDistince` - Selected distinct value to set.

### isDistinct

    public boolean isDistinct()

  Gets whether this query is selected distinct.

  Returns:
    the value of the selected distinct flag.

### setIgnorePredicateIfParamIsNull

    public void setIgnorePredicateIfParamIsNull(boolean bIgnorePredicateIfParamIsNull)

  Sets the flag of the option "Ignore Predicate If Param Is Null" of this query to the specified value.

  Parameters:
    `bIgnorePredicateIfParamIsNull` - Value of the option "Ignore Predicate If Param Is Null" to be set.

### isIgnorePredicateIfParamIsNull

    public boolean isIgnorePredicateIfParamIsNull()

  Gets the value of the option "ignore predicate if parameter is null" of this query.

  Returns:
    the value of the option "ignore predicate if parameter is null".

### addTable

    public void addTable(java.lang.String sMappingName,
                         java.lang.String sTableName,
                         java.lang.String sCorrelationName,
                         java.lang.String sSchemaName,
                         java.lang.String sCatalogName)

  Adds a TableInfo.

  Parameters:
    `sMappingName` - The mapping name of the newly added TableInfo.
    `sTableName` - The real database name of the newly added TableInfo.
    `sCorrelationName` - The correlation name of the newly added TableInfo.
    `sSchemaName` - The schema name of the newly added TableInfo.
    `sCatalogName` - The catalog name of the newly added TableInfo. `#TableInfo`

### getTables

    public TableInfo[] getTables()

  Gets a Vector of TableInfo of all used tables in this query.

  Returns:
    the array of TableInfo of this query. `#TableInfo`

### addColumn

    public void addColumn(java.lang.String sColumnMappingName,
                          java.lang.String sColumnName,
                          java.lang.String sExpression,
                          boolean bCompCol,
                          java.lang.String sTableMappingName,
                          int iColumnIndex)

  Adds a ColumnInfo.

  Parameters:
    `sMappingName` - The mapping name of the newly added column.
    `sColumnName` - The real database name of the newly added column.
    `sExpression` - The expression of the newly added column, if it represents a computed column.
    `bCompCol` - Flag which indicates whether the newly added column is a computed column.
    `sTableMappingName` - The mapping name of the table.
    `iColumnIndex` - The index of the added column. `#ColumnInfo`

### getColumn

    public ColumnInfo getColumn(java.lang.String name)

  Gets the ColumnInfo by the specified name.

  Parameters:
    `name` - The column name.
  Returns:
    a ColumnInfo of this query. `#ColumnInfo`

### getColumns

    public ColumnInfo[] getColumns()

  Gets the array of the ColumnInfo of all columns in this query, no matter it is a selected column or not.

  Returns:
    array of all ColumnInfo of this query. `#ColumnInfo`

### getSelectColumns

    public ColumnInfo[] getSelectColumns()

  Gets the array of the ColumnInfo of the referenced selected columns in this query. This is a shorthand for:

  >                     getSelectColumns(true)

  Note, all columns in this array are in order as they should appear in Select clause when creating a runtime SQL statement.

  Returns:
    array of ColumnInfo that will appear in Select clause.
  See Also:
    `getSelectColumns(boolean)`, `{@link #ColumnInfo}`

### getSelectColumns

    public ColumnInfo[] getSelectColumns(boolean referencedOnly)

  Gets the array of the ColumnInfo of the selected columns in this query. When a PSQL query is bound to a report, there may be some selected columns which are not referenced in this report. Then it's not necessary to include them in the runtime SQL statement. So if you give a `true` to the parameter `referencedOnly`, only the referenced selected columns of the report will be included in the return array, otherwise all selected columns will be included.
  Note, all referenced columns in this array are in order as they should appear in Select clause when creating a runtime SQL statement.

  Parameters:
    `referencedOnly` - Only select the columns that are referenced in a report at runtime or not.
  Returns:
    array of ColumnInfo that will appear in Select clause.
  See Also:
    `getSelectColumns()`, `ColumnInfo.getColumnIndex()`

### addJoin

    public void addJoin(java.lang.String sColumnFrom,
                        java.lang.String sOperator,
                        java.lang.String sColumnTo,
                        int iJoinType,
                        boolean bSQL92,
                        boolean bSelfJoin)

  Adds a JoinInfo.

  Parameters:
    `sColumnFrom` - The mapping name of FROM column of the newly added JoinInfo.
    `sOperator` - The operator of the newly added JoinInfo.
    `sColumnTo` - The mapping name of To column of the newly added JoinInfo. `#JoinInfo`

### getJoins

    public JoinInfo[] getJoins()

  Gets array of JoinInfo in this query.

  Returns:
    array of JoinInfo of this query. `#JoinInfo`

### addQbeCriterion

    public void addQbeCriterion(java.lang.String sColumnMappingName,
                                int iRowNumber,
                                java.lang.String sExpression)

  Adds a QBE criterion to this query.

  Parameters:
    `sColumnMappingName` - The mapping name of the column which this criterion will be based on.
    `iRowNumber` - Row number of the criterion.
    `sExpression` - Criterion in the corresponding row. `#QBEInfo`

### getQbes

    public QBEInfo[] getQbes()

  Gets the array of the QBEInfo in this query.

  Returns:
    array of the QBEInfo in this query. `#QBEInfo`

### addAnd

    public void addAnd(java.lang.String sLeftExpr,
                       java.lang.String sOperator,
                       java.lang.String sRightExpr,
                       java.lang.String sLogic,
                       boolean bEndOfGroup)

  Adds an AndInfo.

  Parameters:
    `sLeftExpr` - Left expression value of the newly added AndInfo.
    `sOperator` - Operator value of the newly added AndInfo.
    `sLeftExpr` - Right expression value of the newly added AndInfo.
    `sLogic` - Logic value of the newly added AndInfo.
    `bEndOfGroup` - Flag to indicate whether this newly added AndInfo is the last condition in a group. `#AndInfo`

### getAnds

    public AndInfo[] getAnds()

  Gets the array of the AndInfo in this query. Usually, the `AndInfo` are predefined in the query, but if you run reports through `JREngine` and call `JREngine.setNamedWherePortion(String)` to set a predefined where portion, the return AndInfos are those conditions in that where portion.

  Returns:
    array of the AndInfo in this query.
  See Also:
    `{@link #AndInfo}`

### setWherePortionString

    public void setWherePortionString(java.lang.String sWherePortion)

  Sets where the portion string.

  Parameters:
    `sWherePortion` - Where condition string to be set to this query. It will replace the Where clause.

### getWherePortionString

    public java.lang.String getWherePortionString()

  Gets the where portion string. If you run reports through `jet.bean.JREngine`, you can call `setWherePortion(String)` to replace the Where clause by the specified string. In that case, you can call this method to retrieve the string you just set.

  Returns:
    the where condition string applied to this query.
  See Also:
    `JREngine.setWherePortion(String)`

### addSubLink

    public void addSubLink(java.lang.String sSubColumnMappingName,
                           java.lang.String sOperator,
                           java.lang.String sValue)

  Adds a SubLinkInfo.

  Parameters:
    `sSubColumnMappingName` - The mapping name of the ColumnInfo of the SubLinkInfo to be added to this query.
    `sOperator` - Operator of the SubLinkInfo to be added to this query.
    `sValue` - Value of the field in the main report of the SubLink to be added to this query. `#SubLinkInfo`

### updateSubLinkValue

    public void updateSubLinkValue(java.lang.String sSubColName,
                                   java.lang.String sValue)

  Updates the value of a specific SubLinkInfo in a query. This method does nothing if the specified sublink is not in this query.

  Parameters:
    `sSubColName` - Mapping name of the SubLinkInfo that will be updated.
    `sValue` - Value of the SubLinkInfo that will be updated. `#SubLinkInfo`

### removeSubLink

    public SubLinkInfo removeSubLink(java.lang.String sSubColName)

  Removes a specified SubLinkInfo. This method does nothing if the specified sublink is not in this QueryInfo.

  Parameters:
    `sSubColName` - Mapping name of the SubLinkInfo that will be removed.
  Returns:
    the SubLinkInfo removed by this method, or null if no SubLinkInfo is removed. `#SubLinkInfo`

### removeAllSubLinks

    public void removeAllSubLinks()

  Removes all SubLinkInfo in this query. `#SubLinkInfo`

### getSubLinks

    public SubLinkInfo[] getSubLinks()

  Gets the array of the SubLinkInfo of this query.

  Returns:
    array of the SubLinkInfo in this query. `#SubLinkInfo`

### addOrderBy

    public void addOrderBy(java.lang.String sColumnMappingName,
                           java.lang.String order)

  Adds an OrderByInfo.

  Parameters:
    `sColumnMappingName` - Mapping name of the ColumnInfo of the OrderByInfo to be added to this query.
    `order` - The order of the OrderByInfo to be added to this query. `#OrderByInfo`

### getOrderBys

    public OrderByInfo[] getOrderBys()

  Gets the array of the OrderByInfo of this query. Note, all OrderByInfo in this Vector are in order.

  Returns:
    array of the OrderByInfo in this query. `#OrderByInfo`

### addParameter

    public void addParameter(java.lang.String sName,
                             java.lang.String sType,
                             java.lang.String sValue)

  Adds a ParameterInfo.

  Parameters:
    `sName` - The mapping name of the ParameterInfo to be added to this query.
    `stype` - The data type of the ParameterInfo to be added to this query, represented in string.
    `sValue` - The value of the ParameterInfo to be added to this query, represented in string. `#ParameterInfo`

### updateParameterValue

    public void updateParameterValue(java.lang.String sParameterName,
                                     java.lang.String sValue)

  Updates the value of a specific ParameterInfo in a query. This method does nothing if the specified ParameterInfo is not in this QueryInfo.

  Parameters:
    `sParameterName` - Mapping name of the ParameterInfo that will be updated.
    `sValue` - value of the ParameterInfo that will be updated. `#ParameterInfo`

### removeParameter

    public ParameterInfo removeParameter(java.lang.String sParameterName)

  Removes a specified ParameterInfo. This method does nothing if the specified parameter is not in this query.

  Parameters:
    `sParameterName` - Mapping name of the ParameterInfo that will be removed.
  Returns:
    the ParameterInfo removed by this method, or null if no ParameterInfo is removed. `#ParameterInfo`

### removeAllParameters

    public void removeAllParameters()

  Remove all ParameterInfo in this QeuryInfo. `#ParameterInfo`

### getParameters

    public ParameterInfo[] getParameters()

  Gets the array of the ParameterInfo of this query.

  Returns:
    array of the ParameterInfo in this query. `#ParameterInfo`

### addFormula

    public void addFormula(java.lang.String sName,
                           java.lang.String sExpression,
                           boolean bNonSQLCriterion)

  Adds a FormulaInfo.

  Parameters:
    `sName` - The mapping name of the FormulaInfo to be added to this query.
    `sExpression` - The expression of the FormulaInfo to be added to this query.
    `bNonSQLCriterion` - The flag which indicates if this formula is a non-SQL criterion. `#FormulaInfo`

### addFormula

    public void addFormula(java.lang.String sName,
                           java.lang.String sExpression,
                           java.lang.String value,
                           boolean bNonSQLCriterion)

  Adds a FormulaInfo.

  Parameters:
    `sName` - The mapping name of the FormulaInfo to be added to this query.
    `sExpression` - The expression of the FormulaInfo to be added to this query.
    `value` - The value of the FormulaInfo to be added to this query.
    `bNonSQLCriterion` - The flag which indicates if this formula is a non-SQL criterion. `#FormulaInfo`

### getFormulas

    public FormulaInfo[] getFormulas()

  Gets the array of the FormulaInfo of this query.

  Returns:
    array of the FormulaInfo in this query. `#FormulaInfo`

### getEntityByName

    public java.lang.Object getEntityByName(java.lang.String sMappingName)

  Gets an entity (column, parameter or formula) by the specified name.

  Parameters:
    `sMappingName` - The name of the entity to be searched for.
  Returns:
    a ColumnInfo if it is found in this query, or a ParameterInfo if it is found in this query, or a FormulaInfo if it is found in this query, otherwise null.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD