Skip to content

Commit 5a10e68

Browse files
gamblenoskarb
authored andcommitted
Sequence support for Ingres9
1 parent 20f8098 commit 5a10e68

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

src/NHibernate/Dialect/Ingres9Dialect.cs

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,15 @@ public override bool SupportsLimitOffset
3030
{
3131
get { return true; }
3232
}
33-
33+
34+
/// <summary>
35+
/// Does this dialect support sequences?
36+
/// </summary>
37+
public override bool SupportsSequences
38+
{
39+
get { return true; }
40+
}
41+
3442
/// <summary>
3543
/// Attempts to add a <c>LIMIT</c> clause to the given SQL <c>SELECT</c>.
3644
/// Expects any database-specific offset and limit adjustments to have already been performed (ex. UseMaxForLimit, OffsetStartsAtOne).
@@ -64,5 +72,32 @@ public override SqlString GetLimitString(SqlString queryString, SqlString offset
6472

6573
return pagingBuilder.ToSqlString();
6674
}
75+
76+
/// <summary>
77+
/// Generate the appropriate select statement to retrieve the next value
78+
/// of a sequence.
79+
/// </summary>
80+
/// <param name="sequenceName">the name of the sequence </param>
81+
/// <returns> String The "nextval" select string. </returns>
82+
/// <remarks>This should be a "stand alone" select statement.</remarks>
83+
public override string GetSequenceNextValString(string sequenceName)
84+
{
85+
return "select " + GetSelectSequenceNextValString(sequenceName) + " as seq";
86+
}
87+
88+
/// <summary>
89+
/// Generate the select expression fragment that will retrieve the next
90+
/// value of a sequence as part of another (typically DML) statement.
91+
/// </summary>
92+
/// <param name="sequenceName">the name of the sequence </param>
93+
/// <returns> The "nextval" fragment. </returns>
94+
/// <remarks>
95+
/// This differs from <see cref="GetSequenceNextValString"/> in that this
96+
/// should return an expression usable within another statement.
97+
/// </remarks>
98+
public override string GetSelectSequenceNextValString(string sequenceName)
99+
{
100+
return "next value for " + sequenceName;
101+
}
67102
}
68-
}
103+
}

0 commit comments

Comments
 (0)