| java.lang.Object org.apache.derby.iapi.types.DataType org.apache.derby.iapi.types.SQLBoolean
SQLBoolean | final public class SQLBoolean extends DataType implements BooleanDataValue(Code) | | SQLBoolean satisfies the DataValueDescriptor
interfaces (i.e., DataType). It implements a boolean column,
e.g. for * storing a column value; it can be specified
when constructed to not allow nulls. Nullability cannot be changed
after construction, as it affects the storage size and mechanism.
Because DataType is a subtype of DataType,
SQLBoolean can play a role in either a DataType/Row
or a DataType/Row, interchangeably.
We assume the store has a flag for nullness of the value,
and simply return a 0-length array for the stored form
when the value is null.
PERFORMANCE: There are likely alot of performance improvements
possible for this implementation -- it new's Integer
more than it probably wants to.
|
Method Summary | |
public BooleanDataValue | and(BooleanDataValue otherValue) The AND operator. | public int | compare(DataValueDescriptor other) | public boolean | compare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV) | public BooleanDataValue | equals(DataValueDescriptor left, DataValueDescriptor right) The = operator as called from the language module, as opposed to
the storage module. | public boolean | equals(boolean val) Determine whether this SQLBoolean contains the given boolean value. | public int | estimateMemoryUsage() | public static SQLBoolean | falseTruthValue() Return a false truth value. | public boolean | getBoolean() | public byte | getByte() | public DataValueDescriptor | getClone() | public double | getDouble() | public float | getFloat() | public BooleanDataValue | getImmutable() Return an immutable BooleanDataValue with the same value as this. | public int | getInt() | public int | getLength() | public long | getLong() | public DataValueDescriptor | getNewNull() | public Object | getObject() | public short | getShort() | public String | getString() | public int | getTypeFormatId() Return my format identifier. | public String | getTypeName() | public BooleanDataValue | greaterOrEquals(DataValueDescriptor left, DataValueDescriptor right) The >= operator as called from the language module, as opposed to
the storage module. | public BooleanDataValue | greaterThan(DataValueDescriptor left, DataValueDescriptor right) The > operator as called from the language module, as opposed to
the storage module. | public int | hashCode() | public BooleanDataValue | is(BooleanDataValue otherValue) The SQL IS operator - consult any standard SQL reference for an explanation.
Implements the following truth table:
otherValue
| TRUE | FALSE | UNKNOWN
this |----------------------------
|
TRUE | TRUE | FALSE | FALSE
FALSE | FALSE | TRUE | FALSE
UNKNOWN | FALSE | FALSE | TRUE
Parameters: otherValue - BooleanDataValue to compare to. | public BooleanDataValue | isNot(BooleanDataValue otherValue) Implements NOT IS. | public boolean | isNull() | public BooleanDataValue | lessOrEquals(DataValueDescriptor left, DataValueDescriptor right) The <= operator as called from the language module, as opposed to
the storage module. | public BooleanDataValue | lessThan(DataValueDescriptor left, DataValueDescriptor right) The < operator as called from the language module, as opposed to
the storage module. | public BooleanDataValue | notEquals(DataValueDescriptor left, DataValueDescriptor right) The <> operator as called from the language module, as opposed to
the storage module. | public BooleanDataValue | or(BooleanDataValue otherValue) The OR operator. | public void | readExternal(ObjectInput in) | public void | readExternalFromArray(ArrayInputStream in) | public void | restoreToNull() | public void | setBigDecimal(Number bigDecimal) | protected void | setFrom(DataValueDescriptor theValue) | final public void | setInto(PreparedStatement ps, int position) Set the value into a PreparedStatement. | void | setObject(Object theValue) | public void | setValue(boolean theValue) | public void | setValue(Boolean theValue) | public void | setValue(byte theValue) | public void | setValue(short theValue) | public void | setValue(int theValue) | public void | setValue(long theValue) | public void | setValue(float theValue) | public void | setValue(double theValue) | public void | setValue(byte[] theValue) | public void | setValue(String theValue) Set the value of this BooleanDataValue to the given String.
String is trimmed and upcased. | public void | setValueFromResultSet(ResultSet resultSet, int colNumber, boolean isNullable) | public BooleanDataValue | throwExceptionIfFalse(String sqlState, String tableName, String constraintName) Throw an exception with the given SQLState if this BooleanDataValue
is false. | public String | toString() | public static SQLBoolean | trueTruthValue() Return a true truth value. | public static SQLBoolean | truthValue(DataValueDescriptor leftOperand, DataValueDescriptor rightOperand, boolean truth) Return the SQL truth value for a comparison.
This method first looks at the operands - if either is null, it
returns the unknown truth value. | public static SQLBoolean | truthValue(DataValueDescriptor leftOperand, DataValueDescriptor rightOperand, Boolean truth) | public static SQLBoolean | truthValue(boolean value) Get a truth value. | public int | typePrecedence() | public int | typeToBigDecimal() Implementation for BOOLEAN type. | public static SQLBoolean | unknownTruthValue() Return an unknown truth value. | public void | writeExternal(ObjectOutput out) |
BOOLEAN_LENGTH | final static int BOOLEAN_LENGTH(Code) | | |
SQLBoolean | public SQLBoolean()(Code) | | |
SQLBoolean | public SQLBoolean(boolean val)(Code) | | |
and | public BooleanDataValue and(BooleanDataValue otherValue)(Code) | | The AND operator. This implements SQL semantics for AND with unknown
truth values - consult any standard SQL reference for an explanation.
Parameters: otherValue - The other boolean to AND with this one this AND otherValue |
equals | public boolean equals(boolean val)(Code) | | Determine whether this SQLBoolean contains the given boolean value.
This method is used by generated code to determine when to do
short-circuiting for an AND or OR.
Parameters: val - The value to look for true if the given value equals the value in this SQLBoolean,false if not |
estimateMemoryUsage | public int estimateMemoryUsage()(Code) | | |
falseTruthValue | public static SQLBoolean falseTruthValue()(Code) | | Return a false truth value.
A SQLBoolean representing the FALSE truth value |
getBoolean | public boolean getBoolean()(Code) | | |
getImmutable | public BooleanDataValue getImmutable()(Code) | | Return an immutable BooleanDataValue with the same value as this.
An immutable BooleanDataValue with the same value as this. |
getLength | public int getLength()(Code) | | |
greaterOrEquals | public BooleanDataValue greaterOrEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code) | | The >= operator as called from the language module, as opposed to
the storage module.
Parameters: left - The value on the left side of the >= Parameters: right - The value on the right side of the >= A SQL boolean value telling whether the left operand isgreater than or equal to the right operand exception: StandardException - Thrown on error |
hashCode | public int hashCode()(Code) | | |
is | public BooleanDataValue is(BooleanDataValue otherValue)(Code) | | The SQL IS operator - consult any standard SQL reference for an explanation.
Implements the following truth table:
otherValue
| TRUE | FALSE | UNKNOWN
this |----------------------------
|
TRUE | TRUE | FALSE | FALSE
FALSE | FALSE | TRUE | FALSE
UNKNOWN | FALSE | FALSE | TRUE
Parameters: otherValue - BooleanDataValue to compare to. May be TRUE, FALSE, or UNKNOWN. whether this IS otherValue |
isNot | public BooleanDataValue isNot(BooleanDataValue otherValue)(Code) | | Implements NOT IS. This reverses the sense of the is() call.
Parameters: otherValue - BooleanDataValue to compare to. May be TRUE, FALSE, or UNKNOWN. NOT( this IS otherValue ) |
isNull | public boolean isNull()(Code) | | |
lessOrEquals | public BooleanDataValue lessOrEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code) | | The <= operator as called from the language module, as opposed to
the storage module.
Parameters: left - The value on the left side of the <= Parameters: right - The value on the right side of the <= A SQL boolean value telling whether the left operand isless than or equal to the right operand exception: StandardException - Thrown on error |
or | public BooleanDataValue or(BooleanDataValue otherValue)(Code) | | The OR operator. This implements SQL semantics for OR with unknown
truth values - consult any standard SQL reference for an explanation.
Parameters: otherValue - The other boolean to OR with this one this OR otherValue |
setValue | public void setValue(byte theValue)(Code) | | |
setValue | public void setValue(short theValue)(Code) | | |
setValue | public void setValue(int theValue)(Code) | | |
setValue | public void setValue(long theValue)(Code) | | |
setValue | public void setValue(float theValue)(Code) | | |
setValue | public void setValue(double theValue)(Code) | | |
setValue | public void setValue(byte[] theValue)(Code) | | Set the value of this BooleanDataValue to the given byte array value
Parameters: theValue - The value to set this BooleanDataValue to |
setValue | public void setValue(String theValue) throws StandardException(Code) | | Set the value of this BooleanDataValue to the given String.
String is trimmed and upcased. If resultant string is not
TRUE or FALSE, then an error is thrown.
Parameters: theValue - The value to set this BooleanDataValue to exception: StandardException - Thrown on error |
throwExceptionIfFalse | public BooleanDataValue throwExceptionIfFalse(String sqlState, String tableName, String constraintName) throws StandardException(Code) | | Throw an exception with the given SQLState if this BooleanDataValue
is false. This method is useful for evaluating constraints.
Parameters: sqlState - The SQLState of the exception to throw ifthis SQLBoolean is false. Parameters: tableName - The name of the table to include in the exceptionmessage. Parameters: constraintName - The name of the failed constraint to includein the exception message. this exception: StandardException - Thrown if this BooleanDataValueis false. |
trueTruthValue | public static SQLBoolean trueTruthValue()(Code) | | Return a true truth value.
A SQLBoolean representing the TRUE truth value |
truthValue | public static SQLBoolean truthValue(DataValueDescriptor leftOperand, DataValueDescriptor rightOperand, boolean truth)(Code) | | Return the SQL truth value for a comparison.
This method first looks at the operands - if either is null, it
returns the unknown truth value. This implements "normal" SQL
null semantics, where if any operand is null, the result is null.
Note that there are cases where these semantics are incorrect -
for example, NULL AND FALSE is supposed to be FALSE, not NULL
(the NULL truth value is the same as the UNKNOWN truth value).
If neither operand is null, it returns a static final variable
containing the SQLBoolean truth value. It returns different values
depending on whether the truth value is supposed to be nullable.
This method always returns a pre-allocated static final SQLBoolean.
This is practical because there are so few possible return values.
Using pre-allocated values allows us to avoid constructing new
SQLBoolean values during execution.
Parameters: leftOperand - The left operand of the binary comparison Parameters: rightOperand - The right operand of the binary comparison Parameters: truth - The truth value of the comparison A SQLBoolean containing the desired truth value. |
truthValue | public static SQLBoolean truthValue(boolean value)(Code) | | Get a truth value.
Parameters: value - The value of the SQLBoolean A SQLBoolean with the given truth value |
typeToBigDecimal | public int typeToBigDecimal()(Code) | | Implementation for BOOLEAN type. Convert to a BigDecimal using long
|
unknownTruthValue | public static SQLBoolean unknownTruthValue()(Code) | | Return an unknown truth value. Check to be sure the return value is
nullable.
A SQLBoolean representing the UNKNOWN truth value |
Methods inherited from org.apache.derby.iapi.types.DataType | public void checkHostVariable(int declaredLength) throws StandardException(Code)(Java Doc) public Object cloneObject()(Code)(Java Doc) public DataValueDescriptor coalesce(DataValueDescriptor[] argumentsList, DataValueDescriptor returnValue) throws StandardException(Code)(Java Doc) public boolean compare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV) throws StandardException(Code)(Java Doc) final protected StandardException dataTypeConversion(String targetType)(Code)(Java Doc) public BooleanDataValue equals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc) public boolean equals(Object other)(Code)(Java Doc) protected static int flip(int operator)(Code)(Java Doc) void genericSetObject(Object theValue) throws StandardException(Code)(Java Doc) public boolean getBoolean() throws StandardException(Code)(Java Doc) public byte getByte() throws StandardException(Code)(Java Doc) public byte[] getBytes() throws StandardException(Code)(Java Doc) public Date getDate(Calendar cal) throws StandardException(Code)(Java Doc) public double getDouble() throws StandardException(Code)(Java Doc) public float getFloat() throws StandardException(Code)(Java Doc) public int getInt() throws StandardException(Code)(Java Doc) public long getLong() throws StandardException(Code)(Java Doc) protected String getNationalString(LocaleFinder localeFinder) throws StandardException(Code)(Java Doc) public Object getObject() throws StandardException(Code)(Java Doc) public short getShort() throws StandardException(Code)(Java Doc) public InputStream getStream() throws StandardException(Code)(Java Doc) public Time getTime(Calendar cal) throws StandardException(Code)(Java Doc) public Timestamp getTimestamp(Calendar cal) throws StandardException(Code)(Java Doc) public String getTraceString() throws StandardException(Code)(Java Doc) String getTypeName(String className)(Code)(Java Doc) public BooleanDataValue greaterOrEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc) public BooleanDataValue greaterThan(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc) public BooleanDataValue in(DataValueDescriptor left, DataValueDescriptor[] inList, boolean orderedList) throws StandardException(Code)(Java Doc) final protected StandardException invalidFormat()(Code)(Java Doc) final public BooleanDataValue isNotNull()(Code)(Java Doc) final public BooleanDataValue isNullOp()(Code)(Java Doc) public BooleanDataValue lessOrEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc) public BooleanDataValue lessThan(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc) public void normalize(DataTypeDescriptor desiredType, DataValueDescriptor source) throws StandardException(Code)(Java Doc) public BooleanDataValue notEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc) final protected StandardException outOfRange()(Code)(Java Doc) public void setBigDecimal(Number bigDecimal) throws StandardException(Code)(Java Doc) protected void setFrom(DataValueDescriptor dvd) throws StandardException(Code)(Java Doc) public void setInto(PreparedStatement ps, int position) throws SQLException, StandardException(Code)(Java Doc) public void setInto(ResultSet rs, int position) throws SQLException, StandardException(Code)(Java Doc) void setObject(Object theValue) throws StandardException(Code)(Java Doc) public void setObjectForCast(Object theValue, boolean instanceOfResultType, String resultTypeClassName) throws StandardException(Code)(Java Doc) public void setToNull()(Code)(Java Doc) public void setValue(Time theValue) throws StandardException(Code)(Java Doc) public void setValue(Time theValue, Calendar cal) throws StandardException(Code)(Java Doc) public void setValue(Timestamp theValue) throws StandardException(Code)(Java Doc) public void setValue(Timestamp theValue, Calendar cal) throws StandardException(Code)(Java Doc) public void setValue(Date theValue) throws StandardException(Code)(Java Doc) public void setValue(Date theValue, Calendar cal) throws StandardException(Code)(Java Doc) public void setValue(String theValue) throws StandardException(Code)(Java Doc) public void setValue(int theValue) throws StandardException(Code)(Java Doc) public void setValue(double theValue) throws StandardException(Code)(Java Doc) public void setValue(float theValue) throws StandardException(Code)(Java Doc) public void setValue(short theValue) throws StandardException(Code)(Java Doc) public void setValue(long theValue) throws StandardException(Code)(Java Doc) public void setValue(byte theValue) throws StandardException(Code)(Java Doc) public void setValue(boolean theValue) throws StandardException(Code)(Java Doc) public void setValue(byte[] theValue) throws StandardException(Code)(Java Doc) final public void setValue(DataValueDescriptor dvd) throws StandardException(Code)(Java Doc) public void setValue(InputStream theStream, int valueLength) throws StandardException(Code)(Java Doc) public void throwLangSetMismatch(Object value) throws StandardException(Code)(Java Doc) void throwLangSetMismatch(String argTypeName) throws StandardException(Code)(Java Doc) public int typePrecedence()(Code)(Java Doc) public int typeToBigDecimal() throws StandardException(Code)(Java Doc)
|
|
|