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的 DataTruncation为 01004 。
DataTruncation期间DataTruncation的 DataTruncation为 22001 。
Public constructors |
|
|---|---|
DataTruncation(int index, boolean parameter, boolean read, int dataSize, int transferSize) 创建 |
|
DataTruncation(int index, boolean parameter, boolean read, int dataSize, int transferSize, Throwable cause) 当 |
|
公共方法(Public methods) |
|
|---|---|
int |
getDataSize() 获取应该传输的数据的字节数。 |
int |
getIndex() 检索被截断的列或参数的索引。 |
boolean |
getParameter() 指示截断的值是参数值还是列值。 |
boolean |
getRead() 指示值是否在读取时被截断。 |
int |
getTransferSize() 获取实际传输的数据字节数。 |
继承方法(Inherited methods) |
|
|---|---|
java.sql.SQLWarning
|
|
java.sql.SQLException
|
|
java.lang.Throwable
|
|
java.lang.Object
|
|
java.lang.Iterable
|
|
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 (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. |
int getDataSize ()
获取应该传输的数据的字节数。 如果正在执行数据转换,则此数字可能是近似值。 如果大小未知,则值可能为-1 。
| 返回(Returns) | |
|---|---|
int |
the number of bytes of data that should have been transferred |
int getIndex ()
检索被截断的列或参数的索引。
如果列或参数索引未知,则这可能是-1,在这种情况下,应忽略 parameter和 read字段。
| 返回(Returns) | |
|---|---|
int |
the index of the truncated paramter or column value |
boolean getParameter ()
指示截断的值是参数值还是列值。
| 返回(Returns) | |
|---|---|
boolean |
true if the value truncated was a parameter; false if it was a column value |
boolean getRead ()
指示值是否在读取时被截断。
| 返回(Returns) | |
|---|---|
boolean |
true if the value was truncated when read from the database; false if the data was truncated on a write |
int getTransferSize ()
获取实际传输的数据字节数。 如果大小未知,则值可能为-1 。
| 返回(Returns) | |
|---|---|
int |
the number of bytes of data actually transferred |