-
Notifications
You must be signed in to change notification settings - Fork 934
/
Copy pathIQueryTranslator.cs
122 lines (101 loc) · 4.39 KB
/
IQueryTranslator.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
using System.Collections;
using System.Collections.Generic;
using NHibernate.Engine;
using NHibernate.Engine.Query;
using NHibernate.Event;
using NHibernate.Type;
namespace NHibernate.Hql
{
/// <summary>
/// Defines the contract of an HQL->SQL translator.
/// </summary>
public partial interface IQueryTranslator
{
// Not ported:
// Error message constants moved to the implementation of Classic.QueryTranslator (C# can't have fields in interface)
//public const string ErrorCannotFetchWithIterate = "fetch may not be used with scroll() or iterate()";
//public const string ErrorNamedParameterDoesNotAppear = "Named parameter does not appear in Query: ";
//public const string ErrorCannotDetermineType = "Could not determine type of: ";
//public const string ErrorCannotFormatLiteral = "Could not format constant value to SQL literal: ";
/// <summary>
/// Compile a "normal" query. This method may be called multiple times. Subsequent invocations are no-ops.
/// </summary>
/// <param name="replacements">Defined query substitutions.</param>
/// <param name="shallow">Does this represent a shallow (scalar or entity-id) select?</param>
/// <exception cref="NHibernate.QueryException">There was a problem parsing the query string.</exception>
/// <exception cref="NHibernate.MappingException">There was a problem querying defined mappings.</exception>
void Compile(IDictionary<string, string> replacements, bool shallow);
/// <summary>
/// Perform a list operation given the underlying query definition.
/// </summary>
/// <param name="session">The session owning this query.</param>
/// <param name="queryParameters">The query bind parameters.</param>
/// <returns>The query list results.</returns>
/// <exception cref="NHibernate.HibernateException"></exception>
IList List(ISessionImplementor session, QueryParameters queryParameters);
IEnumerable GetEnumerable(QueryParameters queryParameters, IEventSource session);
// Not ported:
//IScrollableResults scroll(QueryParameters queryParameters, ISessionImplementor session);
/// <summary>
/// Perform a bulk update/delete operation given the underlying query definition.
/// </summary>
/// <param name="queryParameters">The query bind parameters.</param>
/// <param name="session">The session owning this query.</param>
/// <returns>The number of entities updated or deleted.</returns>
/// <exception cref="NHibernate.HibernateException"></exception>
int ExecuteUpdate(QueryParameters queryParameters, ISessionImplementor session);
/// <summary>
/// The set of query spaces (table names) that the query refers to.
/// </summary>
ISet<string> QuerySpaces { get; }
// <summary>
// The query identifier for this translator. The query identifier is used in stats collection.
// </summary>
// Not ported:
//string QueryIdentifier { get; }
/// <summary>
/// The SQL string generated by the translator.
/// </summary>
string SQLString { get; }
IList<string> CollectSqlStrings { get; }
/// <summary>
/// The HQL string processed by the translator.
/// </summary>
string QueryString { get; }
/// <summary>
/// Returns the filters enabled for this query translator.
/// </summary>
/// <returns>Filters enabled for this query execution.</returns>
IDictionary<string, IFilter> EnabledFilters { get; }
/// <summary>
/// Returns an array of Types represented in the query result.
/// </summary>
/// <returns>Query return types.</returns>
IType[] ReturnTypes { get; }
/// <summary>
/// Returns an array of HQL aliases
/// </summary>
/// <returns>Returns an array of HQL aliases</returns>
string[] ReturnAliases { get; }
/// <summary>
/// Returns the column names in the generated SQL.
/// </summary>
/// <returns>the column names in the generated SQL.</returns>
string[][] GetColumnNames();
// <summary>
// Validate the scrollability of the translated query.
// </summary>
// <exception cref="NHibernate.HibernateException"></exception>
// Not ported:
//void validateScrollability();
/// <summary>
/// Does the translated query contain collection fetches?
/// </summary>
/// <returns>True if the query does contain collection fetched; false otherwise.</returns>
bool ContainsCollectionFetches { get; }
bool IsManipulationStatement { get; }
Loader.Loader Loader { get; }
IType[] ActualReturnTypes { get; }
ParameterMetadata BuildParameterMetadata();
}
}