public class DataTruncation extends SQLWarning
MaxFieldSize原因,当数据值意外截断时,作为DataTruncation异常(写入)或作为DataTruncation警告(读取)报告的MaxFieldSize 。
读取期间的DataTruncation的DataTruncation为01004 。
写入期间的DataTruncation的DataTruncation为22001 。
| Constructor and Description |
|---|
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)
创建
DataTruncation与初始化为01004时的SQLState对象
read被设置为
true时和22001
read被设置为
false ,设置为“数据截断”,供应商代码设置为0的原因,而其他字段被设置为给定值。
|
| Modifier and Type | Method and Description |
|---|---|
int |
getDataSize()
获取应该传输的数据的字节数。
|
int |
getIndex()
检索被截断的列或参数的索引。
|
boolean |
getParameter()
指示truncated的值是参数值还是列值。
|
boolean |
getRead()
指示值是否在读取时被截断。
|
int |
getTransferSize()
获取实际传输的数据的字节数。
|
getNextWarning, setNextWarninggetErrorCode, getNextException, getSQLState, iterator, setNextExceptionaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic DataTruncation(int index,
boolean parameter,
boolean read,
int dataSize,
int transferSize)
DataTruncation与初始化为01004时的SQLState对象read被设置为true时和22001 read被设置为false ,设置为“数据截断”,供应商代码设置为0的原因,而其他字段被设置为给定值。
cause未初始化,可以随后通过调用Throwable.initCause(java.lang.Throwable)方法进行初始化 。
index - 参数或列值的索引
parameter - 如果参数值被截断,则为true
read - 如果读取被截断,则为true
dataSize - 数据的原始大小
transferSize - 截断后的大小
public DataTruncation(int index,
boolean parameter,
boolean read,
int dataSize,
int transferSize,
Throwable cause)
DataTruncation与初始化为01004时的SQLState对象
read被设置为
true时和22001
read被设置为
false ,设置为“数据截断”,供应商代码设置为0的原因,而其他字段被设置为给定值。
index - 参数或列值的索引
parameter - 如果参数值被截断,则为true
read - 如果读取被截断,则为true
dataSize - 数据的原始大小
transferSize - 截断后的大小
cause -底层原因DataTruncation (保存用于由稍后检索getCause()方法);
可能为空,表示原因不存在或未知。
public int getIndex()
如果列或参数索引未知,则可能为-1,在这种情况下应忽略parameter和read字段。
public boolean getParameter()
true如果true的值是一个参数;
false如果它是列值
public boolean getRead()
true如果从数据库读取值被截断;
false如果数据在写入时被截断
public int getDataSize()
-1 。
public int getTransferSize()
-1 。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.