예제 #1
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);
        }
예제 #2
0
            public bool MoveNext()
            {
                if (currentOperator == null)
                {
                    return(false);
                }

                if (outputFormat == OutputFormat.GraphSON)
                {
                    List <RawRecord> rawRecordResults = new List <RawRecord>();

                    RawRecord outputRec  = null;
                    bool      firstEntry = true;
                    while ((outputRec = currentOperator.Next()) != null)
                    {
                        rawRecordResults.Add(outputRec);
                        firstEntry = false;
                    }

                    if (firstEntry && !firstCall)
                    {
                        return(false);
                    }
                    else
                    {
                        firstCall     = false;
                        currentRecord = GraphSONProjector.ToGraphSON(rawRecordResults, this.connection);
                        return(true);
                    }
                }
                else
                {
                    RawRecord outputRec = null;
                    if ((outputRec = currentOperator.Next()) != null)
                    {
                        currentRecord = outputRec[0].ToString();
                        return(currentRecord != null);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }