Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weblogic.db.jdbc
Class SelectStmt

    java.lang.Object
      |
      +--weblogic.db.jdbc.SelectStmt

public final class SelectStmt
extends java.lang.Object

SelectStmt objects are used to help build vendor-neutral Select statements with query-by-example (QBE) support. You are not limited to a single table name when constructing a SelectStmt object, although the usage of the object may dictate when a join of one or more tables is useful; a SelectStmt object associated with a TableDataSet cannot create a join, since a TableDataSet is, by definition, derived from a single table. But you can create a join with a SelectStmt that is associated with a QueryDataSet, which has no limitations on the scope of its data retrieval.

For an implementation and usage see the Developers Guide.

Author:
  Copyright (c) 1995-98 by Weblogic, Inc. All Rights Reserved., Copyright (c) 1999 by BEA WebXpress. All Rights Reserved.

Constructor Summary
`SelectStmt(int dbtype)` SelectStmt constructor.

Method Summary
`SelectStmt` | `addQbe(java.lang.String attrib, float val)` Sets the QBE value for the specified attribute to a float value.
`SelectStmt` | `addQbe(java.lang.String attrib, int val)` Sets the QBE value for the specified attribute to an int value.
`SelectStmt` | `addQbe(java.lang.String attrib, java.lang.String val)` Sets the QBE value for the specified attribute to a string value.
`SelectStmt` | `addUnquotedQbe(java.lang.String attrib, java.lang.String val)` Sets the QBE value for the specified attribute to an int value.
`SelectStmt` | `clearQbe()` Clears the QBE clauses for all attributes.
`SelectStmt` | `clearQbe(java.lang.String attrib)` Clears the QBE clause for the specified attribute.
`SelectStmt` | `field(java.lang.String attribute)` Adds an element to the SELECT list of a SelectStmt object.
`SelectStmt` | `field(java.lang.String attribute, java.lang.String alias)` Adds an element and its alias to the SELECT list of a SelectStmt object.
`SelectStmt` | `from(java.lang.String str)` Adds a FROM clause to the SelectStmt object.
`protected java.lang.String` | `getFields()`
`java.lang.String` | `getQbeWhere()` Returns the WHERE clause of the SelectStmt object.
`SelectStmt` | `group(java.lang.String str)` Adds a GROUP BY clause to the SelectStmt object.
`SelectStmt` | `having(java.lang.String str)` Adds a HAVING clause to the SelectStmt object.
`SelectStmt` | `order(java.lang.String str)` Adds an ORDER BY clause to the SelectStmt object.
`protected java.lang.String` | `orderString()`
`SelectStmt` | `setQbe(java.lang.String attrib, float val)` Sets the QBE value for the specified attribute to a float value.
`SelectStmt` | `setQbe(java.lang.String attrib, float[] val)` Sets the QBE value for the specified attribute to an array of float values.
`SelectStmt` | `setQbe(java.lang.String attrib, int val)` Sets the QBE value for the specified attribute to an int value.
`SelectStmt` | `setQbe(java.lang.String attrib, int[] val)` Sets the QBE value for the specified attribute to an array of int values.
`SelectStmt` | `setQbe(java.lang.String attrib, java.lang.String val)` Sets the QBE value for the specified attribute to a string value.
`SelectStmt` | `setQbe(java.lang.String attrib, java.lang.String[] val)` Sets the QBE value for the specified attribute to an array of string values.
`SelectStmt` | `setUnquotedQbe(java.lang.String attrib, java.lang.String val)` Sets the QBE value for the specified attribute to a string value.
`SelectStmt` | `setUnquotedQbe(java.lang.String attrib, java.lang.String[] val)` Sets the QBE value for the specified attribute to an array of string values.
`java.lang.String` | `toString()` Returns the complete SELECT statement for the SelectStmt object.
`SelectStmt` | `unique()` Adds a UNIQUE clause to the SelectStmt object.
`SelectStmt` | `where(java.lang.String str)` Adds a WHERE clause to the SelectStmt object.

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

