Example #1
0
        public BsonValue Run(DbEngine engine, string command)
        {
            if (string.IsNullOrEmpty(command))
            {
                return(BsonValue.Null);
            }

            var s = new StringScanner(command);

            foreach (var cmd in _commands)
            {
                if (cmd.IsCommand(s))
                {
                    return(cmd.Execute(engine, s));
                }
            }

            throw LiteException.InvalidCommand(command);
        }
Example #2
0
        public BsonValue Run(string command)
        {
            if (string.IsNullOrEmpty(command))
            {
                return(BsonValue.Null);
            }

            var s = new StringScanner(command);

            foreach (var cmd in this.Commands)
            {
                if (cmd.IsCommand(s))
                {
                    if (this.Database == null)
                    {
                        throw LiteException.NoDatabase();
                    }

                    return(cmd.Execute(this.Database, s));
                }
            }

            throw LiteException.InvalidCommand(command);
        }