DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
UpdateFromCursorStatement.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 
5 using Deveel.Data.Sql.Cursors;
6 using Deveel.Data.Sql.Query;
7 using Deveel.Data.Sql.Tables;
8 
9 namespace Deveel.Data.Sql.Statements {
11  public UpdateFromCursorStatement(ObjectName tableName, string cursorName) {
12  if (tableName == null)
13  throw new ArgumentNullException("tableName");
14  if (String.IsNullOrEmpty(cursorName))
15  throw new ArgumentNullException("cursorName");
16 
17  TableName = tableName;
18  CursorName = cursorName;
19  }
20 
21  public ObjectName TableName { get; private set; }
22 
23  public string CursorName { get; private set; }
24 
26  var cursor = request.FindCursor(CursorName);
27  if (cursor == null)
28  throw new ObjectNotFoundException(new ObjectName(CursorName), "The source cursor was not found.");
29 
30  var tableName = request.Query.ResolveTableName(TableName);
31  if (tableName == null)
32  throw new ObjectNotFoundException(TableName);
33 
34  var table = request.Query.GetMutableTable(tableName);
35  if (table == null)
36  throw new ObjectNotFoundException(tableName);
37 
38  var columns = table.TableInfo.Select(x => new ObjectName(tableName, x.ColumnName));
39 
40  var queryExpression = cursor.QueryExpression;
41  var queryFrom = QueryExpressionFrom.Create(request, queryExpression);
42 
43  var assignments = new List<SqlColumnAssignment>();
44  foreach (var column in columns) {
45  // TODO:
46  }
47 
48  // TODO: get the columns from the table and the columns exposed by the cursor
49  // and then make a set of assignments
50  throw new NotImplementedException();
51  }
52 
53  #region Prepared
54 
55  [Serializable]
57  protected override void ExecuteStatement(ExecutionContext context) {
58  throw new NotImplementedException();
59  }
60  }
61 
62  #endregion
63  }
64 }
UpdateFromCursorStatement(ObjectName tableName, string cursorName)
Describes the name of an object within a database.
Definition: ObjectName.cs:44
Represents the foundation class of SQL statements to be executed.
Definition: SqlStatement.cs:32
static QueryExpressionFrom Create(IRequest context, SqlQueryExpression expression)