protected TInstance typeForStringType(TClass tclass, DataTypeDescriptor type,
int defaultCharsetId, int defaultCollationId,
String schemaName, String tableName, String columnName) {
int charsetId, collationId;
CharacterTypeAttributes typeAttributes = type.getCharacterAttributes();
if ((typeAttributes == null) || (typeAttributes.getCharacterSet() == null)) {
charsetId = defaultCharsetId;
}
else {
charsetId = StringFactory.charsetNameToId(typeAttributes.getCharacterSet());
}
if ((typeAttributes == null) || (typeAttributes.getCollation() == null)) {
collationId = defaultCollationId;
}
else {
collationId = StringFactory.collationNameToId(typeAttributes.getCollation());
}
return tclass.instance(type.getMaximumWidth(),
charsetId, collationId,
type.isNullable());
}