DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
QueryContextBase.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 #if !PCL
19 using System.Security.Cryptography;
20 #endif
21 
22 using Deveel.Data.Caching;
23 using Deveel.Data.Services;
25 
26 namespace Deveel.Data {
27  public sealed class QueryContext : Context, IQueryContext {
28  /*
29 #if PCL
30  private Random secureRandom;
31 #else
32  private RNGCryptoServiceProvider secureRandom;
33 #endif
34  */
35 
36  internal QueryContext(ISessionContext parentContext)
37  : base(parentContext) {
38 
39  this.RegisterInstance<IQueryContext>(this);
40  /*
41 #if PCL
42  secureRandom = new Random();
43 #else
44  secureRandom = new RNGCryptoServiceProvider();
45 #endif
46  */
47 
48  this.RegisterInstance<ICache>(new MemoryCache(), "TableCache");
49  }
50 
52  get { return (ISessionContext)ParentContext; }
53  }
54 
55  protected override string ContextName {
56  get { return ContextNames.Query; }
57  }
58 
60  return new BlockContext(this);
61  }
62 
63  /*
64  public virtual SqlNumber NextRandom(int bitSize) {
65  AssertNotDisposed();
66 
67 #if PCL
68  var num = secureRandom.NextDouble();
69 #else
70  var bytes = new byte[8];
71  secureRandom.GetBytes(bytes);
72  var num = BitConverter.ToInt64(bytes, 0);
73 #endif
74  return new SqlNumber(num);
75  }
76  */
77 
78  }
79 }
Provides a context for executing queries, accessing the system resources and evaluation context...
QueryContext(ISessionContext parentContext)
IBlockContext CreateBlockContext()