diff --git a/.travis.yml b/.travis.yml index 1b6719cdc9..71d001b7b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,10 +27,7 @@ install: - sudo apt-get -y install gdb before_script: "bash -c Installation/travisCI/before_script.sh" -script: - - "bash -c Installation/travisCI/build.sh" - - "bash -c Installation/travisCI/jslint.sh" - - "bash -c Installation/travisCI/tests.sh" +script: "bash -c Installation/travisCI/script.sh" after_failure: "bash -c Installation/travisCI/after_failure.sh" branches: only: diff --git a/Installation/travisCI/script.sh b/Installation/travisCI/script.sh new file mode 100755 index 0000000000..b95c3082d2 --- /dev/null +++ b/Installation/travisCI/script.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +echo +echo '$0: setup make-system' + +make setup || exit 1 + +echo +echo "$0: configuring ArangoDB" + +./configure --enable-relative + +echo +echo "$0: compiling ArangoDB" + +make -j2 || exit 1 + +echo +echo "$0: testing ArangoDB" + +ulimit -c unlimited -S # enable core files +make jslint unittests-shell-server unittests-shell-server-aql unittests-http-server SKIP_RANGES=1 || exit 1 + +echo +echo "$0: done" diff --git a/arangod/VocBase/vocbase.cpp b/arangod/VocBase/vocbase.cpp index 69f461a68a..a8494c1497 100644 --- a/arangod/VocBase/vocbase.cpp +++ b/arangod/VocBase/vocbase.cpp @@ -1858,8 +1858,26 @@ TRI_vocbase_col_t* TRI_LookupCollectionByIdVocBase (TRI_vocbase_t* vocbase, TRI_vocbase_col_t* TRI_FindCollectionByNameOrCreateVocBase (TRI_vocbase_t* vocbase, char const* name, const TRI_col_type_t type) { + if (name == nullptr) { + return nullptr; + } + + TRI_vocbase_col_t* found = nullptr; + TRI_READ_LOCK_COLLECTIONS_VOCBASE(vocbase); - TRI_vocbase_col_t* found = static_cast(TRI_LookupByKeyAssociativePointer(&vocbase->_collectionsByName, name)); + if (name[0] >= '0' && name[0] <= '9') { + // support lookup by id, too + try { + TRI_voc_cid_t id = triagens::basics::StringUtils::uint64(name, strlen(name)); + found = static_cast(TRI_LookupByKeyAssociativePointer(&vocbase->_collectionsById, &id)); + } + catch (...) { + // no need to throw here... found will still be a nullptr + } + } + else { + found = static_cast(TRI_LookupByKeyAssociativePointer(&vocbase->_collectionsByName, name)); + } TRI_READ_UNLOCK_COLLECTIONS_VOCBASE(vocbase); if (found != nullptr) {