当前位置: 首页>>代码示例>>C#>>正文


C# IRequest.Access方法代码示例

本文整理汇总了C#中IRequest.Access方法的典型用法代码示例。如果您正苦于以下问题:C# IRequest.Access方法的具体用法?C# IRequest.Access怎么用?C# IRequest.Access使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRequest的用法示例。


在下文中一共展示了IRequest.Access方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrepareStatement

        protected override SqlStatement PrepareStatement(IRequest context)
        {
            var tableName = context.Access().ResolveTableName(TableName);
            if (!context.Access().TableExists(tableName))
                throw new ObjectNotFoundException(tableName);

            var queryExpression = new SqlQueryExpression(new[]{SelectColumn.Glob("*") });
            queryExpression.FromClause.AddTable(tableName.FullName);
            queryExpression.WhereExpression = WherExpression;

            var queryFrom = QueryExpressionFrom.Create(context, queryExpression);
            var queryPlan = context.Query.Context.QueryPlanner().PlanQuery(new QueryInfo(context, queryExpression));

            var columns = new List<SqlAssignExpression>();
            foreach (var assignment in Assignments) {
                var columnName = ObjectName.Parse(assignment.ColumnName);

                var refName = queryFrom.ResolveReference(columnName);
                var expression = assignment.Expression.Prepare(queryFrom.ExpressionPreparer);

                var assign = SqlExpression.Assign(SqlExpression.Reference(refName), expression);
                columns.Add(assign);
            }

            return new Prepared(tableName, queryPlan, columns.ToArray(), Limit);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:26,代码来源:UpdateStatement.cs

示例2: Evaluate

        public override ITable Evaluate(IRequest context)
        {
            // Is the result available in the context?
            var childTable = context.Access().GetCachedTable(Id.ToString());
            if (childTable == null) {
                // No so evaluate the child and cache it
                childTable = Child.Evaluate(context);
                context.Access().CacheTable(Id.ToString(), childTable);
            }

            return childTable;
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:12,代码来源:CachePointNode.cs

示例3: Default

        public static ColumnChecker Default(IRequest context, ObjectName tableName)
        {
            var table = context.Access().GetTable(tableName);
            if (table == null)
                throw new InvalidOperationException(String.Format("Table '{0}' not found in the context.", tableName));

            var tableInfo = table.TableInfo;
            var ignoreCase = context.Query.IgnoreIdentifiersCase();

            return new DefaultChecker(tableInfo, ignoreCase);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:11,代码来源:ColumnChecker.cs

示例4: PrepareStatement

        protected override SqlStatement PrepareStatement(IRequest context)
        {
            ObjectName tableName = null;

            if (Target == ShowTarget.Table &&
                TableName != null) {
                tableName = context.Access().ResolveTableName(TableName);
            }

            if (Target == ShowTarget.Schema)
                return ShowSchema();
            if (Target == ShowTarget.SchemaTables)
                return ShowSchemaTables(context.Query.CurrentSchema());
            if (Target == ShowTarget.Table)
                return ShowTable(tableName);
            if (Target == ShowTarget.Product)
                return ShowProduct();

            throw new StatementException(String.Format("The SHOW target {0} is not supported.", Target));
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:20,代码来源:ShowStatement.cs

示例5: PrepareStatement

        protected override SqlStatement PrepareStatement(IRequest context)
        {
            var queryPlan = context.Query.Context.QueryPlanner().PlanQuery(new QueryInfo(context, QueryExpression));

            if (Reference is SqlReferenceExpression) {
                var objName = ((SqlReferenceExpression) Reference).ReferenceName;
                objName = context.Access().ResolveObjectName(objName);

                return new SelectIntoTable(objName, queryPlan);
            }

            if (Reference is SqlVariableReferenceExpression) {
                var refName = ((SqlVariableReferenceExpression) Reference).VariableName;
                return new SelectIntoVariable(new[] { refName}, queryPlan);
            }

            if (Reference is SqlTupleExpression) {
                var exps = ((SqlTupleExpression) Reference).Expressions;
                if (exps == null || exps.Length == 0)
                    throw new StatementException("Empty tuple in SELECT INTO");

                var variables = new List<string>();

                for (int i = 0; i < exps.Length; i++) {
                    if (!(exps[i] is SqlVariableReferenceExpression))
                        throw new StatementException("Found an invalid expression in the tuple.");

                    var varName = ((SqlVariableReferenceExpression) exps[i]).VariableName;
                    variables.Add(varName);
                }

                return new SelectIntoVariable(variables.ToArray(), queryPlan);
            }

            // Other (impossible) case...
            throw new NotSupportedException();
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:37,代码来源:SelectIntoStatement.cs

示例6: PrepareStatement

        protected override SqlStatement PrepareStatement(IRequest context)
        {
            var schemaName = context.Access().ResolveSchemaName(FunctionName.ParentName);
            var functionName = new ObjectName(schemaName, FunctionName.Name);
            var returnType = ReturnType.Resolve(context);

            var parameters = new List<RoutineParameter>();
            if (Parameters != null) {
                foreach (var parameter in Parameters) {
                    parameters.Add((RoutineParameter)((IStatementPreparable)parameter).Prepare(context));
                }
            }

            var body = (PlSqlBlockStatement) Body.Prepare(context);
            return new CreateFunctionStatement(functionName, returnType, parameters.ToArray(), body) {
                ReplaceIfExists = ReplaceIfExists
            };
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:18,代码来源:CreateFunctionStatement.cs

示例7: PrepareStatement

        protected override SqlStatement PrepareStatement(IRequest context)
        {
            var triggerSchemaName = context.Access().ResolveSchemaName(TriggerName.ParentName);
            var triggerName = new ObjectName(triggerSchemaName, TriggerName.Name);

            var tableName = context.Access().ResolveTableName(TableName);
            var procedureName = context.Access().ResolveObjectName(DbObjectType.Routine, ProcedureName);

            return new CreateProcedureTriggerStatement(triggerName, tableName, procedureName, ProcedureArguments, EventTime,
                EventType) {
                    ReplaceIfExists = ReplaceIfExists,
                    Status = Status
                };
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:14,代码来源:CreateProcedureTriggerStatement.cs

示例8: PrepareStatement

 protected override SqlStatement PrepareStatement(IRequest context)
 {
     var triggerName = context.Access().ResolveObjectName(DbObjectType.Trigger, TriggerName);
     return new DropTriggerStatement(triggerName);
 }
开发者ID:deveel,项目名称:deveeldb,代码行数:5,代码来源:DropTriggerStatement.cs

示例9: RenameTriggerAction

 object IStatementPreparable.Prepare(IRequest request)
 {
     var name = request.Access().ResolveObjectName(DbObjectType.Trigger, Name);
     return new RenameTriggerAction(name);
 }
开发者ID:deveel,项目名称:deveeldb,代码行数:5,代码来源:RenameTriggerAction.cs

示例10: Evaluate

 public ITable Evaluate(IRequest context)
 {
     var t = context.Access().GetTable(TableName);
     return AliasName != null ? new ReferenceTable(t, AliasName) : t;
 }
开发者ID:deveel,项目名称:deveeldb,代码行数:5,代码来源:FetchTableNode.cs

示例11: NextValue

 public static SqlNumber NextValue(IRequest request, SqlString sequenceName)
 {
     var objName = ObjectName.Parse(sequenceName.ToString());
     var resolvedName = request.Access().ResolveObjectName(DbObjectType.Sequence, objName);
     return request.Access().GetNextValue(resolvedName);
 }
开发者ID:deveel,项目名称:deveeldb,代码行数:6,代码来源:SystemFunctions.cs

示例12: NewObject

        public static Field NewObject(IRequest context, Field typeName, Field[] args = null)
        {
            if (Field.IsNullField(typeName))
                throw new ArgumentNullException("typeName");

            if (!(typeName.Type is StringType))
                throw new ArgumentException("The type name argument must be of string type.");

            var argExp = new SqlExpression[args == null ? 0 : args.Length];

            if (args != null) {
                argExp = args.Select(SqlExpression.Constant).Cast<SqlExpression>().ToArray();
            }

            var type = context.Access().ResolveUserType(typeName.Value.ToString());
            if (type == null)
                throw new InvalidOperationException(String.Format("The type '{0}' was not defined.", typeName));

            if (!(type is UserType))
                throw new InvalidOperationException(String.Format("The type '{0}' is not a user-defined type", typeName));

            var userType = (UserType) type;

            var obj = userType.NewObject(context, argExp);

            return Field.Object(userType, obj);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:27,代码来源:SystemFunctions.cs

示例13: CurrentValue

 public static SqlNumber CurrentValue(IRequest query, SqlString sequenceName)
 {
     var objName = ObjectName.Parse(sequenceName.ToString());
     var resolvedName = query.Access().ResolveObjectName(DbObjectType.Sequence, objName);
     return query.Access().GetCurrentValue(resolvedName);
 }
开发者ID:deveel,项目名称:deveeldb,代码行数:6,代码来源:SystemFunctions.cs

示例14: CreateTableInfo

        private TableInfo CreateTableInfo(IRequest context)
        {
            var tableName = context.Access().ResolveTableName(TableName);

            var idColumnCount = Columns.Count(x => x.IsIdentity);
            if (idColumnCount > 1)
                throw new InvalidOperationException("More than one IDENTITY column specified.");

            bool ignoreCase = context.Query.IgnoreIdentifiersCase();
            var columnChecker = new TableColumnChecker(Columns, ignoreCase);

            var tableInfo = new TableInfo(tableName);

            foreach (var column in Columns) {
                var columnInfo = CreateColumnInfo(context, tableName.Name, column, columnChecker);

                if (column.IsIdentity)
                    columnInfo.DefaultExpression = SqlExpression.FunctionCall("UNIQUEKEY", new SqlExpression[] {
                        SqlExpression.Constant(tableName.ToString())
                    });

                tableInfo.AddColumn(columnInfo);
            }

            return tableInfo;
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:26,代码来源:CreateTableStatement.cs

示例15: PrepareStatement

        protected override SqlStatement PrepareStatement(IRequest context)
        {
            var viewName = context.Access().ResolveObjectName(DbObjectType.View, ViewName);

            if (!IfExists &&
                !context.Access().ViewExists(viewName))
                throw new ObjectNotFoundException(ViewName);

            return new DropViewStatement(viewName, IfExists);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:10,代码来源:DropViewStatement.cs


注:本文中的IRequest.Access方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。