public class TypeNames extends Object
names.put( type, "TEXT" ); names.put( type, 255, "VARCHAR($l)" ); names.put( type, 65534, "LONGVARCHAR($l)" );will give you back the following:
names.get( type ) // --> "TEXT" (default) names.get( type, 100 ) // --> "VARCHAR(100)" (100 is in [0:255]) names.get( type, 1000 ) // --> "LONGVARCHAR(1000)" (1000 is in [256:65534]) names.get( type, 100000 ) // --> "TEXT" (default)On the other hand, simply putting
names.put( type, "VARCHAR($l)" );would result in
names.get( type ) // --> "VARCHAR($l)" (will cause trouble) names.get( type, 100 ) // --> "VARCHAR(100)" names.get( type, 10000 ) // --> "VARCHAR(10000)"
Constructor and Description |
---|
TypeNames() |
Modifier and Type | Method and Description |
---|---|
String |
get(int typeCode)
get default type name for specified type
|
String |
get(int typeCode,
long size,
int precision,
int scale)
get type name for specified type and size
|
void |
put(int typeCode,
long capacity,
String value)
Register a weighted typeCode mapping
|
void |
put(int typeCode,
String value)
Register a default (non-weighted) typeCode mapping
|
public String get(int typeCode) throws MappingException
typeCode
- the type keyMappingException
- Indicates that no registrations were made for that typeCodepublic String get(int typeCode, long size, int precision, int scale) throws MappingException
typeCode
- the type keysize
- the SQL lengthscale
- the SQL scaleprecision
- the SQL precisionMappingException
- Indicates that no registrations were made for that typeCodepublic void put(int typeCode, long capacity, String value)
typeCode
- the JDBC type codecapacity
- The capacity for this weightingvalue
- The mapping (type name)public void put(int typeCode, String value)
typeCode
- the type keyvalue
- The mapping (type name)Copyright © 2017 JBoss by Red Hat. All rights reserved.