Package adams.db.types
Class AbstractTypes
- java.lang.Object
-
- adams.db.types.AbstractTypes
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
TypesH2
,TypesMySQL
,TypesPostgreSQL
,TypesSQLite
public abstract class AbstractTypes extends Object implements Serializable
Ancestor for SQL types classes.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static Map<String,AbstractTypes>
m_Cache
for caching types on URLs.protected static List<AbstractTypes>
m_Types
the available types.static int
MAX_MEDIUMTEXT
max size of MEDIUMTEXT.static int
MAX_TEXT
max size of TEXT.static int
MAX_VARCHAR
max size of varchar.
-
Constructor Summary
Constructors Constructor Description AbstractTypes()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
actualSize(int type, int size)
Get the actual size of type.static AbstractTypes
getHandler(String url)
Returns the handler for the JDBC url.abstract boolean
handles(String url)
Checks whether this URL is handled.abstract String
regexpKeyword()
Returns the keyword for regular expression matching in queries.abstract String
toTypeString(int type, int size, boolean compare)
Get a string representation of this type for comparison or create purposes.
-
-
-
Field Detail
-
MAX_VARCHAR
public static final int MAX_VARCHAR
max size of varchar.- See Also:
- Constant Field Values
-
MAX_TEXT
public static final int MAX_TEXT
max size of TEXT.- See Also:
- Constant Field Values
-
MAX_MEDIUMTEXT
public static final int MAX_MEDIUMTEXT
max size of MEDIUMTEXT.- See Also:
- Constant Field Values
-
m_Cache
protected static Map<String,AbstractTypes> m_Cache
for caching types on URLs.
-
m_Types
protected static List<AbstractTypes> m_Types
the available types.
-
-
Method Detail
-
toTypeString
public abstract String toTypeString(int type, int size, boolean compare)
Get a string representation of this type for comparison or create purposes.- Parameters:
type
- the typesize
- the sizecompare
- if true then a string for comparison is returned, otherwise for creation- Returns:
- string representation of this type
-
actualSize
public int actualSize(int type, int size)
Get the actual size of type.- Returns:
- size
-
regexpKeyword
public abstract String regexpKeyword()
Returns the keyword for regular expression matching in queries.- Returns:
- the keyword
-
handles
public abstract boolean handles(String url)
Checks whether this URL is handled.- Parameters:
url
- the URL to check- Returns:
- true if handled by this type class
-
getHandler
public static AbstractTypes getHandler(String url)
Returns the handler for the JDBC url.- Parameters:
url
- the URL- Returns:
- the handler
- Throws:
IllegalArgumentException
- if JDBC connection type not supported
-
-