DeveelDB
20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
deveeldb.git
src
deveeldb
Deveel.Data
Query.cs
Go to the documentation of this file.
1
//
2
// Copyright 2010-2015 Deveel
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License");
5
// you may not use this file except in compliance with the License.
6
// You may obtain a copy of the License at
7
//
8
// http://www.apache.org/licenses/LICENSE-2.0
9
//
10
// Unless required by applicable law or agreed to in writing, software
11
// distributed under the License is distributed on an "AS IS" BASIS,
12
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
// See the License for the specific language governing permissions and
14
// limitations under the License.
15
//
16
17
using
System
;
18
using
System
.Collections.Generic;
19
20
using
Deveel
.
Data
;
21
using
Deveel
.
Data
.
Diagnostics
;
22
using
Deveel
.
Data
.
Services
;
23
using
Deveel
.
Data
.
Sql
;
24
25
namespace
Deveel
.Data {
26
public
sealed
class
Query
:
IQuery
{
27
private
Dictionary<string, object>
metadata
;
28
29
internal
Query
(
ISession
session)
30
: this(session, null) {
31
}
32
33
internal
Query
(
ISession
session,
SqlQuery
sourceQuery) {
34
Session
= session;
35
SourceQuery = sourceQuery;
36
37
Context
= session.
Context
.
CreateQueryContext
();
38
Context
.RegisterInstance<
IQuery
>(
this
);
39
40
StartedOn = DateTimeOffset.UtcNow;
41
42
metadata = GetMetadata();
43
}
44
45
private
Dictionary<string, object>
GetMetadata
() {
46
return
new
Dictionary<string, object> {
47
{
"query.startTime"
, StartedOn },
48
{
"query.source"
, SourceQuery }
49
};
50
}
51
52
~Query
() {
53
Dispose(
false
);
54
}
55
56
IBlockContext
IRequest
.
CreateBlockContext
() {
57
return
Context
.CreateBlockContext();
58
}
59
60
public
IBlock
CreateBlock
() {
61
return
new
Block
(
this
);
62
}
63
64
IQuery
IRequest
.
Query
{
65
get
{
return
this
; }
66
}
67
68
public
IQueryContext
Context
{
get
;
private
set; }
69
70
public
ISession
Session
{
get
;
private
set; }
71
72
public
DateTimeOffset StartedOn {
get
;
private
set; }
73
74
public
SqlQuery
SourceQuery {
get
;
private
set; }
75
76
public
bool
HasSourceQuery {
77
get
{
return
SourceQuery != null; }
78
}
79
80
public
void
Dispose
() {
81
Dispose(
true
);
82
GC.SuppressFinalize(
this
);
83
}
84
85
private
void
Dispose
(
bool
disposing) {
86
if
(disposing) {
87
if
(
Context
!= null)
88
Context
.
Dispose
();
89
}
90
91
Context
= null;
92
Session
= null;
93
}
94
95
IContext
IEventSource
.
Context
{
96
get
{
return
Context
; }
97
}
98
99
IEventSource
IEventSource
.
ParentSource
{
100
get
{
return
Session
; }
101
}
102
103
IEnumerable<KeyValuePair<string, object>>
IEventSource
.
Metadata
{
104
get
{
return
metadata; }
105
}
106
}
107
}
Deveel.Data.IRequest.CreateBlockContext
IBlockContext CreateBlockContext()
Deveel
Deveel.Data.ISessionContext.CreateQueryContext
IQueryContext CreateQueryContext()
System
Definition:
NonSerializedAttribute.cs:3
Deveel.Data.Query
Definition:
Query.cs:26
Deveel.Data.IBlockContext
Definition:
IBlockContext.cs:20
Deveel.Data.Context
Definition:
Context.cs:22
Deveel.Data.Context.Dispose
virtual void Dispose(bool disposing)
Definition:
Context.cs:63
Deveel.Data.Query.Query
Query(ISession session)
Definition:
Query.cs:29
Deveel.Data.IQuery
Definition:
IQuery.cs:20
Deveel.Data.IBlock
Definition:
IBlock.cs:20
Deveel.Data.IQueryContext
Provides a context for executing queries, accessing the system resources and evaluation context...
Definition:
IQueryContext.cs:26
Deveel.Data.Sql.SqlQuery
Definition:
SqlQuery.cs:26
Deveel.Data.IRequest.Query
IQuery Query
Definition:
IRequest.cs:23
Deveel.Data.Block
Definition:
Block.cs:23
Deveel.Data.Session
This is a session that is constructed around a given user and a transaction, to the given database...
Definition:
Session.cs:32
Deveel.Data.Diagnostics.IEventSource.ParentSource
IEventSource ParentSource
Gets an optional parent source.
Definition:
IEventSource.cs:49
Deveel.Data.Diagnostics
Definition:
ContextExtensions.cs:19
Deveel.Data.Diagnostics.IEventSource.Metadata
IEnumerable< KeyValuePair< string, object > > Metadata
Gets the list of metadata associated to the source.
Definition:
IEventSource.cs:57
Deveel.Data.ISession
An isolated session to a given database for a given user, encapsulating the transaction for operation...
Definition:
ISession.cs:30
Deveel.Data.Query.CreateBlock
IBlock CreateBlock()
Definition:
Query.cs:60
Deveel.Data.Query.Dispose
void Dispose()
Definition:
Query.cs:80
Deveel.Data.Diagnostics.IEventSource.Context
IContext Context
Definition:
IEventSource.cs:41
Deveel.Data.Services
Definition:
IRegistrationConfiguration.cs:19
Deveel.Data.ISession.Context
new ISessionContext Context
Definition:
ISession.cs:48
Deveel.Data.Query.GetMetadata
Dictionary< string, object > GetMetadata()
Definition:
Query.cs:45
Deveel.Data
Definition:
ActiveSessionList.cs:22
Deveel.Data.Sql
Definition:
CellId.cs:22
Deveel.Data.Query.Query
Query(ISession session, SqlQuery sourceQuery)
Definition:
Query.cs:33
Deveel.Data.Query.metadata
Dictionary< string, object > metadata
Definition:
Query.cs:27
Deveel.Data.IRequest
Definition:
IRequest.cs:22
Deveel.Data.Query.~Query
~Query()
Definition:
Query.cs:52
Deveel.Data.Query.Dispose
void Dispose(bool disposing)
Definition:
Query.cs:85
Deveel.Data.IContext
Definition:
IContext.cs:22
Deveel.Data.Diagnostics.IEventSource
Represents the origin of system events, providing a mechanism to fill the metadata before dispatching...
Definition:
IEventSource.cs:40
Generated by
1.8.10