forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInformixDialect0940.cs
150 lines (139 loc) · 5.59 KB
/
InformixDialect0940.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
using System.Data;
using NHibernate.Cfg;
using NHibernate.Dialect.Function;
using NHibernate.SqlCommand;
using System.Data.Common;
using NHibernate.Exceptions;
using NHibernate.Util;
//using NHibernate.Dialect.Schema;
using Environment = NHibernate.Cfg.Environment;
namespace NHibernate.Dialect
{
/// <summary>
/// Summary description for InformixDialect.
/// This dialect is intended to work with IDS version 9.40
/// </summary>
/// <remarks>
/// The InformixDialect defaults the following configuration properties:
/// <list type="table">
/// <listheader>
/// <term>ConnectionDriver</term>
/// <description>NHibernate.Driver.OdbcDriver</description>
/// <term>PrepareSql</term>
/// <description>true</description>
/// </listheader>
/// <item>
/// <term>connection.driver_class</term>
/// <description><see cref="NHibernate.Driver.OdbcDriver" /></description>
/// </item>
/// </list>
/// </remarks>
public class InformixDialect0940 : InformixDialect
{
/// <summary></summary>
public InformixDialect0940()
: base()
{
RegisterColumnType(DbType.AnsiString, 2147483647, "CLOB");
RegisterColumnType(DbType.Binary, 2147483647, "BLOB");
RegisterColumnType(DbType.Binary, "BLOB");
RegisterColumnType(DbType.String, 2147483647, "CLOB");
}
/// <summary> Get the select command used retrieve the names of all sequences.</summary>
/// <returns> The select command; or null if sequences are not supported. </returns>
public override string QuerySequencesString
{
get
{
return "select tabname from systables where tabtype='Q'";
}
}
/// <summary>
/// Does this dialect support sequences?
/// </summary>
public override bool SupportsSequences
{
get { return true; }
}
/// <summary>
/// Does this dialect support "pooled" sequences. Not aware of a better
/// name for this. Essentially can we specify the initial and increment values?
/// </summary>
/// <returns> True if such "pooled" sequences are supported; false otherwise. </returns>
public override bool SupportsPooledSequences
{
get { return true; }
}
/// <summary>
/// Generate the appropriate select statement to to retrieve the next value
/// of a sequence.
/// </summary>
/// <param name="sequenceName">the name of the sequence </param>
/// <returns> String The "nextval" select string. </returns>
/// <remarks>This should be a "stand alone" select statement.</remarks>
public override string GetSequenceNextValString(string sequenceName)
{
return "select " + GetSelectSequenceNextValString(sequenceName) + " from systables where tabid=1";
}
public override string GetDropSequenceString(string sequenceName)
{
return "drop sequence " + sequenceName;
}
/// <summary>
/// Generate the select expression fragment that will retrieve the next
/// value of a sequence as part of another (typically DML) statement.
/// </summary>
/// <param name="sequenceName">the name of the sequence </param>
/// <returns> The "nextval" fragment. </returns>
/// <remarks>
/// This differs from <see cref="GetSequenceNextValString"/> in that this
/// should return an expression usable within another statement.
/// </remarks>
public override string GetSelectSequenceNextValString(string sequenceName)
{
return sequenceName + ".nextval";
}
public override string GetCreateSequenceString(string sequenceName)
{
return "create sequence " + sequenceName;
// +
//" INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE CACHE 20 NOORDER";
}
// in .NET overloaded version cannot be overriden (in Java allowed)
//protected override string GetCreateSequenceString(string sequenceName, int initialValue, int incrementSize)
//{
// return "create sequence " + sequenceName +
// " INCREMENT BY " + incrementSize.ToString() +
// " START WITH " + initialValue.ToString() +
// " MINVALUE 1 NOCYCLE CACHE 20 NOORDER";
//}
/// <summary>
/// Create a <see cref="JoinFragment"/> strategy responsible
/// for handling this dialect's variations in how joins are handled.
/// </summary>
/// <returns> This dialect's <see cref="JoinFragment"/> strategy. </returns>
public override JoinFragment CreateOuterJoinFragment()
{
// ANSI join exist from 9.21 but CROSS, RIGHT and FULL were introduced in 9.40;
return new ANSIJoinFragment();
}
/// <summary>
/// Does this Dialect have some kind of <c>LIMIT</c> syntax?
/// </summary>
/// <value>False, unless overridden.</value>
public override bool SupportsLimit
{
get { return false; }
}
/// <summary>
/// Does this Dialect support an offset?
/// </summary>
public override bool SupportsLimitOffset
{
get { return false; }
}
// Informix 9 is said on Internet to be limited to 128. (http://www.justskins.com/forums/length-of-columns-names-143294.html)
/// <inheritdoc />
public override int MaxAliasLength => 128;
};
}