예제 #1
0
        public override WTableReference ToTableReference()
        {
            List <WScalarExpression> parameters = new List <WScalarExpression>();
            bool isList = false;

            if (GremlinUtil.IsList(ConstantValue) || GremlinUtil.IsArray(ConstantValue))
            {
                isList = true;  //1 It's a list
                foreach (var value in (IEnumerable)ConstantValue)
                {
                    parameters.Add(SqlUtil.GetValueExpr(value));
                }
            }
            else if (GremlinUtil.IsNumber(ConstantValue) || ConstantValue is string || ConstantValue is bool)
            {
                parameters.Add(SqlUtil.GetValueExpr(ConstantValue));
            }
            else
            {
                throw new ArgumentException();
            }
            var tableRef = SqlUtil.GetFunctionTableReference(GremlinKeyword.func.Constant, parameters, GetVariableName());

            ((WConstantReference)tableRef).IsList = isList;
            return(SqlUtil.GetCrossApplyTableReference(tableRef));
        }
예제 #2
0
 internal static bool IsInjectable(object injection)
 {
     if (GremlinUtil.IsList(injection) ||
         GremlinUtil.IsArray(injection) ||
         GremlinUtil.IsNumber(injection) ||
         injection is string ||
         injection is bool)
     {
         return(true);
     }
     else
     {
         throw new ArgumentException();
     }
 }
예제 #3
0
 public GraphTraversal2 Constant(object value)
 {
     if (GremlinUtil.IsList(value) ||
         GremlinUtil.IsArray(value) ||
         GremlinUtil.IsNumber(value) ||
         value is string ||
         value is bool)
     {
         this.AddOperator(new GremlinConstantOp(value));
     }
     else
     {
         throw new ArgumentException();
     }
     return(this);
 }
예제 #4
0
        public override WTableReference ToTableReference()
        {
            List <WScalarExpression> parameters = new List <WScalarExpression>();

            if (InputVariable == null)
            {
                //g.Inject()
                parameters.Add(SqlUtil.GetValueExpr(null));
            }
            else
            {
                parameters.Add(InputVariable.GetDefaultProjection().ToScalarExpression());
            }

            bool isList = false;

            if (GremlinUtil.IsList(Injection) || GremlinUtil.IsArray(Injection))
            {
                isList = true;  //1 It's a list
                foreach (var value in (IEnumerable)Injection)
                {
                    parameters.Add(SqlUtil.GetValueExpr(value));
                }
            }
            else if (GremlinUtil.IsNumber(Injection) || Injection is string || Injection is bool)
            {
                parameters.Add(SqlUtil.GetValueExpr(Injection));
            }
            else
            {
                throw new ArgumentException();
            }

            var tableRef = SqlUtil.GetFunctionTableReference(GremlinKeyword.func.Inject, parameters, GetVariableName());

            ((WInjectTableReference)tableRef).IsList = isList;
            return(SqlUtil.GetCrossApplyTableReference(tableRef));
        }