forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOracle9iDialect.cs
73 lines (60 loc) · 2.02 KB
/
Oracle9iDialect.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System.Data;
using NHibernate.Dialect.Function;
using NHibernate.SqlCommand;
using NHibernate.SqlTypes;
namespace NHibernate.Dialect
{
public class Oracle9iDialect : Oracle8iDialect
{
public override string CurrentTimestampSelectString
{
get { return "select systimestamp from dual"; }
}
public override string CurrentTimestampSQLFunctionName
{
get
{
// the standard SQL function name is current_timestamp...
return "current_timestamp";
}
}
// Current_timestamp is a timestamp with time zone, so it can always be converted back to UTC.
/// <inheritdoc />
public override string CurrentUtcTimestampSQLFunctionName => "SYS_EXTRACT_UTC(current_timestamp)";
/// <inheritdoc />
public override string CurrentUtcTimestampSelectString =>
$"select {CurrentUtcTimestampSQLFunctionName} from dual";
/// <inheritdoc />
public override bool SupportsCurrentUtcTimestampSelection => true;
protected override void RegisterDateTimeTypeMappings()
{
RegisterColumnType(DbType.Date, "DATE");
RegisterColumnType(DbType.DateTime, "TIMESTAMP(7)");
RegisterColumnType(DbType.DateTime, 9, "TIMESTAMP($s)");
RegisterColumnType(DbType.Time, "TIMESTAMP(7)");
RegisterColumnType(DbType.Time, 9, "TIMESTAMP($s)");
RegisterColumnType(DbType.Xml, "XMLTYPE");
}
protected override void RegisterFunctions()
{
base.RegisterFunctions();
RegisterFunction(
"current_utctimestamp",
new SQLFunctionTemplate(NHibernateUtil.UtcDateTime, "SYS_EXTRACT_UTC(current_timestamp)"));
}
public override long TimestampResolutionInTicks => 1;
public override string GetSelectClauseNullString(SqlType sqlType)
{
return GetBasicSelectClauseNullString(sqlType);
}
public override CaseFragment CreateCaseFragment()
{
// Oracle did add support for ANSI CASE statements in 9i
return new ANSICaseFragment(this);
}
/// <inheritdoc />
public override bool SupportsDateTimeScale => true;
/// <inheritdoc />
public override bool SupportsRowValueConstructorSyntaxInInList => true;
}
}