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


C# IQuery.Commit方法代码示例

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


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

示例1: AddTestData

        private void AddTestData(IQuery context)
        {
            var table = context.GetMutableTable(ObjectName.Parse("APP.people"));
            var row = table.NewRow();

            // row.SetValue("id", DataObject.Integer(0));
            row.SetDefault(0, context);
            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.SetDefault(0, context);
            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.SetDefault(0, context);
            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);

            context.Commit();
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:35,代码来源:TableQueryTests.cs

示例2: ExecuteQuery

        protected virtual IQueryResponse[] ExecuteQuery(IQuery context, string text, IEnumerable<QueryParameter> parameters)
        {
            // TODO: Log a debug message..

            IQueryResponse[] response = null;

            try {
                // Execute the Query (behaviour for this comes from super).
                response = CoreExecuteQuery(context, text, parameters);

                // Return the result.
                return response;
            } finally {
                // This always happens after tables are unlocked.
                // Also guarenteed to happen even if something fails.

                // If we are in auto-commit mode then commit the Query here.
                // Do we auto-commit?
                if (context.AutoCommit()) {
                    // If an error occured then roll-back
                    if (response == null) {
                        // Rollback.
                        context.Rollback();
                    } else {
                        try {
                            // Otherwise commit.
                            context.Commit();
                        } catch (Exception) {
                            foreach (IQueryResponse queryResponse in response) {
                                // Dispose this response if the commit failed.
                                DisposeResult(queryResponse.ResultId);
                            }

                            // And throw the SQL Exception
                            throw;
                        }
                    }
                }
            }
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:40,代码来源:ServerConnector.cs


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