Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.6.0)

E13403-07

oracle.javatools.db.sql
Class AbstractSQLQuery

java.lang.Object
  extended by oracle.javatools.db.AbstractDBObject
      extended by oracle.javatools.db.AbstractChildDBObject
          extended by oracle.javatools.db.sql.AbstractSQLFragment
              extended by oracle.javatools.db.sql.AbstractSQLQuery
All Implemented Interfaces:
ChildDBObject, DBObject, SQLFragment, SQLQuery, Copyable, DynamicPropertySet
Direct Known Subclasses:
NonDeclarativeSQLQuery, OracleSQLQuery

public abstract class AbstractSQLQuery
extends AbstractSQLFragment
implements SQLQuery

Abstract implementation of a SQLQuery. It implements all the methods for DeclarativeSQLQuery but doesn't explicitly implement the interface (to allow non-declarative queries to share the implementation). Subclasses that are meant to be declarative should override.

Since:
10.1.3

Nested Class Summary
 
Nested classes/interfaces inherited from class oracle.javatools.db.AbstractDBObject
AbstractDBObject.ChildSupport
 
Field Summary
 
Fields inherited from class oracle.javatools.db.sql.AbstractSQLFragment
DEFAULT_SEPARATOR, EMPTY, EMPTY_ARRAY, NEWLINE, SPACE
 
Fields inherited from interface oracle.javatools.db.sql.SQLQuery
TYPE
 
Fields inherited from interface oracle.javatools.db.sql.SQLFragment
CONNECTBY, FROM, GROUPBY, HAVING, NOCYCLE, ORDERBY, SELECT, STARTWITH, WHERE
 
Fields inherited from interface oracle.javatools.db.DBObject
COMMENT
 
Constructor Summary
protected AbstractSQLQuery()
           
 
Method Summary
 void addFromObject(FromObject f)
           
 void addFromObject(int index, FromObject f)
           
 void addOrderByObject(int index, OrderByObject o)
           
 void addOrderByObject(OrderByObject o)
           
 void addSelectObject(int index, SelectObject s)
           
 void addSelectObject(SelectObject s)
           
protected  void appendFromSQL(java.lang.StringBuilder sql)
           
protected  void appendSelectSQL(java.lang.StringBuilder sql)
           
protected  void clearQueryString()
          Should be called by any operation that changes the query.
 DBObject findOwnedObject(DBObjectID id)
          Returns a child of this object that has the given ID.
 java.lang.String getDistinctSource()
          Get the source string used to define the DISTINCT/UNIQUE/ALL property for the query
 FromObject[] getFromObjects()
          Get all the from objects for this query.
 GroupByObject getGroupByObject()
          Gets the "GROUP BY ...
 HierarchicalQueryObject getHierarchicalQueryObject()
          Get the "CONNECT BY ...
 OrderByObject[] getOrderByObjects()
          Get all the OrderBy objects for this query.
 java.lang.String getQueryString()
          Gets the query string.
 SelectObject[] getSelectObjects()
          Returns all the objects that make up the SELECT clause.
 java.lang.String getSQLText()
          Gets the SQL for the query.
 java.lang.String getType()
          Returns the type of this object.
 WhereObject getWhereObject()
          Gets the WHERE clause for this query.
 int indexOf(FromObject f)
           
 int indexOf(OrderByObject o)
           
 int indexOf(SelectObject s)
           
 boolean isDistinct()
          Return true if the query only returns DISTINCT/UNIQUE rows.
 void moveFromObject(FromObject f, int newIndex)
           
 void moveOrderByObject(OrderByObject o, int newIndex)
           
 void moveSelectObject(SelectObject s, int newIndex)
           
 boolean removeFromObject(FromObject f)
           
 boolean removeOrderByObject(OrderByObject o)
           
 boolean removeSelectObject(SelectObject s)
           
 void setDistinct(boolean isDistinct)
          Set the DISTINCT/UNIQUE/ALL property for the query.
 void setDistinctSource(java.lang.String distinctSource)
          Set the source string used to define the DISTINCT/UNIQUE/ALL property for the query
 void setFromObjects(FromObject[] froms)
           
 void setGroupByObject(GroupByObject groupby)
           
 void setHierarchicalQueryObject(HierarchicalQueryObject connectby)
           
 void setID(DBObjectID id)
          Sets the object ID associated with this object.
 void setOrderByObjects(OrderByObject[] orderBys)
           
 void setQueryString(java.lang.String query)
          Sets the query string.
 void setSelectObjects(SelectObject[] selects)
           
 void setWhereObject(WhereObject where)
           
 
Methods inherited from class oracle.javatools.db.sql.AbstractSQLFragment
appendToBuffer, argsToString, getTextOrNull, getTextOrNull, setParent, surroundWithBrackets, surroundWithBrackets, toString
 
Methods inherited from class oracle.javatools.db.AbstractChildDBObject
copyToImpl, findParent, getParent, getProperty, setProperty
 
Methods inherited from class oracle.javatools.db.AbstractDBObject
changeParent, compareToImpl, copyObject, copyTo, copyTo, copyTo, copyTo, equals, equalsImpl, findOwnedObject, findOwnedObject, getChildSupport, getID, getName, getOwnedObjects, getOwnedObjects, getOwnedObjectsImpl, getProperties, getProperty, getReferenceIDs, getReferenceIDsImpl, hashCode, includeOwnedObject, includesType, includesType, removeThisAsParent, replaceReferenceIDs, setName, setProperties
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface oracle.javatools.db.sql.SQLQuery
isDeclarative
 
Methods inherited from interface oracle.javatools.db.ChildDBObject
getParent, setParent
 
