public abstract class SQLDataBase
extends java.lang.Object
This base class contains conversion methods usable by the sub classes.
Modifier and Type | Field and Description |
---|---|
static int |
ALL_READER_BYTES |
static int |
ARRAY |
static int |
BIGINT |
static int |
BINARY |
static int |
BLOB |
static int |
BLOB_LOCATOR |
static int |
BOOLEAN |
static int |
CHAR |
static int |
CHAR_FOR_BIT_DATA |
static int |
CLOB |
static int |
CLOB_LOCATOR |
static int |
DATALINK |
static int |
DATE |
static int |
DBCLOB |
static int |
DBCLOB_LOCATOR |
static int |
DECFLOAT |
static int |
DECIMAL |
static int |
DECIMAL_USING_DOUBLE |
static int |
DOUBLE |
static int |
FLOAT |
static int |
GRAPHIC |
static int |
INTEGER |
static int |
LONG_NVARCHAR |
static int |
LONG_VARCHAR |
static int |
LONG_VARCHAR_FOR_BIT_DATA |
static int |
LONG_VARGRAPHIC |
static short |
NATIVE_ARRAY |
static int |
NCHAR |
static int |
NCLOB |
static int |
NCLOB_LOCATOR |
static int |
NUMERIC |
static int |
NUMERIC_USING_DOUBLE |
static int |
NVARCHAR |
protected boolean |
outOfBounds_ |
static int |
REAL |
static int |
ROWID |
protected com.ibm.as400.access.SQLConversionSettings |
settings_ |
static int |
SMALLINT |
static int |
TIME |
static int |
TIMESTAMP |
protected int |
truncated_ |
static int |
UNDEFINED |
static int |
VARBINARY |
static int |
VARCHAR |
static int |
VARCHAR_FOR_BIT_DATA |
static int |
VARGRAPHIC |
static int |
XML_LOCATOR |
Constructor and Description |
---|
SQLDataBase(com.ibm.as400.access.SQLConversionSettings settings)
Create a new SQLDataBase object with the specified settings
|
Modifier and Type | Method and Description |
---|---|
void |
clearOutOfBounds()
Clear the out of bounds flag
|
void |
clearTruncated()
Clears the truncated information
|
abstract java.lang.Object |
clone()
Returns a clone of the SQLData object.
|
void |
convertFromRawBytes(byte[] rawBytes,
int offset,
ConvTable converter)
Loads the contents of the data from raw bytes, as returned
in a reply from the system.
|
abstract void |
convertFromRawBytes(byte[] rawBytes,
int offset,
ConvTable converter,
boolean ignoreConversionErrors)
Loads the contents of the data from raw bytes, as returned
in a reply from the system.
|
abstract void |
convertToRawBytes(byte[] rawBytes,
int offset,
ConvTable ccsidConverter)
Converts the contents of the data in raw bytes, as needed
in a request to the system.
|
abstract int |
getActualSize()
Returns the actual size of this piece of data in bytes.
|
java.sql.Array |
getArray()
Converts (returns) the data to a java.sql.Array object.
|
java.io.InputStream |
getAsciiStream()
Converts the data to a stream of ASCII characters.
|
java.lang.Object |
getBatchableObject()
Converts the data to a Java object that will be used
later when processing a batch.
|
java.math.BigDecimal |
getBigDecimal(int scale)
Converts the data to a Java BigDecimal object.
|
abstract java.io.InputStream |
getBinaryStream()
Converts the data to a stream of uninterpreted bytes.
|
abstract java.sql.Blob |
getBlob()
Converts the data to a java.sql.Blob object.
|
boolean |
getBoolean()
Converts the data to a Java boolean.
|
byte |
getByte()
Converts the data to a Java byte.
|
abstract byte[] |
getBytes()
Converts the data to a Java byte array containing
uninterpreted bytes.
|
java.io.Reader |
getCharacterStream()
Converts the data to a java.io.Reader object.
|
java.sql.Clob |
getClob()
Converts the data to a java.sql.Clob object.
|
abstract java.lang.String |
getCreateParameters()
Returns the parameters used in creating the
type.
|
java.sql.Date |
getDate(java.util.Calendar calendar)
Converts the data to a java.sql.Date object.
|
abstract int |
getDisplaySize()
Returns the display size.
|
double |
getDouble()
Converts the data to a Java double.
|
float |
getFloat()
Converts the data to a Java float.
|
int |
getInt()
Converts the data to a Java int.
|
abstract java.lang.String |
getJavaClassName()
Returns the Java class name for ParameterMetaData.getParameterClassName().
|
abstract java.lang.String |
getLiteralPrefix()
Returns the prefix used to quote a literal.
|
abstract java.lang.String |
getLiteralSuffix()
Returns the suffix used to quote a literal.
|
abstract java.lang.String |
getLocalName()
Returns the localized version of the name of the
data type.
|
long |
getLong()
Converts the data to a Java long.
|
abstract int |
getMaximumPrecision()
Returns the maximum precision of the type.
|
abstract int |
getMaximumScale()
Returns the maximum scale of the type.
|
abstract int |
getMinimumScale()
Returns the minimum scale of the type.
|
abstract int |
getNativeType()
Returns the native IBM i identifier for the type.
|
java.io.Reader |
getNCharacterStream()
Converts the data to a java.io.Reader object.
|
java.lang.String |
getNString()
Converts the data to String object.
|
abstract java.lang.Object |
getObject()
Converts the data to a Java object.
|
abstract boolean |
getOutOfBounds()
Returns true if the last conversion of this piece of
data was out of bounds of the range of the requested
datatype.
|
abstract int |
getPrecision()
Returns the precision of the type.
|
abstract int |
getRadix()
Returns the radix for the type.
|
java.lang.Object |
getSavedValue()
Obtain the save value.
|
abstract int |
getScale()
Returns the scale of the type.
|
short |
getShort()
Converts the data to a Java short.
|
abstract int |
getSQLType()
Returns the SQL type constant for the implementing class.
|
abstract java.lang.String |
getString()
Converts the data to a Java String object.
|
java.sql.Time |
getTime(java.util.Calendar calendar)
Converts the data to a java.sql.Time object.
|
java.sql.Timestamp |
getTimestamp(java.util.Calendar calendar)
Converts the data to a java.sql.Timestamp object.
|
abstract int |
getTruncated()
Returns the number of bytes truncated by the last conversion
of this piece of data.
|
abstract int |
getType()
Returns the type constant associated with the type.
|
abstract java.lang.String |
getTypeName()
Returns the name of the data type.
|
java.io.InputStream |
getUnicodeStream()
Converts the data to a stream of Unicdoe characters.
|
static boolean |
isCharacterType(int sqlType) |
abstract boolean |
isSigned()
Indicates whether the type is signed.
|
abstract boolean |
isText()
Indicates whether the type is text.
|
void |
saveValue()
Save the current value.
|
abstract void |
set(java.lang.Object object,
java.util.Calendar calendar,
int scale)
Sets the contents of the data based on a Java object.
|
void |
updateSettings(com.ibm.as400.access.SQLConversionSettings settings) |
void |
validateRawTruncatedData(byte[] rawBytes,
int offset,
ConvTable ccsidConverter)
validates that raw truncated data is correct.
|
protected int truncated_
protected boolean outOfBounds_
protected com.ibm.as400.access.SQLConversionSettings settings_
public static final short NATIVE_ARRAY
public static final int UNDEFINED
public static final int BIGINT
public static final int BINARY
public static final int BLOB
public static final int BLOB_LOCATOR
public static final int CHAR
public static final int CHAR_FOR_BIT_DATA
public static final int CLOB
public static final int CLOB_LOCATOR
public static final int DATALINK
public static final int DATE
public static final int DBCLOB
public static final int DBCLOB_LOCATOR
public static final int DECIMAL
public static final int DECIMAL_USING_DOUBLE
public static final int DOUBLE
public static final int FLOAT
public static final int GRAPHIC
public static final int INTEGER
public static final int LONG_VARCHAR
public static final int LONG_VARCHAR_FOR_BIT_DATA
public static final int LONG_VARGRAPHIC
public static final int NUMERIC
public static final int NUMERIC_USING_DOUBLE
public static final int REAL
public static final int ROWID
public static final int SMALLINT
public static final int TIME
public static final int TIMESTAMP
public static final int VARBINARY
public static final int VARCHAR
public static final int VARCHAR_FOR_BIT_DATA
public static final int VARGRAPHIC
public static final int NCLOB
public static final int NCLOB_LOCATOR
public static final int NCHAR
public static final int NVARCHAR
public static final int LONG_NVARCHAR
public static final int DECFLOAT
public static final int ARRAY
public static final int XML_LOCATOR
public static final int BOOLEAN
public static final int ALL_READER_BYTES
public SQLDataBase(com.ibm.as400.access.SQLConversionSettings settings)
settings
- public abstract java.lang.Object clone()
clone
in class java.lang.Object
public void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable converter) throws java.sql.SQLException
rawBytes
- raw bytes from the system.offset
- offset.converter
- the converter.java.sql.SQLException
- If the raw bytes are not in
the expected format.public abstract void convertFromRawBytes(byte[] rawBytes, int offset, ConvTable converter, boolean ignoreConversionErrors) throws java.sql.SQLException
rawBytes
- raw bytes from the system.offset
- offset.converter
- the converter.ignoreConversionErrors
- Should conversion errors be ignored
Used when converting packed decimal arraysjava.sql.SQLException
- If the raw bytes are not in
the expected format.public abstract void convertToRawBytes(byte[] rawBytes, int offset, ConvTable ccsidConverter) throws java.sql.SQLException
rawBytes
- the raw bytes for the system.offset
- the offset into the byte array.ccsidConverter
- the converter.java.sql.SQLException
- If a database error occurs.public void validateRawTruncatedData(byte[] rawBytes, int offset, ConvTable ccsidConverter)
rawBytes
- the raw bytes for the system.offset
- the offset into the byte array.ccsidConverter
- the converter.public abstract void set(java.lang.Object object, java.util.Calendar calendar, int scale) throws java.sql.SQLException
object
- a Java object.calendar
- The calendar.scale
- The scale.java.sql.SQLException
- If the Java object is not an
appropriate type.public abstract int getSQLType()
public abstract java.lang.String getCreateParameters()
public abstract int getDisplaySize()
public abstract java.lang.String getJavaClassName()
public abstract java.lang.String getLiteralPrefix()
public abstract java.lang.String getLiteralSuffix()
public abstract java.lang.String getLocalName()
public abstract int getMaximumPrecision()
public abstract int getMaximumScale()
public abstract int getMinimumScale()
public abstract int getNativeType()
public abstract int getPrecision()
public abstract int getRadix()
public abstract int getScale()
public abstract int getType()
public abstract java.lang.String getTypeName()
public abstract boolean isSigned()
public abstract boolean isText()
public abstract int getActualSize()
public abstract int getTruncated()
public void clearTruncated()
public abstract boolean getOutOfBounds()
public void clearOutOfBounds()
public java.io.InputStream getAsciiStream() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public java.math.BigDecimal getBigDecimal(int scale) throws java.sql.SQLException
scale
- scale, or -1 to use full scale.java.sql.SQLException
- If the conversion is not
required or not possible.public abstract java.io.InputStream getBinaryStream() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public abstract java.sql.Blob getBlob() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public boolean getBoolean() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public byte getByte() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public abstract byte[] getBytes() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public java.io.Reader getCharacterStream() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public java.sql.Clob getClob() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public java.sql.Date getDate(java.util.Calendar calendar) throws java.sql.SQLException
calendar
- The calendar.java.sql.SQLException
- If the conversion is not
required or not possible.public double getDouble() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public float getFloat() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public int getInt() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public long getLong() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public abstract java.lang.Object getObject() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public java.lang.Object getBatchableObject() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public short getShort() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public abstract java.lang.String getString() throws java.sql.SQLException
java.sql.SQLException
- If a database error occurs.public java.sql.Time getTime(java.util.Calendar calendar) throws java.sql.SQLException
calendar
- The calendar.java.sql.SQLException
- If the conversion is not
required or not possible.public java.sql.Timestamp getTimestamp(java.util.Calendar calendar) throws java.sql.SQLException
calendar
- The calendar.java.sql.SQLException
- If the conversion is not
required or not possible.public java.io.InputStream getUnicodeStream() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public java.io.Reader getNCharacterStream() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public java.lang.String getNString() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public java.sql.Array getArray() throws java.sql.SQLException
java.sql.SQLException
- If the conversion is not
required or not possible.public void updateSettings(com.ibm.as400.access.SQLConversionSettings settings)
public static boolean isCharacterType(int sqlType)
public java.lang.Object getSavedValue()
public void saveValue() throws java.sql.SQLException
java.sql.SQLException