Esempio n. 1
0
        public DataResult Delete(ICypherFluentQuery query)
        {
            try
            {
                query.ExecuteWithoutResults();

                return(CreateDataResult(query.Query.QueryText, 1, default(T), DataResultType.Success,
                                        "Node deleted", "Node deleted"));
            }
            catch (DbException exception)
            {
                return(CreateDataResult(query.Query.QueryText, 0, default(T), DataResultType.UnableToDeleteRecord,
                                        "Delete failed", "Delete failed", null, exception));
            }
        }
Esempio n. 2
0
 public void ExecuteWithoutResults(ICypherFluentQuery cypher)
 {
     try
     {
         if (Connection.IsConnected)
         {
             cypher.ExecuteWithoutResults();
         }
         else
         {
             Console.WriteLine("It seems like you don't have a connection with Neo4j... \n" +
                               "Make sure that an instance of Neo4j is connected and running before calling any cyphers.");
         }
     }
     catch (NeoException e)
     {
         throw new Exception("There was an error when executing the cypher: \n" +
                             "\"" + e.Message + "\"");
     }
     finally
     {
         Connection.Dispose();
     }
 }
        public void Execute(ICypherFluentQuery cypher)
        {

            ProcessStacks();

            foreach (var query in _queryStack)
            {

                if (query.QueryType == QueryTypeEnum.Match)
                {
                    cypher = cypher.Match(query.QueryString);
                    continue;
                }
                if (query.QueryType == QueryTypeEnum.OptionalMatch)
                {
                    cypher = cypher.OptionalMatch(query.QueryString);
                    continue;
                }

                if (query.QueryType == QueryTypeEnum.Where)
                {
                    cypher = cypher.Where(query.QueryString);
                    continue;
                }

                if (query.QueryType == QueryTypeEnum.Create)
                {
                    cypher = cypher.Create(query.QueryString);
                    continue;
                }

                if (query.QueryType == QueryTypeEnum.Merge)
                {
                    cypher = cypher.Merge(query.QueryString);
                    continue;
                }

                if (query.QueryType == QueryTypeEnum.Delete)
                {
                    cypher = cypher.Delete(query.QueryString);
                    continue;
                }

                if (query.QueryType == QueryTypeEnum.With)
                {
                    cypher = cypher.With(query.QueryString);
                    continue;
                }

            }

            cypher.ExecuteWithoutResults();
        }