示例#1
0
            public EmbeddedQueryContext(ITable backedTable, SystemTransaction transaction, object syncObject)
            {
                this.syncObject = syncObject;
                isClosed = false;
                this.backedTable = backedTable;

                // Determine the updatability of the result set

                notNotUpdatableReason = null;

                // If the result set is a mutable table data source object,
                if (backedTable is IMutableTable) {
                    updatableView = new UpdatableResultSetView(transaction, (IMutableTable) backedTable, null, backedTable.GetRowCursor());
                } else {
                    // Can we map this to a native table?
                    TableName nativeTableName = QueryProcessor.GetNativeTableName(backedTable);
                    // If we can,
                    if (nativeTableName != null) {
                        // The top table must be an operation table and must have all
                        // FETCHVAR operations,
                        if (backedTable is ExpressionTable) {
                            ExpressionTable expressionTable = (ExpressionTable)backedTable;
                            Expression[] projectionExps = expressionTable.Expressions;
                            foreach (Expression op in projectionExps) {
                                if (QueryProcessor.GetAsVariableRef(op) == null) {
                                    notNotUpdatableReason = "Not updatable, result set contains functional " +
                                                           "projections. Please simplify the select terms.";
                                    break;
                                }
                            }
                            // Otherwise, if it all looks ok, set the updatable table
                            if (notNotUpdatableReason == null) {
                                SystemTable nativeTableSource = transaction.GetTable(nativeTableName);
                                updatableView = new UpdatableResultSetView(transaction, nativeTableSource, projectionExps, backedTable.GetRowCursor());
                            }
                        } else {
                            notNotUpdatableReason = "This result set is not updatable.";
                        }
                    } else {
                        notNotUpdatableReason = "Not updatable, result set does not source " +
                                               "to a native table.";
                    }

                    // If we didn't create an updatable view, we create one with null values
                    // and use if for iterator caching only
                    if (updatableView == null) {
                        updatableView = new UpdatableResultSetView(null, null, null, backedTable.GetRowCursor());
                    }
                }
            }
示例#2
0
 public void Close()
 {
     lock (syncObject) {
         updatableView = null;
         isClosed = true;
     }
 }
示例#3
0
 public RowIdResolver(UpdatableResultSetView resultView)
 {
     this.resultView = resultView;
 }