Skip to content

Most visited

Recently visited

navigation
Added in API level 1

DataTruncation

public class DataTruncation
extends SQLWarning implements Serializable

java.lang.Object
   ↳ java.lang.Throwable
     ↳ java.lang.Exception
       ↳ java.sql.SQLException
         ↳ java.sql.SQLWarning
           ↳ java.sql.DataTruncation


An exception which is thrown when a JDBC driver unexpectedly truncates a data value either when reading (resulting in warning), or when writing data (resulting in an error). The SQLState error code for truncated data is 01004.

Summary

Public constructors

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

Creates the DataTruncation object.

DataTruncation(int index, boolean parameter, boolean read, int dataSize, int transferSize, Throwable cause)

Creates a DataTruncation.

Public methods

int getDataSize()

Gets the number of bytes of data that should have been read/written.

int getIndex()

Gets the index of the column or of the parameter that was truncated.

boolean getParameter()

Gets whether the value truncated was a parameter value or a column value.

boolean getRead()

Gets whether the value was truncated on a read operation or a write operation

int getTransferSize()

Gets the number of bytes of data that was actually read or written.

Inherited methods

From class java.sql.SQLWarning
From class java.sql.SQLException
From class java.lang.Throwable
From class java.lang.Object
From interface java.lang.Iterable

Public constructors

DataTruncation

Added in API level 1
DataTruncation (int index, 
                boolean parameter, 
                boolean read, 
                int dataSize, 
                int transferSize)

Creates the DataTruncation object. The reason is set to "Data truncation", the error code is set to the SQLException default value, and the other fields are set to the values supplied as arguments.

Parameters
index int: the Index value of the column value or parameter that was truncated.
parameter boolean: true if it was a parameter value that was truncated, false otherwise.
read boolean: true if the truncation occurred on a read operation, false otherwise.
dataSize int: the original size of the truncated data.
transferSize int: the size of the data after truncation.

DataTruncation

Added in API level 9
DataTruncation (int index, 
                boolean parameter, 
                boolean read, 
                int dataSize, 
                int transferSize, 
                Throwable cause)

Creates a DataTruncation. The Reason is set to "Data truncation", the error code is set to the SQLException default value and other fields are set to the values supplied on this method.

Parameters
index int: the Index value of the column value or parameter that was truncated
parameter boolean: true if it was a Parameter value that was truncated, false otherwise
read boolean: true if the truncation occurred on a read operation, false otherwise
dataSize int: the original size of the truncated data
transferSize int: the size of the data after truncation
cause Throwable: the root reason for this DataTruncation

Public methods

getDataSize

Added in API level 1
int getDataSize ()

Gets the number of bytes of data that should have been read/written.

Returns
int the number of bytes that should have been read or written. The value is set to -1 if the size is unknown.

getIndex

Added in API level 1
int getIndex ()

Gets the index of the column or of the parameter that was truncated.

Returns
int the index number of the column or of the parameter.

getParameter

Added in API level 1
boolean getParameter ()

Gets whether the value truncated was a parameter value or a column value.

Returns
boolean true if the value truncated was a parameter value, false if it was a column value.

getRead

Added in API level 1
boolean getRead ()

Gets whether the value was truncated on a read operation or a write operation

Returns
boolean true if the value was truncated on a read operation, false otherwise.

getTransferSize

Added in API level 1
int getTransferSize ()

Gets the number of bytes of data that was actually read or written.

Returns
int the number of bytes actually read/written. The value may be set to -1 if the size is unknown.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.