• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Expressions.SqlQueryExpression类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Deveel.Data.Sql.Expressions.SqlQueryExpression的典型用法代码示例。如果您正苦于以下问题:C# SqlQueryExpression类的具体用法?C# SqlQueryExpression怎么用?C# SqlQueryExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SqlQueryExpression类属于Deveel.Data.Sql.Expressions命名空间,在下文中一共展示了SqlQueryExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: FromTable

 private FromTable(string tableName, SqlQueryExpression query, string alias)
 {
     Name = tableName;
     SubQuery = query;
     Alias = alias;
     IsSubQuery = query != null;
 }
开发者ID:deveel,项目名称:deveeldb,代码行数:7,代码来源:FromTable.cs


示例3: Query

        public ISelectStatementBuilder Query(SqlQueryExpression expression)
        {
            if (expression == null)
                throw new ArgumentNullException("expression");

            queryExpression = expression;
            return this;
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:8,代码来源:SelectStatementBuilder.cs


示例4: DeclareInsensitiveCursor

        public static void DeclareInsensitiveCursor(this IRequest context, string cursorName, SqlQueryExpression query, bool withScroll)
        {
            var flags = CursorFlags.Insensitive;
            if (withScroll)
                flags |= CursorFlags.Scroll;

            context.DeclareCursor(cursorName, flags, query);
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:8,代码来源:RequestExtensions.cs


示例5: SelectStatement

        public SelectStatement(SqlQueryExpression queryExpression, IEnumerable<SortColumn> orderBy)
        {
            if (queryExpression == null)
                throw new ArgumentNullException("queryExpression");

            QueryExpression = queryExpression;
            OrderBy = orderBy;
        }
开发者ID:furesoft,项目名称:deveeldb,代码行数:8,代码来源:SelectStatement.cs


示例6: JoinPart

        internal JoinPart(JoinType joinType, SqlQueryExpression subQuery, SqlExpression onExpression)
        {
            if (subQuery == null)
                throw new ArgumentNullException("subQuery");

            OnExpression = onExpression;
            JoinType = joinType;
            SubQuery = subQuery;
        }
开发者ID:furesoft,项目名称:deveeldb,代码行数:9,代码来源:JoinPart.cs


示例7: FromTableSubQuerySource

        internal FromTableSubQuerySource(bool caseInsensitive, string uniqueKey, SqlQueryExpression queryExpression,
			QueryExpressionFrom fromSet, ObjectName alias)
        {
            UniqueName = uniqueKey;
            QueryExpression = queryExpression;
            QueryFrom = fromSet;
            AliasName = alias;
            IgnoreCase = caseInsensitive;
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:9,代码来源:FromTableSubQuerySource.cs


示例8: PlanQuery

        public IQueryPlanNode PlanQuery(IQueryContext context, SqlQueryExpression queryExpression, IEnumerable<SortColumn> sortColumns)
        {
            var queryFrom = QueryExpressionFrom.Create(context, queryExpression);
            var orderBy = new List<SortColumn>();
            if (sortColumns != null)
                orderBy.AddRange(sortColumns);

            return PlanQuery(context, queryExpression, queryFrom, orderBy);
        }
开发者ID:prepare,项目名称:deveeldb,代码行数:9,代码来源:QueryPlanner.cs


示例9: SelectIntoStatement

        public SelectIntoStatement(SqlQueryExpression queryExpression, SqlExpression reference)
        {
            if (queryExpression == null)
                throw new ArgumentNullException("queryExpression");
            if (reference == null)
                throw new ArgumentNullException("reference");

            QueryExpression = queryExpression;
            Reference = reference;
        }
开发者ID:prepare,项目名称:deveeldb,代码行数:10,代码来源:SelectIntoStatement.cs


示例10: InsertSelectStatement

        public InsertSelectStatement(ObjectName tableName, IEnumerable<string> columnNames, SqlQueryExpression queryExpression)
        {
            if (tableName == null)
                throw new ArgumentNullException("tableName");
            if (queryExpression == null)
                throw new ArgumentNullException("queryExpression");

            TableName = tableName;
            ColumnNames = columnNames;
            QueryExpression = queryExpression;
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:11,代码来源:InsertSelectStatement.cs


示例11: CreateViewStatement

        public CreateViewStatement(string viewName, IEnumerable<string> columnNames, SqlQueryExpression queryExpression)
        {
            if (viewName == null)
                throw new ArgumentNullException("viewName");
            if (queryExpression == null)
                throw new ArgumentNullException("queryExpression");

            ViewName = viewName;
            ColumnNames = columnNames;
            QueryExpression = queryExpression;
        }
开发者ID:prepare,项目名称:deveeldb,代码行数:11,代码来源:CreateViewStatement.cs


示例12: ViewInfo

        public ViewInfo(TableInfo tableInfo, SqlQueryExpression queryExpression, IQueryPlanNode queryPlan)
        {
            if (tableInfo == null)
                throw new ArgumentNullException("tableInfo");
            if (queryExpression == null)
                throw new ArgumentNullException("queryExpression");

            TableInfo = tableInfo;
            QueryExpression = queryExpression;
            QueryPlan = queryPlan;
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:11,代码来源:ViewInfo.cs


示例13: DeclareInsensitiveCursor

        public void DeclareInsensitiveCursor()
        {
            var query = new SqlQueryExpression(new []{new SelectColumn(SqlExpression.Constant("*")) });
            query.FromClause = new FromClause();
            query.FromClause.AddTable("test_table");

            Assert.DoesNotThrow(() => Query.DeclareInsensitiveCursor("c1", query));

            var exists = Query.ObjectExists(DbObjectType.Cursor, new ObjectName("c1"));
            Assert.IsTrue(exists);
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:11,代码来源:CursorTests.cs


示例14: DeclareCursorStatement

        public DeclareCursorStatement(string cursorName, IEnumerable<CursorParameter> parameters, CursorFlags flags, SqlQueryExpression queryExpression)
        {
            if (queryExpression == null)
                throw new ArgumentNullException("queryExpression");
            if (String.IsNullOrEmpty(cursorName))
                throw new ArgumentNullException("cursorName");

            CursorName = cursorName;
            Parameters = parameters;
            Flags = flags;
            QueryExpression = queryExpression;
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:12,代码来源:DeclareCursorStatement.cs


示例15: SelectScalar

        private Field SelectScalar(string column)
        {
            var query = new SqlQueryExpression(new [] {new SelectColumn(SqlExpression.Reference(new ObjectName(column))) });
            query.FromClause.AddTable("seq1");

            var result = AdminQuery.Select(query);
            var row = result.FirstOrDefault();
            if (row == null)
                return Field.Null();

            return row.GetValue(0);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:12,代码来源:SelectSequenceTests.cs


示例16: QueryInfo

        public QueryInfo(IRequest request, SqlQueryExpression expression, IEnumerable<SortColumn> sortColumns, QueryLimit limit)
        {
            if (expression == null)
                throw new ArgumentNullException("expression");
            if (request == null)
                throw new ArgumentNullException("request");

            Expression = expression;
            Request = request;
            SortColumns = sortColumns;
            Limit = limit;
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:12,代码来源:QueryInfo.cs


示例17: ExecuteSelectAll

        public void ExecuteSelectAll()
        {
            var expression =
                new SqlQueryExpression(new[] {new SelectColumn(SqlExpression.Reference(new ObjectName("first_name")))});
            expression.FromClause.AddTable("test_table");

            Field result = null;
            Assert.DoesNotThrow(() => result = expression.EvaluateToConstant(AdminQuery, null));
            Assert.IsNotNull(result);
            Assert.IsInstanceOf<QueryType>(result.Type);
            Assert.IsNotNull(result.Value);
            Assert.IsInstanceOf<SqlQueryObject>(result.Value);

            ITable queryResult = null;

            Assert.DoesNotThrow(() => queryResult = ((SqlQueryObject) result.Value).QueryPlan.Evaluate(AdminQuery));
            Assert.IsNotNull(queryResult);
            Assert.AreEqual(3, queryResult.RowCount);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:19,代码来源:SqlQueryExpressionTests.cs


示例18: DeleteFrom

        public static int DeleteFrom(this IQuery context, ObjectName tableName, SqlExpression expression, int limit)
        {
            if (expression is SqlQueryExpression)
                return context.DeleteFrom(tableName, (SqlQueryExpression)expression, limit);

            var table = context.GetMutableTable(tableName);
            if (table == null)
                throw new ObjectNotFoundException(tableName);

            var queryExpression = new SqlQueryExpression(new List<SelectColumn> { SelectColumn.Glob("*") });
            queryExpression.FromClause.AddTable(tableName.Name);
            queryExpression.WhereExpression = expression;

            var planExpression = queryExpression.Evaluate(context, null);
            var plan = (SqlQueryObject)((SqlConstantExpression)planExpression).Value.Value;
            var deleteSet = plan.QueryPlan.Evaluate(context);

            return context.DeleteFrom(tableName, deleteSet, limit);
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:19,代码来源:QueryContext.Tables.Commands.cs


示例19: ObjectNotFoundException

        IStatement IPreparableStatement.Prepare(IRequest request)
        {
            var tableName = request.Query.ResolveTableName(TableName);

            if (!request.Query.TableExists(tableName))
                throw new ObjectNotFoundException(tableName);

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

            var queryInfo = new QueryInfo(request, queryExp);
            if (Limit > 0)
                queryInfo.Limit = new QueryLimit(Limit);

            var queryPlan = request.Query.Context.QueryPlanner().PlanQuery(queryInfo);

            return new Prepared(tableName, queryPlan);
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:19,代码来源:DeleteStatement.cs


示例20: DeclareCursor

 public static void DeclareCursor(this IRequest context, string cursorName, CursorFlags flags, SqlQueryExpression query)
 {
     context.DeclareCursor(new CursorInfo(cursorName, flags, query));
 }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:4,代码来源:RequestExtensions.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Parser.Token类代码示例发布时间:2022-05-24
下一篇:
C# Expressions.SqlExpression类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap