Пример #1
0
            public void Execute(IDataAccessContext context, IStatementBase statement)
            {
                bool continued;

                switch (statement)
                {
                case SelectStatement select:
                    continued = _select.Execute(context, select);
                    break;

                case DeleteStatement delete:
                    continued = _delete.Execute(context, delete);
                    break;

                case InsertStatement insert:
                    continued = _insert.Execute(context, insert);
                    break;

                case UpdateStatement update:
                    continued = _update.Execute(context, update);
                    break;

                case UpsertStatement upsert:
                    continued = _upsert.Execute(context, upsert);
                    break;

                case ExistStatement exist:
                    continued = _exist.Execute(context, exist);
                    break;

                case ExecutionStatement execution:
                    continued = _execution.Execute(context, execution);
                    break;

                case AggregateStatement aggregate:
                    continued = _aggregate.Execute(context, aggregate);
                    break;

                default:
                    continued = context.Session.Build(statement).ExecuteNonQuery() > 0;
                    break;
                }

                if (continued && statement.HasSlaves)
                {
                    foreach (var slave in statement.Slaves)
                    {
                        this.Execute(context, slave);
                    }
                }
            }
Пример #2
0
            public void Execute(IDataAccessContext context, IStatementBase statement)
            {
                switch (statement)
                {
                case SelectStatement select:
                    _select.Execute(context, select);
                    break;

                case DeleteStatement delete:
                    _delete.Execute(context, delete);
                    break;

                case InsertStatement insert:
                    _insert.Execute(context, insert);
                    break;

                case UpdateStatement update:
                    _update.Execute(context, update);
                    break;

                case UpsertStatement upsert:
                    _upsert.Execute(context, upsert);
                    break;

                case CountStatement count:
                    _count.Execute(context, count);
                    break;

                case ExistStatement exist:
                    _exist.Execute(context, exist);
                    break;

                case ExecutionStatement execution:
                    _execution.Execute(context, execution);
                    break;

                default:
                    context.Session.Build(statement).ExecuteNonQuery();
                    break;
                }
            }