Methods inherited from interface oracle.javatools.db.DBObject
copyTo, copyTo, copyTo, findOwnedObject, getID, getName, getOwnedObjects, getOwnedObjects, getReferenceIDs, replaceReferenceIDs, setName
 
Methods inherited from interface oracle.javatools.util.DynamicPropertySet
getProperties, getProperty, getProperty, setProperties, setProperty
 

Constructor Detail

AbstractSQLQuery

protected AbstractSQLQuery()
Method Detail

getType

public java.lang.String getType()
Description copied from interface: DBObject
Returns the type of this object. Valid types include things like tables, views, synonyms, and columns.

Specified by:
getType in interface DBObject
Overrides:
getType in class AbstractSQLFragment
Returns:
a string describing the type of object.

getSQLText

public java.lang.String getSQLText()
Gets the SQL for the query.

Specified by:
getSQLText in interface SQLFragment
Returns:
a string representing the SQL text for this object.

appendSelectSQL

protected void appendSelectSQL(java.lang.StringBuilder sql)

appendFromSQL

protected void appendFromSQL(java.lang.StringBuilder sql)

getQueryString

public java.lang.String getQueryString()
Gets the query string. If a query string exists it is returned instead of the declarative info by getSQLText()


setQueryString

public void setQueryString(java.lang.String query)
Sets the query string. If a query string exists it is returned instead of the declarative info by getSQLText(). Calling this method does not change the declarative information - use a SQLQueryBuilder.


clearQueryString

protected void clearQueryString()
Should be called by any operation that changes the query.


getSelectObjects

public SelectObject[] getSelectObjects()
Returns all the objects that make up the SELECT clause.

Specified by:
getSelectObjects in interface SQLQuery

setSelectObjects

public void setSelectObjects(SelectObject[] selects)

addSelectObject

public void addSelectObject(SelectObject s)

addSelectObject

public void addSelectObject(int index,
                            SelectObject s)

removeSelectObject

public boolean removeSelectObject(SelectObject s)

moveSelectObject

public void moveSelectObject(SelectObject s,
                             int newIndex)

indexOf

public int indexOf(SelectObject s)

getFromObjects

public FromObject[] getFromObjects()
Description copied from interface: SQLQuery
Get all the from objects for this query.

Specified by:
getFromObjects in interface SQLQuery

setFromObjects

public void setFromObjects(FromObject[] froms)

addFromObject

public void addFromObject(FromObject f)

addFromObject

public void addFromObject(int index,
                          FromObject f)

removeFromObject

public boolean removeFromObject(FromObject f)

moveFromObject

public void moveFromObject(FromObject f,
                           int newIndex)

indexOf

public int indexOf(FromObject f)

getOrderByObjects

public OrderByObject[] getOrderByObjects()
Description copied from interface: SQLQuery
Get all the OrderBy objects for this query.

Specified by:
getOrderByObjects in interface SQLQuery

setOrderByObjects

public void setOrderByObjects(OrderByObject[] orderBys)

addOrderByObject

public void addOrderByObject(OrderByObject o)

addOrderByObject

public void addOrderByObject(int index,
                             OrderByObject o)

removeOrderByObject

public boolean removeOrderByObject(OrderByObject o)

moveOrderByObject

public void moveOrderByObject(OrderByObject o,
                              int newIndex)

indexOf

public int indexOf(OrderByObject o)

setWhereObject

public void setWhereObject(WhereObject where)

getWhereObject

public WhereObject getWhereObject()
Description copied from interface: SQLQuery
Gets the WHERE clause for this query.

Specified by:
getWhereObject in interface SQLQuery

setHierarchicalQueryObject

public void setHierarchicalQueryObject(HierarchicalQueryObject connectby)

getHierarchicalQueryObject

public HierarchicalQueryObject getHierarchicalQueryObject()
Description copied from interface: SQLQuery
Get the "CONNECT BY ... START WITH ..." clause for this query

Specified by:
getHierarchicalQueryObject in interface SQLQuery

setGroupByObject

public void setGroupByObject(GroupByObject groupby)

getGroupByObject

public GroupByObject getGroupByObject()
Description copied from interface: SQLQuery
Gets the "GROUP BY ... HAVING ..." clause for this query.

Specified by:
getGroupByObject in interface SQLQuery

setDistinct

public void setDistinct(boolean isDistinct)
Set the DISTINCT/UNIQUE/ALL property for the query.

true - the query only DISTINCT/UNIQUE rows false - the query returns ALL rows (this is the default)


isDistinct

public boolean isDistinct()
Return true if the query only returns DISTINCT/UNIQUE rows.


setDistinctSource

public void setDistinctSource(java.lang.String distinctSource)
Set the source string used to define the DISTINCT/UNIQUE/ALL property for the query


getDistinctSource

public java.lang.String getDistinctSource()
Get the source string used to define the DISTINCT/UNIQUE/ALL property for the query


setID

public void setID(DBObjectID id)
Description copied from interface: DBObject
Sets the object ID associated with this object. Note that the ID should only be set at most once. Implementations should ensure that the id is not reset.

Specified by:
setID in interface DBObject
Overrides:
setID in class AbstractDBObject
Parameters:
id - the DBObjectID to be associated with this object

findOwnedObject

public DBObject findOwnedObject(DBObjectID id)
Description copied from class: AbstractDBObject
Returns a child of this object that has the given ID. The child is located by comparing IDs, not by calling resolveID() which is quicker. The method does not recurse to look for children of children. This method is a candidate for adding to the DBObject interface.

Specified by:
findOwnedObject in interface DBObject
Overrides:
findOwnedObject in class AbstractDBObject
Parameters:
id - the id to look for
Returns:
a child object found with that id.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.6.0)

E13403-07

Copyright © 1997, 2011, Oracle. All rights reserved.