public class CharType extends Object implements ExtendedType<String>
java.lang.String, mapping it as either of JDBC types -
CLOB or (VAR)CHAR. Can be configured to trim trailing spaces.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
trimmingChars |
protected boolean |
usingClobs |
| Constructor and Description |
|---|
CharType(boolean trimmingChars,
boolean usingClobs) |
| Modifier and Type | Method and Description |
|---|---|
String |
getClassName()
Returns "java.lang.String".
|
boolean |
isTrimmingChars()
Returns
true if 'materializeObject' method should trim
trailing spaces from the CHAR columns. |
boolean |
isUsingClobs() |
String |
materializeObject(CallableStatement cs,
int index,
int type)
Reads an object from a stored procedure OUT parameter, converting it to class
returned by 'getClassName' method.
|
String |
materializeObject(ResultSet rs,
int index,
int type)
Return trimmed string.
|
protected String |
readCharStream(ResultSet rs,
int index) |
protected String |
readClob(Clob clob) |
protected String |
readValueStream(Reader in,
int streamSize,
int bufSize) |
protected String |
rtrim(String value)
Trim right spaces.
|
void |
setJdbcObject(PreparedStatement st,
String value,
int pos,
int type,
int scale)
Initializes a single parameter of a PreparedStatement with object value.
|
void |
setTrimmingChars(boolean trimingChars) |
void |
setUsingClobs(boolean usingClobs) |
String |
toString(String value)
Converts value of the supported type to a human-readable String representation.
|
public String getClassName()
getClassName in interface ExtendedType<String>public String materializeObject(ResultSet rs, int index, int type) throws Exception
materializeObject in interface ExtendedType<String>Exception - if read error occurred, or an object can't be converted to a
target Java class.public String materializeObject(CallableStatement cs, int index, int type) throws Exception
ExtendedTypematerializeObject in interface ExtendedType<String>Exception - if read error occurred, or an object can't be converted to a
target Java class.public void setJdbcObject(PreparedStatement st, String value, int pos, int type, int scale) throws Exception
ExtendedTypesetJdbcObject in interface ExtendedType<String>Exceptionpublic String toString(String value)
ExtendedTypetoString in interface ExtendedType<String>value - a value to convert to String.protected String readClob(Clob clob) throws IOException, SQLException
IOExceptionSQLExceptionprotected String readCharStream(ResultSet rs, int index) throws IOException, SQLException
IOExceptionSQLExceptionprotected String readValueStream(Reader in, int streamSize, int bufSize) throws IOException
IOExceptionpublic boolean isTrimmingChars()
true if 'materializeObject' method should trim
trailing spaces from the CHAR columns. This addresses an issue with some
JDBC drivers (e.g. Oracle), that return Strings for CHAR columns padded
with spaces.public void setTrimmingChars(boolean trimingChars)
public boolean isUsingClobs()
public void setUsingClobs(boolean usingClobs)
Copyright © 2001–2023 Apache Cayenne. All rights reserved.