|
1 | 1 | using System;
|
2 |
| -using System.Collections; |
3 |
| -using NHibernate.Dialect.Function; |
4 |
| -using NHibernate.Engine; |
5 |
| -using NHibernate.SqlCommand; |
6 |
| -using NHibernate.Type; |
7 | 2 |
|
8 | 3 | namespace NHibernate.Dialect
|
9 | 4 | {
|
10 |
| - /// <summary> |
11 |
| - /// Treats bitwise operations as native operations. |
12 |
| - /// </summary> |
| 5 | + /// <inheritdoc /> |
13 | 6 | [Serializable]
|
14 |
| - public class BitwiseNativeOperation : ISQLFunction |
| 7 | + // Since 5.2 |
| 8 | + [Obsolete("Use NHibernate.Dialect.Function.BitwiseNativeOperation instead")] |
| 9 | + public class BitwiseNativeOperation : Function.BitwiseNativeOperation |
15 | 10 | {
|
16 |
| - private readonly string _sqlOpToken; |
17 |
| - private readonly bool _isNot; |
18 |
| - |
19 |
| - /// <summary> |
20 |
| - /// creates an instance using the giving token |
21 |
| - /// </summary> |
22 |
| - /// <param name="sqlOpToken"> |
23 |
| - /// The operation token |
24 |
| - /// </param> |
25 |
| - /// <remarks> |
26 |
| - /// Use this constructor only if the token DOES NOT represent a NOT-Operation |
27 |
| - /// </remarks> |
28 |
| - public BitwiseNativeOperation(string sqlOpToken) |
29 |
| - : this(sqlOpToken, false) |
30 |
| - { |
31 |
| - } |
32 |
| - |
33 |
| - /// <summary> |
34 |
| - /// creates an instance using the giving token and the flag indicating a NOT-Operation |
35 |
| - /// </summary> |
36 |
| - /// <param name="sqlOpToken"></param> |
37 |
| - /// <param name="isNot"></param> |
38 |
| - public BitwiseNativeOperation(string sqlOpToken, bool isNot) |
39 |
| - { |
40 |
| - _sqlOpToken = sqlOpToken; |
41 |
| - _isNot = isNot; |
42 |
| - } |
43 |
| - |
44 |
| - #region ISQLFunction Members |
45 |
| - |
46 |
| - public IType ReturnType(IType columnType, IMapping mapping) |
47 |
| - { |
48 |
| - return NHibernateUtil.Int64; |
49 |
| - } |
50 |
| - |
51 |
| - public bool HasArguments |
| 11 | + /// <inheritdoc /> |
| 12 | + public BitwiseNativeOperation(string sqlOpToken) : base(sqlOpToken) |
52 | 13 | {
|
53 |
| - get { return true; } |
54 | 14 | }
|
55 | 15 |
|
56 |
| - public bool HasParenthesesIfNoArguments |
57 |
| - { |
58 |
| - get { return false; } |
59 |
| - } |
60 |
| - |
61 |
| - public SqlString Render(IList args, ISessionFactoryImplementor factory) |
62 |
| - { |
63 |
| - var sqlBuffer = new SqlStringBuilder(); |
64 |
| - var arguments = new Queue(args); |
65 |
| - |
66 |
| - if (_isNot == false) |
67 |
| - AddToBuffer(arguments.Dequeue(), sqlBuffer); |
68 |
| - |
69 |
| - AddToBuffer(string.Format(" {0} ", _sqlOpToken), sqlBuffer); |
70 |
| - while (arguments.Count > 0) |
71 |
| - { |
72 |
| - AddToBuffer(arguments.Dequeue(), sqlBuffer); |
73 |
| - } |
74 |
| - |
75 |
| - return sqlBuffer.ToSqlString(); |
76 |
| - } |
77 |
| - |
78 |
| - #endregion |
79 |
| - |
80 |
| - private void AddToBuffer(object arg, SqlStringBuilder buffer) |
| 16 | + /// <inheritdoc /> |
| 17 | + public BitwiseNativeOperation(string sqlOpToken, bool isNot) : base(sqlOpToken, isNot) |
81 | 18 | {
|
82 |
| - if (arg is Parameter || arg is SqlString) |
83 |
| - buffer.AddObject(arg); |
84 |
| - else |
85 |
| - buffer.Add(arg.ToString()); |
86 | 19 | }
|
87 | 20 | }
|
88 | 21 | }
|
0 commit comments