In SQL, data types are references to Java types, whether they are primitive types or objects.
 

1 Data Types

The following table shows types by language with its corresponding SQL type, the Java type that represents it, and the possible forms of conversion from other types. Some objects are passed by value and others by referencea in function calls. An object is called comparable if it can be used in relational operators.

Types of Predefined XSQL
XSQL type SQL type JAVA type Object type Comparable Going through Alternative conversion from
string CHAR java.lang.String BASIC VALUE java.lang.Object.toString()
boolean BOOLEAN java.lang.Boolean BASIC VALUE java.lang.Object.toString()
smallint SMALINT java.lang.Short BASIC VALUE java.lang.Number, java.lang.String
integer INTEGER java.lang.Integer BASIC VALUE java.lang.Number, java.lang.String
long BIGINT java.lang.Long BASIC VALUE java.lang.Number, java.lang.String
bigint BIGINT java.lang.BigInteger BASIC VALUE java.lang.Number, java.lang.String
float FLOAT java.lang.Float BASIC VALUE java.lang.Number, java.lang.String
double DOUBLE java.lang.Double BASIC VALUE java.lang.Number, java.lang.String
decimal DECIMAL java.lang.BigDecimal BASIC VALUE java.lang.Number, java.lang.String
date DATE java.util.Date BASIC VALUE parse(java.lang.Object.toString(), "dd-MM-yyyy")
time TIME java.sql.Time BASIC VALUE parse(java.lang.Object.toString(), "HH:mm:ss")
timestamp TIMESTAMP java.sql.Timestamp BASIC VALUE parse(java.lang.Object.toString(), "dd-MM-yyyy HH:mm:ss")
dateunits JAVA_OBJECT xsql.DateUnits BASIC VALUE N/A
byte BLOB byte[] BASIC REFERENCE N/A
file BLOB java.io.File BASIC REFERENCE N/A
node JAVA_OBJECT org.w3c.Node BASIC REFERENCE N/A
element JAVA_OBJECT org.w3c.Element BASIC REFERENCE N/A
array JAVA_OBJECT java.util.ArrayList COLLECTION REFERENCE N/A
map JAVA_OBJECT java.util.HashMap COLLECTION REFERENCE N/A
vtable JAVA_OBJECT xsql.VTable COLLECTION REFERENCE N/A
object JAVA_OBJECT Specifies any type of object, be it an array, a map, etc. Can be considered a wildcard since it does not exist as a concrete type. COLLECTION Depends on the real type. VALUE OR REFERENCE depending on the real type No conversion is made
 

2 Basic Data Types

A type is referred to as basic when it refers to an individual object, either a number, a string of characters and a byte array or a pointer to a file. In all cases, the object is considered singular.

Note

Collections are not considered byte types even if they are equivalent to a byte [] (array of bytes), nor is a collection a string that represents a char [] (array of characters). The collections shown below are characterized by being vector objects or maps.

Types considered basic include:

  • string, refers to character strings.
  • smallint, number that works with values in the ranges of java.lang.Short
  • integer, number that works with values in the ranges of java.lang.Integer
  • long, number that works with values in the ranges of java.lang.Long
  • bigint, number that works with values in the ranges of java.math.BigInteger
  • float, number that works with values in the ranges of java.lang.Float
  • double, number that works with values in the ranges of java.lang.Double
  • decimal, number that works with values in the ranges of java.math.BigDecimal
  • date, that works with dates as java.util.Date
  • time, that works with hours as java.sql.Time
  • timestamp, that works with time intervals as java.sql.Timestamp
  • dateunits, that indicates temporary periods to be used in arithmetic operations regarding dates or intervals.
  • byte, that works with bytes.
  • file, that works with pointers to files as java.io.File
  • node, that works with objects org.w3c.dom.Node
  • element, that works with objects org.w3c.dom.Element
 

2.1 String

The String type represents an immutable string of characters. All literals in an XSQL routine such as "abc" are constructed as a string type object.

<string> tag allows us to declare string types contain a set of operators to examine individual characters one by one, search for substrings, extract substrings, transform to uppercase or lowercase, etc.

XSQL language includes operators for the addition and comparison of strings. It also incorporates the evaluation of expressions for equality operators: equal to, not equal to, less than and greater than string types.

 

2.2 Smallint

The smallint type maps to a java.lang. Short and represents a 16-bit integer. Like other numeric objects, the <number> tag is responsible for the creation of this type of data.

 

2.3 Integer

The integer type maps to a java.lang. Integer and represents a 32-bit integer. Like other numeric objects, the <numberr> tag is responsible for the creation of this type of data.

 

2.4 Long

The long type maps to a java.lang. Long and represents a 64-bit integer. Like other numeric objects, the <numberr> tag is responsible for the creation of this type of data.

 

2.5 BigInt

The bigint type maps to a java.math BigInteger and represents an integer of arbitrary precision. Like other numeric objects, the <number> tag is responsible for the creation of this type of data.

 

2.6 Float

The float type maps to a java.lang. Float and represents a short floating point number. Like other numeric objects, the <number> tag is responsible for the creation of this type of data.

 

2.7 Double

The double type maps wiht java.lang. Double and represents a long floating point number. Like the rest of numeric objects, the <number> tag is responsible for the creation of this type of data.

 

2.8 Decimal

The decimal type maps with java.math. BigDecimal and represents an arbitrary precision number. Like the rest of numeric objects, the <number> tag is responsible for the creation of this type of data.

 

2.9 Date

The date type maps with a java.util. Date and represents a date in coordinated universal time (CUT).

 

2.10 Time

The time type maps with a java.sql.time which is a wrapper of the java.util type. Date for SQL time types.

 

2.11 Timestamp

The timestamp type maps with java.sql.timestamp which is a wrapper of the java.util type. Date for SQL timestamp types.

 

2.12 Byte

The byte type maps with a java.lang.Byte or byte[] and represents an individual byte object or array of bytes. Generally, byte arrays are used in operations converting files to memory and vice versa.

 

2.13 File

The file type maps with a java.io. File representing a pointer to a file. In particular, the pointer can refer to conventional files or virtual system XSQL filesystems.

 

2.14 Node

The node type maps with a org.w3c.dom.Node.

 

2.15 Element

The element type maps with org.w3c.dom.Element.