DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Protected Member Functions | Properties | Private Member Functions | List of all members
Deveel.Data.Sql.Statements.AlterUserStatement Class Reference
Inheritance diagram for Deveel.Data.Sql.Statements.AlterUserStatement:
Deveel.Data.Sql.Statements.SqlStatement Deveel.Data.Sql.Expressions.IPreparable Deveel.Data.Sql.Statements.IStatement Deveel.Data.Serialization.ISerializable Deveel.Data.Sql.IExecutable

Public Member Functions

 AlterUserStatement (string userName, IAlterUserAction alterAction)
 
- Public Member Functions inherited from Deveel.Data.Sql.Statements.SqlStatement
ITable Execute (IRequest context)
 Prepares and evaluates this statement into a tabular result. More...
 

Protected Member Functions

override void GetData (SerializeData data)
 
override void ExecuteStatement (ExecutionContext context)
 
- Protected Member Functions inherited from Deveel.Data.Sql.Statements.SqlStatement
 SqlStatement ()
 
 SqlStatement (ObjectData data)
 

Properties

string UserName [get, private set]
 
IAlterUserAction AlterAction [get, private set]
 
- Properties inherited from Deveel.Data.Sql.Statements.SqlStatement
SqlQuery SourceQuery [get, set]
 Gets the SqlQuery that is the origin of this statement. More...
 
bool IsFromQuery [get, private set]
 Gets a boolean value indicating if this object was formed from the parsing of a SqlQuery or if it was manually created. More...
 
- Properties inherited from Deveel.Data.Sql.Statements.IStatement
SqlQuery SourceQuery [get]
 

Private Member Functions

 AlterUserStatement (ObjectData data)
 
object IPreparable. Prepare (IExpressionPreparer preparer)
 Converts the underlying value of this instance into an object that can be evaluated by an expression. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Deveel.Data.Sql.Statements.SqlStatement
static IEnumerable< SqlStatementParse (string sqlSource)
 Parses a given string into one of more statements. More...
 
static IEnumerable< SqlStatementParse (IContext context, string sqlSource)
 Parses a given string into one of more statements. More...
 
static IEnumerable< SqlStatementParse (IContext context, SqlQuery query)
 
- Package Functions inherited from Deveel.Data.Sql.Statements.SqlStatement
void SetSource (SqlQuery query)
 

Detailed Description

Definition at line 27 of file AlterUserStatement.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Statements.AlterUserStatement.AlterUserStatement ( string  userName,
IAlterUserAction  alterAction 
)
inline

Definition at line 28 of file AlterUserStatement.cs.

28  {
29  if (alterAction == null)
30  throw new ArgumentNullException("alterAction");
31  if (String.IsNullOrEmpty(userName))
32  throw new ArgumentNullException("userName");
33 
34  UserName = userName;
35  AlterAction = alterAction;
36  }
A long string in the system.
Deveel.Data.Sql.Statements.AlterUserStatement.AlterUserStatement ( ObjectData  data)
inlineprivate

Definition at line 38 of file AlterUserStatement.cs.

38  {
39  UserName = data.GetString("UserName");
40  AlterAction = data.GetValue<IAlterUserAction>("Action");
41  }

Member Function Documentation

override void Deveel.Data.Sql.Statements.AlterUserStatement.ExecuteStatement ( ExecutionContext  context)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Statements.SqlStatement.

Definition at line 60 of file AlterUserStatement.cs.

60  {
61  if (AlterAction.ActionType == AlterUserActionType.SetPassword) {
62  var password = ((SqlConstantExpression)((SetPasswordAction)AlterAction).PasswordExpression).Value.ToString();
63  context.Request.Query.AlterUserPassword(UserName, password);
64  } else if (AlterAction.ActionType == AlterUserActionType.SetGroups) {
65  var groupNames = ((SetUserGroupsAction)AlterAction).Groups
66  .Cast<SqlConstantExpression>()
67  .Select(x => x.Value.Value.ToString())
68  .ToArray();
69 
70  context.Request.Query.SetUserGroups(UserName, groupNames);
71  } else if (AlterAction.ActionType == AlterUserActionType.SetAccountStatus) {
72  context.Request.Query.SetUserStatus(UserName, ((SetAccountStatusAction)AlterAction).Status);
73  }
74  }
An expression that holds a constant value.
override void Deveel.Data.Sql.Statements.AlterUserStatement.GetData ( SerializeData  data)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Statements.SqlStatement.

Definition at line 55 of file AlterUserStatement.cs.

55  {
56  data.SetValue("UserName", UserName);
57  data.SetValue("Action", AlterAction);
58  }
void SetValue(string key, Type type, object value)
object IPreparable. Deveel.Data.Sql.Statements.AlterUserStatement.Prepare ( IExpressionPreparer  preparer)
inlineprivate

Converts the underlying value of this instance into an object that can be evaluated by an expression.

Parameters
preparerThe context used to prepare this object.
Returns
Returns an object that can be evaluated by an expression.

Implements Deveel.Data.Sql.Expressions.IPreparable.

Definition at line 47 of file AlterUserStatement.cs.

47  {
48  var action = AlterAction;
49  if (action is IPreparable)
50  action = ((IPreparable)action).Prepare(preparer) as IAlterUserAction;
51 
52  return new AlterUserStatement(UserName, action);
53  }
AlterUserStatement(string userName, IAlterUserAction alterAction)
A contract for objects that participate to a SqlExpression.Prepare phase of an expression evaluation...
Definition: IPreparable.cs:30

Property Documentation

IAlterUserAction Deveel.Data.Sql.Statements.AlterUserStatement.AlterAction
getprivate set

Definition at line 45 of file AlterUserStatement.cs.

string Deveel.Data.Sql.Statements.AlterUserStatement.UserName
getprivate set

Definition at line 43 of file AlterUserStatement.cs.


The documentation for this class was generated from the following file: