FileDocCategorySizeDatePackage
DataTruncation.javaAPI DocAndroid 1.5 API4449Wed May 06 22:41:06 BST 2009java.sql

DataTruncation

public class DataTruncation extends SQLWarning implements Serializable
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 {@code SQLState} error code for truncated data is {@code 01004}.
since
Android 1.0

Fields Summary
private static final long
serialVersionUID
private int
index
private boolean
parameter
private boolean
read
private int
dataSize
private int
transferSize
private static final String
THE_REASON
private static final String
THE_SQLSTATE
private static final int
THE_ERROR_CODE
Constructors Summary
public DataTruncation(int index, boolean parameter, boolean read, int dataSize, int transferSize)
Creates the {@code DataTruncation} object. The reason is set to {@code "Data truncation"}, the {@code ErrorCode} is set to the {@code SQLException} default value, and the other fields are set to the values supplied as arguments.

param
index the Index value of the column value or parameter that was truncated.
param
parameter {@code true} if it was a parameter value that was truncated, {@code false} otherwise.
param
read {@code true} if the truncation occurred on a read operation, {@code false} otherwise.
param
dataSize the original size of the truncated data.
param
transferSize the size of the data after truncation.
since
Android 1.0


                                                                                                                                                                                                        
          
                
        super(THE_REASON, THE_SQLSTATE, THE_ERROR_CODE);
        this.index = index;
        this.parameter = parameter;
        this.read = read;
        this.dataSize = dataSize;
        this.transferSize = transferSize;
    
Methods Summary
public intgetDataSize()
Gets the number of bytes of data that should have been read/written.

return
the number of bytes that should have been read or written. The value is set to {@code -1} if the size is unknown.
since
Android 1.0

        return dataSize;
    
public intgetIndex()
Gets the index of the column or of the parameter that was truncated.

return
the index number of the column or of the parameter.
since
Android 1.0

        return index;
    
public booleangetParameter()
Gets whether the value truncated was a parameter value or a column value.

return
{@code true} if the value truncated was a parameter value, {@code false} if it was a column value.
since
Android 1.0

        return parameter;
    
public booleangetRead()
Gets whether the value was truncated on a read operation or a write operation

return
{@code true} if the value was truncated on a read operation, {@code false} otherwise.
since
Android 1.0

        return read;
    
public intgetTransferSize()
Gets the number of bytes of data that was actually read or written.

return
the number of bytes actually read/written. The value may be set to {@code -1} if the size is unknown.
since
Android 1.0

        return transferSize;