Defines the translation of a member to the SQL language variant of the underlying relational database system by a raw SQL expression.
or
all, and a warning is generated during the schema compile.
The <RawSql> element can be used to map member by using special platform-specific features of the underlying relational database system. The raw-sql-expression contains an SQL expression written in the SQL language variant of the underlying relational database system.
The raw-sql-expression can contain
OQL
snippet expressions
in specific blocks surrounded by {! and !} symbols. With
OQL
snippet expressions, the same rules have to be followed as with the oql-expression
parameter of
<Oql> element
. When the member is translated,
the
OQL
snippets in the raw-sql-expression are replaced
by the translated values of the
OQL
expressions.
The accessed-type-list informs the
Genome
engine of the types whose modifications have to be updated to the database before the SQL expression can be
processed. The all keyword means that the actual accessed types cannot be defined, so
every pending modification should be updated. The none keyword specifies that the expression
does not depend on any type.
This example shows how to map the SQL-specific LIKE operator to a static method of a
helper class. This is an example only - the LIKE operator is already mapped in
Genome
as String.IsLike(String pattern) method.
SqlHelper.cs
public class SqlHelper {
static public bool IsLike(string s, string pattern) {
...
}
}
NorthwindSchema.xml
<Mapping xmlns="urn:TechTalk:TT.OODAL.XmlMapping">
...
<Type name="SqlHelper">
<Member name="IsLike" signature="string, string">
<RawSql source="{!s!} LIKE {!pattern!}" accessedTypes="none"/>
</Member>
</Type>
</Mapping>
Type: TechTalk.Genome.Mapping.RawSqlXmlData
Assembly: TechTalk.Genome.dll
Version: 4.2.4
Editions: Professional, Evaluation, Express
Database Platforms: Microsoft SQL Server 2000, Microsoft SQL Server 2005, Oracle 9i Release 2, Oracle 10g Release 2
Member Mappings | <Oql> Element