44 using JankSQL . Expressions ;
55 using JankSQL . Operators ;
66
7- internal enum SetOperator
8- {
9- ASSIGN ,
10- ADD_ASSIGN ,
11- SUB_ASSIGN ,
12- MUL_ASSIGN ,
13- DIV_ASSIGN ,
14- MOD_ASSIGN ,
15- }
16-
17- //TODO: move to Operators (or Expressions?)
18- internal class SetOperation
19- {
20- private readonly FullColumnName fcn ;
21- private readonly Expression expression ;
22- private readonly SetOperator op ;
23-
24- internal SetOperation ( FullColumnName fcn , SetOperator op , Expression expression )
25- {
26- this . fcn = fcn ;
27- this . op = op ;
28- this . expression = expression ;
29- }
307
31- public override string ToString ( )
32- {
33- return $ "{ fcn } { op } { expression } ";
34- }
35-
36- internal void Execute ( Engines . IEngine engine , IRowValueAccessor outputaccessor , IRowValueAccessor inputAccessor , Dictionary < string , ExpressionOperand > bindValues )
37- {
38- if ( op != SetOperator . ASSIGN )
39- throw new NotImplementedException ( ) ;
40-
41- ExpressionOperand val = expression . Evaluate ( inputAccessor , engine , bindValues ) ;
42- outputaccessor . SetValue ( fcn , val ) ;
43- }
44- }
458
469 internal class UpdateContext : IExecutableContext
4710 {
4811 private readonly FullTableName tableName ;
4912 private readonly TSqlParser . Update_statementContext context ;
50- private readonly List < SetOperation > setList = new ( ) ;
13+ private readonly List < UpdateSetOperation > setList = new ( ) ;
5114
5215 private Expression ? predicateExpression ;
5316
@@ -74,7 +37,7 @@ public object Clone()
7437
7538 clone . predicateExpression = predicateExpression != null ? ( Expression ) predicateExpression . Clone ( ) : null ;
7639
77- foreach ( SetOperation op in setList )
40+ foreach ( UpdateSetOperation op in setList )
7841 clone . setList . Add ( op ) ;
7942
8043 return clone ;
@@ -130,7 +93,7 @@ public ExecuteResult Execute(IEngine engine, IRowValueAccessor? outerAccessor, D
13093
13194 internal void AddAssignment ( FullColumnName fcn , Expression x )
13295 {
133- SetOperation op = new ( fcn , SetOperator . ASSIGN , x ) ;
96+ UpdateSetOperation op = new ( fcn , UpdateSetOperator . ASSIGN , x ) ;
13497 setList . Add ( op ) ;
13598 }
13699
0 commit comments