Top Description Constructors Methods
org.apache.derby.iapi.types

public Class SQLVarbit

extends SQLBit
Class Inheritance
Known Direct Subclasses
org.apache.derby.iapi.types.SQLLongVarbit
Imports
org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.Limits, .SQLState, org.apache.derby.iapi.services.io.StoredFormatIds, org.apache.derby.iapi.util.StringUtil

SQLVarbit represents the SQL type VARCHAR FOR BIT DATA It is an extension of SQLBit and is virtually indistinguishable other than normalization.

Constructor Summary

AccessConstructor and Description
public
public
SQLVarbit(byte[] val)

Method Summary

Modifier and TypeMethod and Description
pack-priv int
getMaxMemoryUsage()

Overrides org.apache.derby.iapi.types.SQLBit.getMaxMemoryUsage.

Return max memory usage for a SQL Varbit

public DataValueDescriptor
getNewNull()

Overrides org.apache.derby.iapi.types.SQLBit.getNewNull.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getNewNull.

Get a new null value of the same type as this data value.

public int
public String
public void
normalize(DataTypeDescriptor
The type to normalize the source column to
desiredType
,
DataValueDescriptor
The value to normalize
source
)

Overrides org.apache.derby.iapi.types.SQLBit.normalize.

Implements org.apache.derby.iapi.types.DataValueDescriptor.normalize.

Normalization method - this method may be called when putting a value into a SQLBit, for example, when inserting into a SQLBit column.

public void
setWidth(int
the desired length
desiredWidth
,
int
the desired scale (ignored)
desiredScale
,
boolean
throw error on truncation
errorOnTrunc
)

Overrides org.apache.derby.iapi.types.SQLBit.setWidth.

Implements org.apache.derby.iapi.types.VariableSizeDataValue.setWidth.

Set the width of the to the desired value.

public int
Inherited from org.apache.derby.iapi.types.SQLBit:
getObjectsetObjectsetValueFromResultSet

Constructor Detail

SQLVarbitback to summary
public SQLVarbit()
SQLVarbitback to summary
public SQLVarbit(byte[] val)

Method Detail

getMaxMemoryUsageback to summary
pack-priv int getMaxMemoryUsage()

Overrides org.apache.derby.iapi.types.SQLBit.getMaxMemoryUsage.

Return max memory usage for a SQL Varbit

getNewNullback to summary
public DataValueDescriptor getNewNull()

Overrides org.apache.derby.iapi.types.SQLBit.getNewNull.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getNewNull.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getNewNull.

Get a new null value of the same type as this data value.

See Also
DataValueDescriptor#getNewNull
getTypeFormatIdback to summary
public int getTypeFormatId()

Overrides org.apache.derby.iapi.types.SQLBit.getTypeFormatId.

Implements org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

Return my format identifier.

Returns:int

Doc from org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

The identifier. (A UUID stuffed in an array of 16 bytes).

See Also
org.apache.derby.iapi.services.io.TypedFormat#getTypeFormatId
getTypeNameback to summary
public String getTypeName()

Overrides org.apache.derby.iapi.types.SQLBit.getTypeName.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getTypeName.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getTypeName.

Get the SQL name of the datatype

Returns:String

The SQL name of the datatype

normalizeback to summary
public void normalize(DataTypeDescriptor desiredType, DataValueDescriptor source) throws StandardException

Overrides org.apache.derby.iapi.types.SQLBit.normalize.

Implements org.apache.derby.iapi.types.DataValueDescriptor.normalize.

Normalization method - this method may be called when putting a value into a SQLBit, for example, when inserting into a SQLBit column. See NormalizeResultSet in execution.

Parameters
desiredType:DataTypeDescriptor

The type to normalize the source column to

source:DataValueDescriptor

The value to normalize

Exceptions
StandardException:
Thrown for null into non-nullable column, and for truncation error
setWidthback to summary
public void setWidth(int desiredWidth, int desiredScale, boolean errorOnTrunc) throws StandardException

Overrides org.apache.derby.iapi.types.SQLBit.setWidth.

Implements org.apache.derby.iapi.types.VariableSizeDataValue.setWidth.

Set the width of the to the desired value. Used when CASTing. Ideally we'd recycle normalize(), but the behavior is different (we issue a warning instead of an error, and we aren't interested in nullability).

Parameters
desiredWidth:int

the desired length

desiredScale:int

the desired scale (ignored)

errorOnTrunc:boolean

throw error on truncation

Exceptions
StandardException:
Thrown on non-zero truncation if errorOnTrunc is true
typePrecedenceback to summary
public int typePrecedence()

Overrides org.apache.derby.iapi.types.SQLBit.typePrecedence.

Implements org.apache.derby.iapi.types.DataValueDescriptor.typePrecedence.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.typePrecedence.

Each built-in type in JSQL has a precedence. This precedence determines how to do type promotion when using binary operators. For example, float has a higher precedence than int, so when adding an int to a float, the result type is float. The precedence for some types is arbitrary. For example, it doesn't matter what the precedence of the boolean type is, since it can't be mixed with other types. But the precedence for the number types is critical. The SQL standard requires that exact numeric types be promoted to approximate numeric when one operator uses both. Also, the precedence is arranged so that one will not lose precision when promoting a type.

Returns:int

The precedence of this type.

See Also
DataValueDescriptor#typePrecedence