Most visited

Recently visited

Added in API level 1

DataTruncation

public class DataTruncation
extends SQLWarning

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


抛出一个异常 DataTruncation异常(写入),或报告为 DataTruncation警告(读取时)数据值意外地截断了比它已经execeeded等原因 MaxFieldSize

读取期间DataTruncation的 DataTruncation01004

DataTruncation期间DataTruncation的 DataTruncation22001

Summary

Public constructors

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

创建 DataTruncation与初始化为01004时的SQLState对象 read设定为 true时和22001 read设定为 false ,设置为“数据截断”,供应商代码设置为0的原因,而其他字段被设置为给定值。

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

read设置为 true和22001时,当 read设置为 false ,原因设置为“数据截断”,供应商代码设置为0,其他字段设置为给定值时,创建一个 DataTruncation对象,并将SQLState初始化为01004 。

Public methods

int getDataSize()

获取应该传输的数据的字节数。

int getIndex()

检索被截断的列或参数的索引。

boolean getParameter()

指示截断的值是参数值还是列值。

boolean getRead()

指示值是否在读取时被截断。

int getTransferSize()

获取实际传输的数据字节数。

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)

创建DataTruncation与初始化为01004时的SQLState对象read设定为true时和22001 read设定为false ,设置为“数据截断”,供应商代码设置为0的原因,而其他字段被设置为给定值。 cause未初始化,并可能随后通过调用initCause(java.lang.Throwable)方法进行初始化。

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

DataTruncation

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

创建 DataTruncation与初始化为01004时的SQLState对象 read设定为 true时和22001 read设定为 false ,设置为“数据截断”,供应商代码设置为0的原因,而其他字段被设置为给定值。

Parameters
index int: The index of the parameter or column value
parameter boolean: true if a parameter value was truncated
read boolean: true if a read was truncated
dataSize int: the original size of the data
transferSize int: the size after truncation
cause Throwable: the underlying reason for this DataTruncation (which is saved for later retrieval by the getCause() method); may be null indicating the cause is non-existent or unknown.

Public methods

getDataSize

Added in API level 1
int getDataSize ()

获取应该传输的数据的字节数。 如果正在执行数据转换,则此数字可能是近似值。 如果大小未知,则值可能为-1

Returns
int the number of bytes of data that should have been transferred

getIndex

Added in API level 1
int getIndex ()

检索被截断的列或参数的索引。

如果列或参数索引未知,则这可能是-1,在这种情况下,应忽略 parameterread字段。

Returns
int the index of the truncated paramter or column value

getParameter

Added in API level 1
boolean getParameter ()

指示截断的值是参数值还是列值。

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

getRead

Added in API level 1
boolean getRead ()

指示值是否在读取时被截断。

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

getTransferSize

Added in API level 1
int getTransferSize ()

获取实际传输的数据字节数。 如果大小未知,则值可能为-1

Returns
int the number of bytes of data actually transferred

Hooray!