Building Queries and Data Views
|
Overview
In relational databases, data types are described using two methods. The conventional way is to use a JDBC number. For example, an integer is 4, varchar is 12, a date is 91, an so on. These numbers are represented by constants in the java.sql.Types class, such as Types.INTEGER = 4 and Types.VARCHAR = 12. This numbering system describes all the JDBC standardized types. However, there are many vendor-specific types, and most of them use the default JDBC number 1111, meaning "other." For this method, there is a name instead of a number associated with each type.
The Liquid Data query generation engine first looks at the JDBC number for a match. If no match occurs, then it uses the name. For example, if the number is 1111, then the query generation engine looks for a name. If there is no match found for either one, the query generation engine treats the column as a string.
Depending on the type of database you access, you need to map external database fields with a compatible data type when you invoke Liquid Data functions. You will notice that some external data types are not supported by Liquid Data. You may need to transform these data types to a supported type before you access that data in a query. The following tables can help you make these decisions.
JDBC Types
The following table maps the JDBC type to the appropriate data type that you should use with Liquid Data.
JDBC Type
|
Liquid Data Data Type
|
Types.ARRAY
|
not supported
|
Types.BIGINT
|
xs:long
|
Types.BINARY
|
xs:string
|
Types.BIT
|
xs:boolean
|
Types.BLOB
|
not supported
|
Types.CHAR
|
xs:string
|
Types.CLOB
|
not supported
|
Types.DATE
|
xs:date
|
Types.DECIMAL
|
xs:decimal
|
Types.DOUBLE
|
xs:double
|
Types.FLOAT
|
xs:double
|
Types.INTEGER
|
xs:integer
|
Types.JAVA_OBJECT
|
not supported
|
Types.LONGVARBINARY
|
xs:string
|
Types.LONGVARCHAR
|
xs:string
|
Types.NUMERIC
|
xs:decimal
|
Types.REAL
|
xs:float
|
Types.REF
|
xs:string
|
Types.SMALLINT
|
xs:short
|
Types.STRUCT
|
not supported
|
Types.TIME
|
xs:time
|
Types.TIMESTAMP
|
xs:dateTime
|
Types.TINYINT
|
xs:byte
|
Types.VARBINARY
|
xs:string
|
Types.VARCHAR
|
xs:string
|
JDBC Names
The following table maps the JDBC name to Liquid Data data types.
JDBC Name
|
Liquid Data Data Type
|
ARRAY
|
not supported
|
BIGINT
|
xs:long
|
BINARY
|
xs:string
|
BIT
|
xs:boolean
|
BLOB
|
not supported
|
CHAR
|
xs:string
|
CLOB
|
not supported
|
DATE
|
xs:date
|
DEC
|
xs:decimal
|
DECIMAL
|
xs:decimal
|
DOUBLE
|
xs:double
|
FLOAT
|
xs:double
|
INTEGER
|
xs:integer
|
JAVA_OBJECT
|
not supported
|
LONGVARBINARY
|
xs:string
|
LONGVARCHAR
|
xs:string
|
NUM
|
xs:decimal
|
NUMERIC
|
xs:decimal
|
REAL
|
xs:float
|
REF
|
xs:string
|
SMALLINT
|
xs:short
|
STRUCT
|
not supported
|
TIME
|
xs:time
|
TIMESTAMP
|
xs:dateTime
|
TINYINT
|
xs:byte
|
VARBINARY
|
xs:string
|
VARCHAR
|
xs:string
|