java.sql
Class DataTruncation

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.lang.Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable 
      extended by java.lang.Exception sample code for java.lang.Exception definition code for java.lang.Exception 
          extended by java.sql.SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
              extended by java.sql.SQLWarning sample code for java.sql.SQLWarning definition code for java.sql.SQLWarning 
                  extended by java.sql.DataTruncation
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable

public class DataTruncation
extends SQLWarning sample code for java.sql.SQLWarning definition code for java.sql.SQLWarning

An exception that reports a DataTruncation warning (on reads) or throws a DataTruncation exception (on writes) when JDBC unexpectedly truncates a data value.

The SQLstate for a DataTruncation is 01004.

See Also:
Serialized Form

Constructor Summary
DataTruncation sample code for java.sql.DataTruncation.DataTruncation(int, boolean, boolean, int, int) definition code for java.sql.DataTruncation.DataTruncation(int, boolean, boolean, int, int) (int index, boolean parameter, boolean read, int dataSize, int transferSize)
          Creates a DataTruncation object with the SQLState initialized to 01004, the reason set to "Data truncation", the vendorCode set to the SQLException default, and the other fields set to the given values.
 
Method Summary
 int getDataSize sample code for java.sql.DataTruncation.getDataSize() definition code for java.sql.DataTruncation.getDataSize() ()
          Gets the number of bytes of data that should have been transferred.
 int getIndex sample code for java.sql.DataTruncation.getIndex() definition code for java.sql.DataTruncation.getIndex() ()
          Retrieves the index of the column or parameter that was truncated.
 boolean getParameter sample code for java.sql.DataTruncation.getParameter() definition code for java.sql.DataTruncation.getParameter() ()
          Indicates whether the value truncated was a parameter value or a column value.
 boolean getRead sample code for java.sql.DataTruncation.getRead() definition code for java.sql.DataTruncation.getRead() ()
          Indicates whether or not the value was truncated on a read.
 int getTransferSize sample code for java.sql.DataTruncation.getTransferSize() definition code for java.sql.DataTruncation.getTransferSize() ()
          Gets the number of bytes of data actually transferred.
 
Methods inherited from class java.sql.SQLWarning sample code for java.sql.SQLWarning definition code for java.sql.SQLWarning
getNextWarning sample code for java.sql.SQLWarning.getNextWarning() definition code for java.sql.SQLWarning.getNextWarning() , setNextWarning sample code for java.sql.SQLWarning.setNextWarning(java.sql.SQLWarning) definition code for java.sql.SQLWarning.setNextWarning(java.sql.SQLWarning)
 
Methods inherited from class java.sql.SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException
getErrorCode sample code for java.sql.SQLException.getErrorCode() definition code for java.sql.SQLException.getErrorCode() , getNextException sample code for java.sql.SQLException.getNextException() definition code for java.sql.SQLException.getNextException() , getSQLState sample code for java.sql.SQLException.getSQLState() definition code for java.sql.SQLException.getSQLState() , setNextException sample code for java.sql.SQLException.setNextException(java.sql.SQLException) definition code for java.sql.SQLException.setNextException(java.sql.SQLException)
 
Methods inherited from class java.lang.Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable
fillInStackTrace sample code for java.lang.Throwable.fillInStackTrace() definition code for java.lang.Throwable.fillInStackTrace() , getCause sample code for java.lang.Throwable.getCause() definition code for java.lang.Throwable.getCause() , getLocalizedMessage sample code for java.lang.Throwable.getLocalizedMessage() definition code for java.lang.Throwable.getLocalizedMessage() , getMessage sample code for java.lang.Throwable.getMessage() definition code for java.lang.Throwable.getMessage() , getStackTrace sample code for java.lang.Throwable.getStackTrace() definition code for java.lang.Throwable.getStackTrace() , initCause sample code for java.lang.Throwable.initCause(java.lang.Throwable) definition code for java.lang.Throwable.initCause(java.lang.Throwable) , printStackTrace sample code for java.lang.Throwable.printStackTrace() definition code for java.lang.Throwable.printStackTrace() , printStackTrace sample code for java.lang.Throwable.printStackTrace(java.io.PrintStream) definition code for java.lang.Throwable.printStackTrace(java.io.PrintStream) , printStackTrace sample code for java.lang.Throwable.printStackTrace(java.io.PrintWriter) definition code for java.lang.Throwable.printStackTrace(java.io.PrintWriter) , setStackTrace sample code for java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[]) definition code for java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[]) , toString sample code for java.lang.Throwable.toString() definition code for java.lang.Throwable.toString()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

DataTruncation sample code for java.sql.DataTruncation(int, boolean, boolean, int, int) definition code for java.sql.DataTruncation(int, boolean, boolean, int, int)

public DataTruncation(int index,
                      boolean parameter,
                      boolean read,
                      int dataSize,
                      int transferSize)
Creates a DataTruncation object with the SQLState initialized to 01004, the reason set to "Data truncation", the vendorCode set to the SQLException default, and the other fields set to the given values.

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 sample code for java.sql.DataTruncation.getIndex() definition code for java.sql.DataTruncation.getIndex()

public int getIndex()
Retrieves 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 sample code for java.sql.DataTruncation.getParameter() definition code for java.sql.DataTruncation.getParameter()

public boolean getParameter()
Indicates whether the value truncated was a parameter value or a column value.

Returns:
true if the value truncated was a parameter; false if it was a column value

getRead sample code for java.sql.DataTruncation.getRead() definition code for java.sql.DataTruncation.getRead()

public boolean getRead()
Indicates whether or not the value was truncated on a read.

Returns:
true if the value was truncated when read from the database; false if the data was truncated on a write

getDataSize sample code for java.sql.DataTruncation.getDataSize() definition code for java.sql.DataTruncation.getDataSize()

public int getDataSize()
Gets 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 sample code for java.sql.DataTruncation.getTransferSize() definition code for java.sql.DataTruncation.getTransferSize()

public int getTransferSize()
Gets 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