Class IndexColumnOrder
java.lang.Object
org.apache.derby.impl.sql.execute.IndexColumnOrder
- All Implemented Interfaces:
Externalizable
,Serializable
,Formatable
,TypedFormat
,ColumnOrdering
Basic implementation of ColumnOrdering.
Not sure what to tell callers about 0-based versus 1-based numbering.
Assume 0-based for now.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) boolean
(package private) int
This class implements Formatable.(package private) boolean
indicate whether NULL values should sort low. -
Constructor Summary
ConstructorsConstructorDescriptionNiladic constructor for formatableIndexColumnOrder
(int colNum) IndexColumnOrder
(int colNum, boolean ascending) IndexColumnOrder
(int colNum, boolean ascending, boolean nullsLow) constructor used by the ORDER BY clause. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
boolean
Indicate whether NULL values should be ordered below non-NULL.int
Get the formatID which corresponds to this class.void
Read this object from a stream of stored objects.toString()
void
Write this object out
-
Field Details
-
colNum
int colNumThis class implements Formatable. That means that it can write itself to and from a formatted stream. If you add more fields to this class, make sure that you also write/read them with the writeExternal()/readExternal() methods. If, inbetween releases, you add more fields to this class, then you should bump the version number emitted by the getTypeFormatId() method. -
ascending
boolean ascending -
nullsOrderedLow
boolean nullsOrderedLowindicate whether NULL values should sort low. nullsOrderedLow is usually false, because generally Derby defaults to have NULL values compare higher than non-null values, but if the user specifies an ORDER BY clause with aspecification that indicates that NULL values should be ordered lower than non-NULL values, thien nullsOrderedLow is set to true.
-
-
Constructor Details
-
IndexColumnOrder
public IndexColumnOrder()Niladic constructor for formatable -
IndexColumnOrder
public IndexColumnOrder(int colNum) -
IndexColumnOrder
public IndexColumnOrder(int colNum, boolean ascending) -
IndexColumnOrder
public IndexColumnOrder(int colNum, boolean ascending, boolean nullsLow) constructor used by the ORDER BY clause. This version of the constructor is used by the compiler when it processes an ORDER BY clause in a SQL statement. For such statements, the user gets to control whether NULL values are ordered as lower than all non-NULL values, or higher than all non-NULL values.- Parameters:
colNum
- number of this columnascending
- whether the ORDER BY is ascendeing or descendingnullsLow
- whether nulls should be ordered low
-
-
Method Details
-
getColumnId
public int getColumnId()- Specified by:
getColumnId
in interfaceColumnOrdering
-
getIsAscending
public boolean getIsAscending()- Specified by:
getIsAscending
in interfaceColumnOrdering
-
getIsNullsOrderedLow
public boolean getIsNullsOrderedLow()Indicate whether NULL values should be ordered below non-NULL. This function returns TRUE if the user has specified, via theclause in the ORDER BY clause, that NULL values of this column should sort lower than non-NULL values. - Specified by:
getIsNullsOrderedLow
in interfaceColumnOrdering
- Returns:
- whether nulls should sort low
-
writeExternal
Write this object out- Specified by:
writeExternal
in interfaceExternalizable
- Parameters:
out
- write bytes here- Throws:
IOException
- thrown on error
-
readExternal
Read this object from a stream of stored objects.- Specified by:
readExternal
in interfaceExternalizable
- Parameters:
in
- read this.- Throws:
IOException
- thrown on errorClassNotFoundException
- thrown on error
-
getTypeFormatId
public int getTypeFormatId()Get the formatID which corresponds to this class.- Specified by:
getTypeFormatId
in interfaceTypedFormat
- Returns:
- the formatID of this class
-
toString
-