本文整理汇总了C#中IQueryContext.GetMutableTable方法的典型用法代码示例。如果您正苦于以下问题:C# IQueryContext.GetMutableTable方法的具体用法?C# IQueryContext.GetMutableTable怎么用?C# IQueryContext.GetMutableTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IQueryContext
的用法示例。
在下文中一共展示了IQueryContext.GetMutableTable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTestData
private void AddTestData(IQueryContext context)
{
var table = context.GetMutableTable(ObjectName.Parse("APP.test_table"));
var row = table.NewRow();
row.SetValue("id", DataObject.Integer(0));
row.SetValue("first_name", DataObject.String("John"));
row.SetValue("last_name", DataObject.String("Doe"));
row.SetValue("birth_date", DataObject.Date(new SqlDateTime(1977, 01, 01)));
row.SetValue("active", DataObject.Boolean(false));
table.AddRow(row);
row = table.NewRow();
row.SetValue("id", DataObject.Integer(1));
row.SetValue("first_name", DataObject.String("Jane"));
row.SetValue("last_name", DataObject.String("Doe"));
row.SetValue("birth_date", DataObject.Date(new SqlDateTime(1978, 11, 01)));
row.SetValue("active", DataObject.Boolean(true));
table.AddRow(row);
row = table.NewRow();
row.SetValue("id", DataObject.Integer(2));
row.SetValue("first_name", DataObject.String("Roger"));
row.SetValue("last_name", DataObject.String("Rabbit"));
row.SetValue("birth_date", DataObject.Date(new SqlDateTime(1985, 05, 05)));
row.SetValue("active", DataObject.Boolean(true));
table.AddRow(row);
}
示例2: PrepareStatement
protected override SqlPreparedStatement PrepareStatement(IExpressionPreparer preparer, IQueryContext context)
{
var queryPlan = context.DatabaseContext().QueryPlanner().PlanQuery(context, QueryExpression, null);
if (IsObjectReference) {
var tableRef = ((SqlReferenceExpression) Reference).ReferenceName;
var table = context.GetMutableTable(tableRef);
if (table == null)
throw new StatementPrepareException(String.Format("Referenced table of the INTO statement '{0}' was not found or is not mutable.", tableRef));
return new Prepared(queryPlan, table);
}
if (IsVariableReference) {
throw new NotImplementedException();
}
// Other (impossible) case...
throw new NotSupportedException();
}