-
Notifications
You must be signed in to change notification settings - Fork 13
SQL Types
One of the key principles of a relational database system is the management of strongly-typed values, according to a set of types native to the system or defined by the users.
All the types of the system, including the primitives, are nullable and support comparison and assignment to NULL
.
The primitive types are elementary forms of data types that can be used by more structured types (eg. User-Defined Types).
Conceptually the system handles numerics with a single structure of data that is scalable and dynamic (SqlNumber
), manipulated by specific type configurations.
The following SQL integer types are supported:
TINYINT
SMALLINT
-
INT
,INTEGER
BIGINT
The floating point number types allow the specification of the size of the number and the precision of the numeric:
-
FLOAT
,REAL
DOUBLE
-
NUMERIC
,DECIMAL
These kind of data values can handle just one single bit to indicate a boolean state (either true or false). It is possible to specify a boolean type using the BOOLEAN
or BIT
.
Strings handle sequence of characters in a given format and encoding, to represent data in a human-readable form.
The system supports two kind of string:
- Simple Strings (handled by
SqlString
object): these are strings supporting a maximum number of 64.000 characters - Long Strings (handled by
SqlLongString
object): they are stored as a Large Object, given a maximum size specified
The default encoding of the system is UTF-16, where not specified explicitly, that represents characters in a 2-byte form, using a wider set of the Unicode maps.
The simple strings supported are the following:
-
CHAR
: represents a string with a fixed size specified -
VARCHAR
,STRING
: supports a variable size string given a maximum number of characters specified
To define a long string is is possible to use the following types:
-
CLOB
,LONG CHARACTER VARYING
,LONG VARCHAR
When a developer provides a module to the system, it is possible to define one or more data-types to be handled.
For the system to recognize and handle a module-specified type, the developer must do the following:
- Provide one or more objects that implement
ISqlObject
contract - Inherit from
SqlType
object and override the specific features for the type, handling the implementedISqlObject
- Implement a
ITypeResolver
instance that will analyze a passed name and metadata to construct the type - Bind the implementation of the
ITypeResolver
into the System Scope at the build of the system
When defining a module, it is also possible to provide functions to operate on the type provided.
- Getting Started
- Basic Principles
- Operative Contexts
- Transactions
- Database Objects
- Data Types
- SQL Execution Plan
- SQL Model
- DeveelDB SQL Dialect
- Data Types
- Routines (Functions and Procedures)
- Collaborate
- Kernel Development
- External Contributions
- Bug Reporting
- Documentation