org.d2rq.db.types
Class SQLCharacterString
java.lang.Object
org.d2rq.db.types.DataType
org.d2rq.db.types.SQLCharacterString
public class SQLCharacterString
- extends DataType
Datatype for fixed-length character strings (e.g., CHAR but not VARCHAR).
It does not actually store the specific length.
A difference in behaviour
from SQLCharacterStringVarying
is that trailing spaces are not
reported in results. So, even if the database stores 'AAA ', the resulting
value will be 'AAA'. This seems closer to user expectations. Note that for
standard SQL and many vendors (but not all), 'AAA '='AAA', so
selecting still works. Vendors that do not compare strings in that way
should not use this class, or selecting will break.
Fields inherited from class org.d2rq.db.types.DataType |
log |
Method Summary |
boolean |
supportsDistinct()
|
String |
value(ResultSet resultSet,
int column)
Retrieves a string value in preferred format (canonical form
of the closest XSD type) from a SQL ResultSet. |
SQLCharacterString
public SQLCharacterString(String name,
boolean supportsDistinct)
supportsDistinct
public boolean supportsDistinct()
- Overrides:
supportsDistinct
in class DataType
- Returns:
true
if this column can be used in SELECT DISTINCT
queries
value
public String value(ResultSet resultSet,
int column)
throws SQLException
- Description copied from class:
DataType
- Retrieves a string value in preferred format (canonical form
of the closest XSD type) from a SQL ResultSet.
- Overrides:
value
in class DataType
- Parameters:
resultSet
- Result of a SELECT querycolumn
- The column index to retrieve; leftmost columns is 1
- Returns:
- String representation, or
null
if SQL result was null or is not representable in the XSD type
- Throws:
SQLException