public abstract class SQLType extends Object
TIMESTAMP '2006-09-18 00:00:00.00'. Of course,
the same SQL datatype is different for different database systems, so that different
databases have to implement different classes for the same datatype.
Database d=new OracleDatabase("user","password");
d.getSQLType(java.sql.Types.VARCHAR).format("Bobby's")
-> 'Bobby"s'
d=new MySQLDatabase("user","password","database");
d.getSQLType(java.sql.Types.VARCHAR).format("Bobby's")
-> 'Bobby\'s'
See here for a comparison of database systems.
This class provides the ANSI implementations with generous conversion capabilities.
SQLType.ANSItimestamp.format("13th of May 1980")
--> TIMESTAMP '1980-05-13 00:00:00.00'
| Modifier and Type | Class and Description |
|---|---|
static class |
SQLType.ANSIBigint |
static class |
SQLType.ANSIblob |
static class |
SQLType.ANSIboolean |
static class |
SQLType.ANSIchar |
static class |
SQLType.ANSIfloat |
static class |
SQLType.ANSIinteger |
static class |
SQLType.ANSIsmallint |
static class |
SQLType.ANSItext |
static class |
SQLType.ANSItimestamp |
static class |
SQLType.ANSIvarchar |
| Modifier and Type | Field and Description |
|---|---|
static SQLType.ANSIBigint |
ansibigint |
static SQLType.ANSIblob |
ansiblob |
static SQLType.ANSIboolean |
ansiboolean |
static SQLType.ANSIchar |
ansichar |
static SQLType.ANSIfloat |
ansifloat |
static SQLType.ANSIinteger |
ansiinteger |
static SQLType.ANSIsmallint |
ansismallint |
static SQLType.ANSItext |
ansitext |
static SQLType.ANSItimestamp |
ansitimestamp |
static SQLType.ANSIvarchar |
ansivarchar |
protected int |
scale
Holds the scale as defined in java.sql.Types
|
protected int |
typeCode
Holds the type code as defined in java.sql.Types
|
| Constructor and Description |
|---|
SQLType() |
| Modifier and Type | Method and Description |
|---|---|
abstract String |
format(Object s)
Formats an object to a valid SQL literal of the given type
|
int |
getScale()
Returns the scale java.sql.Types type
|
int |
getTypeCode()
Returns the java.sql.Types type
|
static void |
main(String[] args) |
protected int typeCode
protected int scale
public static SQLType.ANSIvarchar ansivarchar
public static SQLType.ANSIblob ansiblob
public static SQLType.ANSItext ansitext
public static SQLType.ANSIchar ansichar
public static SQLType.ANSItimestamp ansitimestamp
public static SQLType.ANSIinteger ansiinteger
public static SQLType.ANSIsmallint ansismallint
public static SQLType.ANSIfloat ansifloat
public static SQLType.ANSIboolean ansiboolean
public static SQLType.ANSIBigint ansibigint
public abstract String format(Object s)
public int getTypeCode()
public int getScale()
public static void main(String[] args)
Copyright © 2018. All rights reserved.