Inheritance: WSqlFragment
Example #1
0
        private WSqlFragment ConvertFragment(TSqlFragment fragment)
        {

            var tscript = fragment as TSqlScript;

            var wscript = new WSqlScript
            {
                FirstTokenIndex = tscript.FirstTokenIndex,
                LastTokenIndex = tscript.LastTokenIndex,
                Batches = tscript.Batches == null ? null : new List<WSqlBatch>(tscript.Batches.Count),
            };

            foreach (var tbatch in tscript.Batches)
            {
                var wbatch = new WSqlBatch
                {
                    FirstTokenIndex = tbatch.FirstTokenIndex,
                    LastTokenIndex = tbatch.LastTokenIndex,
                    Statements = new List<WSqlStatement>(tbatch.Statements.Count),
                };

                foreach (var wstat in tbatch.Statements.Select(ParseStatement))
                {
                    wbatch.Statements.Add(wstat);
                }

                wscript.Batches.Add(wbatch);
            }

            return wscript;
        }
Example #2
0
        public List <string> Next()
        {
            WSqlScript sqlScript = this.GetEndOp().ToSqlScript();

            SqlScript = sqlScript.ToString();

            GraphViewExecutionOperator op = sqlScript.Batches[0].Compile(null, this.connection);
            List <RawRecord>           rawRecordResults = new List <RawRecord>();
            RawRecord outputRec = null;

            while ((outputRec = op.Next()) != null)
            {
                rawRecordResults.Add(outputRec);
            }

            List <string> results = new List <string>();

            switch (outputFormat)
            {
            case OutputFormat.GraphSON:
                results.Add(GraphSONProjector.ToGraphSON(rawRecordResults, this.connection));
                break;

            default:
                foreach (var record in rawRecordResults)
                {
                    FieldObject field = record[0];
                    results.Add(field.ToString());
                }
                break;
            }

            return(results);
        }
 public virtual void Visit(WSqlScript node)
 {
     node.AcceptChildren(this);
 }
 public virtual void Visit(WSqlScript node)
 {
     node.AcceptChildren(this);
 }