Data types used in OQL expressions are understood by the query engine only when they are appropriately mapped via the schema of the given DataDomain. There are numerous ways of providing Genome with mapping information about a data type.
Scalar types are those data types that have a direct representation in the target relational database server. These types do not need to be introduced to the query engine as the mapping for these types is built into Genome.
Scalar types can be stored directly as fields of any persistent object. Genome treats scalar values as value types even if their corresponding CLR type is a reference type. Since scalar expressions can be expressed in the SQL language variant of the underlying relational database server, they can be used freely in any OQL expression without further considerations.
The current implementation supports the following scalar data types:
|Type||Corresponding CLR type||Microsoft SQL Server data type||Oracle data type|
float, double, decimal,
byte?, sbyte?, short?, ushort?, int?, uint?,
long?, ulong?, float?, double?, decimal?,
NullableByte, NullableSByte, NullableUInt16, NullableInt16, NullableUInt32, NullableInt32, NullableUInt64, NullableInt64,
NullableSingle, NullableDouble, NullableDecimal
|tinyint, smallint, int, bigint, float, real, decimal, money, smallmoney||number|
|SqlByte, SqlInt16, SqlInt32, SqlInt64, SqlSingle, SqlDouble, SqlDecimal, SqlMoney||tinyint, smallint, int, bigint, float, real, decimal, money, smallmoney||-|
|guid||Guid, Guid?, NullableGuid||uniqueidentifier||char(36)|
|string||string, string?, NullableString||
char, nchar, varchar, nvarchar, text, ntext,
xml (MSSQL 2005 only)
|char, nchar, varchar2, nvarchar2, clob, nclob|
|SqlString||char, nchar, varchar, nvarchar, text, ntext||-|
|OracleString||-||char, nchar, varchar2, nvarchar2, clob, nclob|
|char||char, char?, NullableChar||char(1), nchar(1)||char(1), nchar(1)|
|time||DateTime, DateTime?, NullableDateTime||smalldatetime, datetime||timestamp(9)|
|OracleDateTime, TimeSpan, OracleMonthSpan, OracleTimeSpan||-||timestamp(9), interval day(9) to second|
|boolean||bool, bool?, NullableBoolean||bit||number(1)|
|enumeration||Enum||tinyint, smallint, int, bigint||number|
|binary large objects||byte||binary, varbinary, image||blob, raw, long raw|
|SqlBinary||binary, varbinary, image||-|
|OracleBinary, OracleLob, OracleBFile||-||blob, raw, long raw, bfile|
If a type is not scalar in the target SQL platform it is possible to introduce it to the query engine by describing its translation in the schema of the DataDomain. If the translation (mapping) of a given class does not describe storage aspects of the type by providing type identity, object identity, extent provider for the class and providing a storage mapping for all member variables, the class is considered transient. Instances of these types cannot be stored in the database, however they can be used in OQL expressions as parameters with certain limitations:
Persistent types are mapped classes for which the schema of the DataDomain translates all storage aspects (type identity, object identity and extent provider).
Instances of persistent types (persistent objects) can be stored in the database in the extent (a table or several tables) provided for the type. Genome treats persistent objects as reference types. Persistent objects cannot be stored as fields of other persistent classes, but a reference to them can be stored as a foreign key relationship. Persistent types must derive from class Persistent and may not have transient member variables, i.e. all fields of a persistent object must be stored in the database.
Persistent objects may be used freely in OQL expressions even if they depend on the candidate element of a Set<T>. Properties and methods of a persistent class may be used in OQL expressions as long as mapping is provided for the used members in the schema of the DataDomain.
Genome provides native support for handling large sets of data with the Set<T> built-in data type. The Set<T> data type can contain an unordered set of persistent objects or scalar values. The query engine provides operators to filter and project as well as unite and intersect sets.
Sets can be used freely in OQL expressions. Methods and properties called from OQL expression can return sets and take sets as arguments.
The built-in Sql class provides utility methods to access aggregate functions of the underlying relational database server.