Java Platform 1.2
Beta 4

Class java.sql.DataTruncation

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.sql.SQLException
                    |
                    +--java.sql.SQLWarning
                          |
                          +--java.sql.DataTruncation

public class DataTruncation
extends SQLWarning

When JDBC unexpectedly truncates a data value, it reports a DataTruncation warning (on reads) or throws a DataTruncation exception (on writes).

The SQLstate for a DataTruncation is "01004".

See Also:
Serialized Form

Constructor Summary
DataTruncation(int index, boolean parameter, boolean read, int dataSize, int transferSize)
          Create a DataTruncation object.
 
Method Summary
 int getDataSize()
          Get the number of bytes of data that should have been transferred.
 int getIndex()
          Get the index of the column or parameter that was truncated.
 boolean getParameter()
          Is this a truncated parameter value?
 boolean getRead()
          Was this a read truncation?
 int getTransferSize()
          Get the number of bytes of data actually transferred.
 
Methods inherited from class java.sql.SQLWarning
getNextWarning , setNextWarning
 
Methods inherited from class java.sql.SQLException
getErrorCode , getNextException , getSQLState , setNextException
 
Methods inherited from class java.lang.Throwable
fillInStackTrace , getLocalizedMessage , getMessage , printStackTrace , printStackTrace , printStackTrace , toString
 
Methods inherited from class java.lang.Object
clone , equals , finalize , getClass , hashCode , notify , notifyAll , wait , wait , wait
 

Constructor Detail

DataTruncation

public DataTruncation(int index,
                      boolean parameter,
                      boolean read,
                      int dataSize,
                      int transferSize)

Create a DataTruncation object. The SQLState is initialized to 01004, the reason is set to "Data truncation" and the vendorCode is set to the SQLException default.

Parameters:
index - The index of the parameter or column value
parameter - true if a parameter value was truncated
read - true if a read was truncated
dataSize - the original size of the data
transferSize - the size after truncation
Method Detail

getIndex

public int getIndex()
Get the index of the column or parameter that was truncated.

This may be -1 if the column or parameter index is unknown, in which case the "parameter" and "read" fields should be ignored.

Returns:
the index of the truncated paramter or column value.

getParameter

public boolean getParameter()
Is this a truncated parameter value?
Returns:
True if the value was a parameter; false if it was a column value.

getRead

public boolean getRead()
Was this a read truncation?
Returns:
True if the value was truncated when read from the database; false if the data was truncated on a write.

getDataSize

public int getDataSize()
Get the number of bytes of data that should have been transferred. This number may be approximate if data conversions were being performed. The value may be "-1" if the size is unknown.
Returns:
the number of bytes of data that should have been transferred

getTransferSize

public int getTransferSize()
Get the number of bytes of data actually transferred. The value may be "-1" if the size is unknown.
Returns:
the number of bytes of data actually transferred

Java Platform 1.2
Beta 4

Submit a bug or feature
Submit comments/suggestions about new javadoc look
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.
This documentation was generated with a post-Beta4 version of Javadoc.