Class java.sql.DataTruncation
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".
-
DataTruncation(int, boolean, boolean, int, int)
-
Create a DataTruncation object.
-
getDataSize()
- Get the number of bytes of data that should have been transferred.
-
getIndex()
- Get the index of the column or parameter that was truncated.
-
getParameter()
- Is this a truncated parameter value?
-
getRead()
- Was this a read truncation?
-
getTransferSize()
- Get the number of bytes of data actually transferred.
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
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.
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.
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.
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
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