Ejemplo n.º 1
0
        public void Execute(Dictionary <string, Table> tables, SqlIfElseStatement ifElseStatement)
        {
            var rawData   = new RawData(_Command);
            var evaluator = new EvaluateBooleanExpression(rawData, _Database, _Command);
            var isTrue    = evaluator.Evaluate(new List <RawTableRow>( ), ifElseStatement.Condition);

            if (isTrue && ifElseStatement.TrueStatement != null)
            {
                _Database.ExecuteStatement(_Command, ifElseStatement.TrueStatement);
            }
            else if (isTrue == false && ifElseStatement.FalseStatement != null)
            {
                _Database.ExecuteStatement(_Command, ifElseStatement.FalseStatement);
            }
        }
Ejemplo n.º 2
0
        public void Execute(SqlExecuteModuleStatement executeProcedure)
        {
            var name = Helper.GetQualifiedName(executeProcedure.Module.ObjectIdentifier);

            if (_MemoryDatabase.StoredProcedures.ContainsKey(name) == false)
            {
                throw new SqlInvalidObjectNameException(name);
            }
            var storedProcedure = _MemoryDatabase.StoredProcedures[name];
            var command         = new MemoryDbCommand(_Command.Connection)
            {
                DataReader = _Command.DataReader
            };

            SetStoredProcedureParameters(command, storedProcedure, executeProcedure.Arguments);
            foreach (var statement in storedProcedure.Statements)
            {
                _MemoryDatabase.ExecuteStatement(command, statement);
            }
        }