1
0
Fork 0

Merge branch 'devel' of ssh://github.com/triAGENS/ArangoDB into aql2

This commit is contained in:
Max Neunhoeffer 2014-07-30 09:46:13 +02:00
commit b9e5218d81
5 changed files with 46 additions and 8 deletions

View File

@ -1891,7 +1891,10 @@ var bindVertexCollections = function(self, vertexCollections) {
wrap.remove = function(vertexId, options) {
//delete all edges using the vertex in all graphs
var graphs = getGraphCollection().toArray();
var vertexCollectionName = vertexId.split("/")[0];
var vertexCollectionName = key;
if (vertexId.indexOf("/") === -1) {
vertexId = key + "/" + vertexId;
}
self.__collectionsToLock.push(vertexCollectionName);
graphs.forEach(
function(graph) {

View File

@ -1890,7 +1890,10 @@ var bindVertexCollections = function(self, vertexCollections) {
wrap.remove = function(vertexId, options) {
//delete all edges using the vertex in all graphs
var graphs = getGraphCollection().toArray();
var vertexCollectionName = vertexId.split("/")[0];
var vertexCollectionName = key;
if (vertexId.indexOf("/") === -1) {
vertexId = key + "/" + vertexId;
}
self.__collectionsToLock.push(vertexCollectionName);
graphs.forEach(
function(graph) {

View File

@ -1979,8 +1979,8 @@ function EdgesAndVerticesSuite() {
var myED = "unitTestEdgeCollection4711";
var myVD1 = "unitTestVertexCollection4711";
var myVD2 = "unitTestVertexCollection4712";
try {graph._drop(myGraphName, true)} catch (ignore){}
try {db._drop(myED)} catch (ignore){}
try {graph._drop(myGraphName, true);} catch (ignore){}
try {db._drop(myED);} catch (ignore){}
try {
graph._create(
myGraphName,
@ -2045,9 +2045,24 @@ function EdgesAndVerticesSuite() {
},
test_vC_remove : function () {
var vertex = g[vc1].save({first_name: "Tim"});
var col = g[vc1];
var counter = col.count();
var vertex = col.save({first_name: "Tim"});
assertEqual(col.count(), counter + 1);
var vertexId = vertex._id;
var result = g[vc1].remove(vertexId);
var result = col.remove(vertexId);
assertEqual(col.count(), counter);
assertTrue(result);
},
test_vC_remove_by_key : function () {
var col = g[vc1];
var counter = col.count();
var vertex = col.save({first_name: "Tim"});
assertEqual(col.count(), counter + 1);
var vertexId = vertex._key;
var result = col.remove(vertexId);
assertEqual(col.count(), counter);
assertTrue(result);
},
@ -2143,6 +2158,19 @@ function EdgesAndVerticesSuite() {
assertTrue(edge);
},
test_eC_remove_by_key : function () {
var vertex1 = g[vc1].save({first_name: "Tom"});
var vertexId1 = vertex1._id;
var vertex2 = g[vc1].save({first_name: "Tim"});
var vertexId2 = vertex2._id;
var counter = g[ec1].count();
var edge = g[ec1].save(vertexId1, vertexId2, {});
assertEqual(g[ec1].count(), counter + 1);
var edgeId1 = edge._key;
edge = g[ec1].remove(edgeId1);
assertTrue(edge);
assertEqual(g[ec1].count(), counter);
},
test_eC_removeWithEdgesAsVertices : function () {

View File

@ -28,6 +28,8 @@
/// @author Copyright 2011-2014, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "ShellImplFactory.h"
#ifdef _WIN32
#include "LinenoiseShell.h"
#elif defined TRI_HAVE_LINENOISE
@ -38,8 +40,6 @@
#include "DummyShell.h"
#endif
#include "ShellImplFactory.h"
using namespace triagens;
using namespace std;

View File

@ -34,6 +34,10 @@
#include "Basics/Common.h"
namespace triagens {
class ShellImplementation;
class Completer;
class ShellImplFactory {
public: