1
0
Fork 0

fixed test

This commit is contained in:
Jan Steemann 2016-03-21 13:46:58 +01:00
parent ecf3120190
commit 811732230c
3 changed files with 11 additions and 20 deletions

View File

@ -659,12 +659,7 @@ static void RegisterCollectionInTransaction(
arangodb::AqlTransaction* trx, std::string const& collectionName,
TRI_voc_cid_t& cid) {
cid = trx->resolver()->getCollectionIdLocal(collectionName);
if (cid == 0) {
THROW_ARANGO_EXCEPTION_FORMAT(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND, "'%s'",
collectionName.c_str());
}
trx->addCollectionAtRuntime(cid);
trx->addCollectionAtRuntime(cid, collectionName);
}
////////////////////////////////////////////////////////////////////////////////
@ -868,7 +863,7 @@ static AqlValue VertexIdsToAqlValueVPack(arangodb::aql::Query* query,
static arangodb::Index* getGeoIndex(arangodb::AqlTransaction* trx,
TRI_voc_cid_t const& cid,
std::string const& colName) {
trx->addCollectionAtRuntime(cid);
trx->addCollectionAtRuntime(cid, colName);
auto document = trx->documentCollection(cid);
@ -2281,7 +2276,7 @@ AqlValue Functions::Neighbors(arangodb::aql::Query* query,
TRI_voc_cid_t eCid = trx->resolver()->getCollectionIdLocal(eColName);
// ensure the collection is loaded
trx->addCollectionAtRuntime(eCid);
trx->addCollectionAtRuntime(eCid, eColName);
// Function to return constant distance
auto wc = [](VPackSlice) -> double { return 1; };
@ -3432,11 +3427,7 @@ AqlValue Functions::CollectionCount(
auto resolver = trx->resolver();
TRI_voc_cid_t cid = resolver->getCollectionIdLocal(colName);
if (cid == 0) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
}
trx->addCollectionAtRuntime(cid);
trx->addCollectionAtRuntime(cid, colName);
auto document = trx->documentCollection(cid);
if (document == nullptr) {
@ -3877,7 +3868,7 @@ AqlValue Functions::Fulltext(arangodb::aql::Query* query,
auto resolver = trx->resolver();
TRI_voc_cid_t cid = resolver->getCollectionIdLocal(colName);
trx->addCollectionAtRuntime(cid);
trx->addCollectionAtRuntime(cid, colName);
auto document = trx->documentCollection(cid);

View File

@ -810,12 +810,12 @@ OperationResult Transaction::anyLocal(std::string const& collectionName,
//////////////////////////////////////////////////////////////////////////////
void Transaction::addCollectionAtRuntime(std::string const& collectionName) {
auto cid = resolver()->getCollectionId(collectionName);
if (cid == 0) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND);
THROW_ARANGO_EXCEPTION_FORMAT(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND, "'%s'",
collectionName.c_str());
}
addCollectionAtRuntime(cid);
addCollectionAtRuntime(cid, collectionName);
}
//////////////////////////////////////////////////////////////////////////////

View File

@ -267,7 +267,7 @@ class Transaction {
/// @brief add a collection to the transaction for read, at runtime
//////////////////////////////////////////////////////////////////////////////
void addCollectionAtRuntime(TRI_voc_cid_t cid) {
void addCollectionAtRuntime(TRI_voc_cid_t cid, std::string const& collectionName) {
auto collection = this->trxCollection(cid);
if (collection == nullptr) {
@ -281,8 +281,8 @@ class Transaction {
collection = this->trxCollection(cid);
if (collection == nullptr) {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
"collection is a nullptr");
THROW_ARANGO_EXCEPTION_FORMAT(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND, "'%s'",
collectionName.c_str());
}
}
}