站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.1.8, Java 2 SDK 英文文档

Class java.sql.DataTruncation - JDK 5 Documentation v1.1.8, Java 2 SDK 英文文档

All Packages  Class Hierarchy  This Package  Previous  Next  Index

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".


Constructor Index

 o DataTruncation(int, boolean, boolean, int, int)

Create a DataTruncation object.

Method Index

 o getDataSize()
Get the number of bytes of data that should have been transferred.
 o getIndex()
Get the index of the column or parameter that was truncated.
 o getParameter()
Is this a truncated parameter value?
 o getRead()
Was this a read truncation?
 o getTransferSize()
Get the number of bytes of data actually transferred.

Constructors

 o 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

Methods

 o 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.
 o 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.
 o 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.
 o 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
 o 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

All Packages  Class Hierarchy  This Package  Previous  Next  Index

Submit a bug or feature - Version 1.1.8 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1995-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.