DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
QueryExtensions.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 
19 using Deveel.Data.Security;
20 using Deveel.Data.Sql;
21 
22 namespace Deveel.Data {
23  public static class QueryExtensions {
24  public static User User(this IQuery query) {
25  return query.Session.User;
26  }
27 
28  public static string UserName(this IQuery query) {
29  return query.User().Name;
30  }
31 
32  internal static IQuery Direct(this IQuery query) {
33  var systemSession = new SystemSession(query.Session.Transaction, query.Session.CurrentSchema);
34  return new Query(systemSession);
35  }
36 
37  public static bool IgnoreIdentifiersCase(this IQuery query) {
38  return query.Context.IgnoreIdentifiersCase();
39  }
40 
41  public static void IgnoreIdentifiersCase(this IQuery query, bool value) {
42  query.Context.IgnoreIdentifiersCase(value);
43  }
44 
45  public static void AutoCommit(this IQuery query, bool value) {
46  query.Context.AutoCommit(value);
47  }
48 
49  public static bool AutoCommit(this IQuery query) {
50  return query.Context.AutoCommit();
51  }
52 
53  public static string CurrentSchema(this IQuery query) {
54  return query.Context.CurrentSchema();
55  }
56 
57  public static void CurrentSchema(this IQuery query, string value) {
58  query.Context.CurrentSchema(value);
59  }
60 
61  public static void ParameterStyle(this IQuery query, QueryParameterStyle value) {
62  query.Context.ParameterStyle(value);
63  }
64 
65  public static QueryParameterStyle ParameterStyle(this IQuery query) {
66  return query.Context.ParameterStyle();
67  }
68 
69  public static void Commit(this IQuery query) {
70  query.Session.Commit();
71  }
72 
73  public static void Rollback(this IQuery query) {
74  query.Session.Rollback();
75  }
76  }
77 }
static void Rollback(this IQuery query)
static void CurrentSchema(this IQuery query, string value)
void Rollback()
Rolls-back all the modifications made by the user in this session
void Commit()
Commits the latest changes made by the user in the session.
static QueryParameterStyle ParameterStyle(this IQuery query)
static IQuery Direct(this IQuery query)
static void AutoCommit(this IQuery query, bool value)
ITransaction Transaction
Gets the instance of ITransaction that handles the transactional operations of this session...
Definition: ISession.cs:46
static string CurrentSchema(this IQuery query)
static void ParameterStyle(this IQuery query, QueryParameterStyle value)
ISession Session
Definition: IQuery.cs:23
static void IgnoreIdentifiersCase(this IQuery query, bool value)
static bool AutoCommit(this IQuery query)
string CurrentSchema
Gets the name of the current schema of this session.
Definition: ISession.cs:34
QueryParameterStyle
In a SQL query object, this is the form of parameters passed from the client side to the server side...
static bool IgnoreIdentifiersCase(this IQuery query)
static string UserName(this IQuery query)
static void Commit(this IQuery query)
Provides the information for a user in a database system
Definition: User.cs:27
new IQueryContext Context
Definition: IQuery.cs:21
static User User(this IQuery query)