Constructor Detail

### SelectStmt

    public SelectStmt(int dbtype)

  SelectStmt constructor.

  Parameters:
    `dbtype` - Database type Enum found in weblogic.db.jdbc.Enums
  See Also:
    `Enums`

Method Detail

### field

    public SelectStmt field(java.lang.String attribute)

  Adds an element to the SELECT list of a SelectStmt object. The attribute can be a column name or an expression. This method can take as its argument a string of the form: "tableAlias.attribute"

  Parameters:
    `attribute` - Column name or expression
  Returns:
    SelectStmt object

### field

    public SelectStmt field(java.lang.String attribute,
                            java.lang.String alias)

  Adds an element and its alias to the SELECT list of a SelectStmt object. The attribute can be a column name or an expression. The alias is the name used to reference this element in Record.getValue() calls.

  Parameters:
    `attribute` - Column name or expression
    `alias` - Alias for attribute
  Returns:
    SelectStmt object

### getFields

    protected java.lang.String getFields()

### unique

    public SelectStmt unique()

  Adds a UNIQUE clause to the SelectStmt object.

  Returns:
    SelectStmt object

### from

    public SelectStmt from(java.lang.String str)

  Adds a FROM clause to the SelectStmt object. A table can be given an alias by passing this method a string of the form: "tableName alias"

  Returns:
    SelectStmt object

### where

    public SelectStmt where(java.lang.String str)

  Adds a WHERE clause to the SelectStmt object.

  Returns:
    SelectStmt object

### order

    public SelectStmt order(java.lang.String str)

  Adds an ORDER BY clause to the SelectStmt object.

  Returns:
    SelectStmt object

### orderString

    protected java.lang.String orderString()

### group

    public SelectStmt group(java.lang.String str)

  Adds a GROUP BY clause to the SelectStmt object.

  Returns:
    SelectStmt object

### having

    public SelectStmt having(java.lang.String str)

  Adds a HAVING clause to the SelectStmt object.

  Returns:
    SelectStmt object

### setQbe

    public SelectStmt setQbe(java.lang.String attrib,
                             int val)

  Sets the QBE value for the specified attribute to an int value. This method will not quote the value in the WHERE clause. A call to this method clears any existing QBE settings for the attribute.

  Parameters:
    `attrib` - Attribute
    `val` - Integer value
  Returns:
    SelectStmt object

### setQbe

    public SelectStmt setQbe(java.lang.String attrib,
                             float val)

  Sets the QBE value for the specified attribute to a float value. This method will not quote the value in the WHERE clause. A call to this method clears any existing QBE settings for the attribute.

  Parameters:
    `attrib` - Attribute
    `val` - Floating-point value
  Returns:
    SelectStmt object

### setQbe

    public SelectStmt setQbe(java.lang.String attrib,
                             java.lang.String val)

  Sets the QBE value for the specified attribute to a string value. This method will quote the value in the WHERE clause. A call to this method clears any existing QBE settings for the attribute.

  Parameters:
    `attrib` - Attribute
    `val` - String value
  Returns:
    SelectStmt object

### setUnquotedQbe

    public SelectStmt setUnquotedQbe(java.lang.String attrib,
                                     java.lang.String val)

  Sets the QBE value for the specified attribute to a string value. This method will not quote the value in the WHERE clause. A call to this method clears any existing QBE settings for the attribute.

  Parameters:
    `attrib` - Attribute
    `val` - String value
  Returns:
    SelectStmt object

### setQbe

    public SelectStmt setQbe(java.lang.String attrib,
                             int[] val)

  Sets the QBE value for the specified attribute to an array of int values. The array of values is expressed as an unquoted IN statement in the WHERE clause. A call to this method clears any existing QBE settings for the attribute.

  Parameters:
    `attrib` - Attribute
    `val` - Array of integer values
  Returns:
    SelectStmt object

