Ejemplo n.º 1
0
        internal void DropProperties(GremlinVariable belongToVariable, List <string> PropertyKeys)
        {
            List <object> properties = new List <object>();

            foreach (var propertyKey in PropertyKeys)
            {
                properties.Add(propertyKey);
                properties.Add(null);
            }
            if (PropertyKeys.Count == 0)
            {
                properties.Add(GremlinKeyword.Star);
                properties.Add(null);
            }

            GremlinUpdatePropertiesVariable dropVariable = null;

            switch (belongToVariable.GetVariableType())
            {
            case GremlinVariableType.Vertex:
                dropVariable = new GremlinUpdateVertexPropertiesVariable(belongToVariable, properties);
                break;

            case GremlinVariableType.Edge:
                dropVariable = new GremlinUpdateEdgePropertiesVariable(belongToVariable, properties);
                break;
            }

            VariableList.Add(dropVariable);
            TableReferences.Add(dropVariable);
            SetPivotVariable(dropVariable);
        }
Ejemplo n.º 2
0
        internal virtual void Property(GremlinToSqlContext currentContext, List <object> properties)
        {
            GremlinUpdatePropertiesVariable updateVariable;

            switch (GetVariableType())
            {
            case GremlinVariableType.Vertex:
                updateVariable =
                    currentContext.VariableList.Find(
                        p =>
                        (p is GremlinUpdateVertexPropertiesVariable) &&
                        (p as GremlinUpdateVertexPropertiesVariable).VertexVariable == this) as GremlinUpdateVertexPropertiesVariable;
                if (updateVariable == null)
                {
                    updateVariable = new GremlinUpdateVertexPropertiesVariable(this, properties);
                    currentContext.VariableList.Add(updateVariable);
                    currentContext.TableReferences.Add(updateVariable);
                }
                else
                {
                    updateVariable.Property(currentContext, properties);
                }
                break;

            case GremlinVariableType.Edge:
                updateVariable =
                    currentContext.VariableList.Find(
                        p =>
                        (p is GremlinUpdateEdgePropertiesVariable) &&
                        (p as GremlinUpdateEdgePropertiesVariable).EdgeVariable == this) as GremlinUpdateEdgePropertiesVariable;
                if (updateVariable == null)
                {
                    updateVariable = new GremlinUpdateEdgePropertiesVariable(this, properties);
                    currentContext.VariableList.Add(updateVariable);
                    currentContext.TableReferences.Add(updateVariable);
                }
                else
                {
                    updateVariable.Property(currentContext, properties);
                }
                break;

            default:
                throw new Exception();
            }
        }