Exemple #1
0
        public override IEnumerable <BsonDocument> Input(LiteEngine engine, BsonValue options)
        {
            var query = options.AsString;

            var sql = new SqlParser(engine, new Tokenizer(query), null);

            using (var reader = sql.Execute())
            {
                while (reader.Read())
                {
                    var value = reader.Current;

                    yield return(value.IsDocument ? value.AsDocument : new BsonDocument {
                        ["expr"] = value
                    });
                }
            }
        }
        public override IEnumerable <BsonDocument> Input(BsonValue options)
        {
            var query = options?.AsString ?? throw new LiteException(0, $"Collection $query(sql) requires `sql` string parameter");

            var sql = new SqlParser(_engine, new Tokenizer(query), null);

            using (var reader = sql.Execute())
            {
                while (reader.Read())
                {
                    var value = reader.Current;

                    yield return(value.IsDocument ? value.AsDocument : new BsonDocument {
                        ["expr"] = value
                    });
                }
            }
        }