### setQbe

    public SelectStmt setQbe(java.lang.String attrib,
                             float[] val)

  Sets the QBE value for the specified attribute to an array of float values. The array of values is expressed as an unquoted IN statement in the WHERE clause. A call to this method clears any existing QBE settings for the attribute.

  Parameters:
    `attrib` - Attribute
    `val` - Array of floating-point values
  Returns:
    SelectStmt object

### setQbe

    public SelectStmt setQbe(java.lang.String attrib,
                             java.lang.String[] val)

  Sets the QBE value for the specified attribute to an array of string values. The array of values is expressed as a quoted IN statement in the WHERE clause. A call to this method clears any existing QBE settings for the attribute.

  Parameters:
    `attrib` - Attribute
    `val` - Array of string values
  Returns:
    SelectStmt object

### setUnquotedQbe

    public SelectStmt setUnquotedQbe(java.lang.String attrib,
                                     java.lang.String[] val)

  Sets the QBE value for the specified attribute to an array of string values. The array of values is expressed as an unquoted IN statement in the WHERE clause. A call to this method clears any existing QBE settings for the attribute.

  Parameters:
    `attrib` - Attribute
    `val` - Array of string values
  Returns:
    SelectStmt object

### addQbe

    public SelectStmt addQbe(java.lang.String attrib,
                             int val)

  Sets the QBE value for the specified attribute to an int value. This method will not quote the value in the WHERE clause. A call to this method appends the value to the existing QBE settings for the attribute. Repeatedly calling this method for an attribute results in the construction of an IN statement.

  Parameters:
    `attrib` - Attribute
    `val` - Integer value
  Returns:
    SelectStmt object

### addQbe

    public SelectStmt addQbe(java.lang.String attrib,
                             float val)

  Sets the QBE value for the specified attribute to a float value. This method will not quote the value in the WHERE clause. A call to this method appends the value to the existing QBE settings for the attribute. Repeatedly calling this method for an attribute results in the construction of an IN statement.

  Parameters:
    `attrib` - Attribute
    `val` - Floating-point value
  Returns:
    SelectStmt object

### addQbe

    public SelectStmt addQbe(java.lang.String attrib,
                             java.lang.String val)

  Sets the QBE value for the specified attribute to a string value. This method will quote the value in the WHERE clause. A call to this method appends the value to the existing QBE settings for the attribute. Repeatedly calling this method for an attribute results in the construction of an IN statement.

  Parameters:
    `attrib` - Attribute
    `val` - String value
  Returns:
    SelectStmt object

### addUnquotedQbe

    public SelectStmt addUnquotedQbe(java.lang.String attrib,
                                     java.lang.String val)

  Sets the QBE value for the specified attribute to an int value. This method will not quote the value in the WHERE clause. A call to this method appends the value to the existing QBE settings for the attribute. Repeatedly calling this method for an attribute results in the construction of an IN statement.

  Parameters:
    `attrib` - Attribute
    `val` - Object value
  Returns:
    SelectStmt object

### clearQbe

    public SelectStmt clearQbe(java.lang.String attrib)

  Clears the QBE clause for the specified attribute.

  Parameters:
    `attrib` - Attribute
  Returns:
    SelectStmt object

### clearQbe

    public SelectStmt clearQbe()

  Clears the QBE clauses for all attributes.

  Returns:
    SelectStmt object

### getQbeWhere

    public java.lang.String getQbeWhere()

  Returns the WHERE clause of the SelectStmt object.

  Returns:
    String clause

### toString

    public java.lang.String toString()

  Returns the complete SELECT statement for the SelectStmt object.

  Returns:
    SQL string representation
  Overrides:
    toString in class java.lang.Object

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://e-docs.bea.com/wls/docs70
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 BEA Systems, Inc. All Rights Reserved.
WebLogic Server 7.0 API Reference