← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/use_pos into lp:zorba

 

Matthias Brantner has proposed merging lp:~zorba-coders/zorba/use_pos into lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/use_pos/+merge/85368

removed obsolete code guarded by the USE_POS macro
-- 
https://code.launchpad.net/~zorba-coders/zorba/use_pos/+merge/85368
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2011-12-01 16:19:52 +0000
+++ ChangeLog	2011-12-12 17:30:21 +0000
@@ -1,5 +1,8 @@
 Zorba - The XQuery Processor
 
+version 2.2
+  * Added index management function to the C++ api's StaticCollectionManager.
+
 version 2.1
 
 New Features:

=== modified file 'include/zorba/static_collection_manager.h'
--- include/zorba/static_collection_manager.h	2011-09-12 22:42:28 +0000
+++ include/zorba/static_collection_manager.h	2011-12-12 17:30:21 +0000
@@ -23,14 +23,14 @@
 namespace zorba {
 
   /** \brief Using the StaticCollectionManager one can retrieve information
-   *   about statically declared collections as well as manage them.
+   *   about statically declared collections and indexes as well as manage them.
    *
    * The StaticCollectionManager can be retrieved from (1) a compiled XQuery
    * or (2) a StaticContext object. In both cases, this class provides access
-   * to information for the collections that are declared in (1) all the
+   * to information for the collections and indexes that are declared in (1) all the
    * modules (transitively) imported by the main query or (2) the module
    * that resulted in the compilation of the StaticContext, respectively.
-   * Moreover, this class allows to create or delete such collections.
+   * Moreover, this class allows to create or delete such collections and indexes.
    *
    */
   class ZORBA_DLL_PUBLIC StaticCollectionManager : public CollectionManager
@@ -56,6 +56,69 @@
     virtual bool
     isDeclaredCollection(const Item& aQName) const = 0;
 
+    /**
+     * Create the index with the given name.
+     *
+     * @param aName The name of the index to create.
+     *
+     * @throw zerr:ZDDY0021 if a index with the given name is not declared.
+     *
+     * @throw zerr:ZDDY0022 if a index with the given name already exists.
+     */
+    virtual void
+    createIndex(const Item& aQName) = 0;
+
+    /**
+     * Create the index with the given name.
+     *
+     * @param aName The name of the index to create.
+     *
+     * @throw zerr:ZDDY0021 if a index with the given name is not declared.
+     *
+     * @throw zerr:ZDDY0009 if a index with the given name does not exist
+     */
+    virtual void
+    deleteIndex(const Item& aQName) = 0;
+
+    /**
+     * This function returns a sequence of names of the indexes
+     * that are available.
+     *
+     * @return The list of names of the available indexes.
+     */
+    virtual ItemSequence_t
+    availableIndexes() const = 0;
+
+    /**
+     * This function returns true if a index with the given name is available.
+     *
+     * @param aName The name of the index that is being checked.
+     *
+     * @return true if the index is available and false otherwise.
+     */
+    virtual bool
+    isAvailableIndex(const Item& aQName) const = 0;
+
+    /**
+     * List all the indexes that are declared in the XQuery or the
+     * StaticContext that was used to retrieve this StaticCollectionManager.
+     *
+     * @return a sequence of QNames of all said indexes
+     */
+    virtual ItemSequence_t
+    declaredIndexes() const = 0;
+
+    /**
+     * Checks if a index with a given QName is declared in the XQuery
+     * or the StaticContext that was used to retrieve this
+     * StaticCollectionManager.
+     *
+     * @return true if a collection with the given name is declared,
+     *   false otherwise.
+     */
+    virtual bool
+    isDeclaredIndex(const Item& aQName) const = 0;
+
     virtual ~StaticCollectionManager() {}
 
   }; /* class StaticCollectionManager */

=== modified file 'src/api/staticcollectionmanagerimpl.cpp'
--- src/api/staticcollectionmanagerimpl.cpp	2011-09-16 13:26:06 +0000
+++ src/api/staticcollectionmanagerimpl.cpp	2011-12-12 17:30:21 +0000
@@ -68,6 +68,7 @@
   theFactory(aFactory),
   theColDDLNamespace("http://www.zorba-xquery.com/modules/store/static/collections/ddl";),
   theColDMLNamespace("http://www.zorba-xquery.com/modules/store/static/collections/dml";),
+  theIdxDDLNamespace("http://www.zorba-xquery.com/modules/store/static/indexes/ddl";),
   theDiagnosticHandler(aDiagnosticHandler)
 {
   // the context passed as parameter is not used anywhere in here.
@@ -104,6 +105,7 @@
   Zorba_CompilerHints_t lHints;
   std::ostringstream lProlog;
   lProlog << "import module namespace d = '" << theColDDLNamespace << "';";
+  lProlog << "import module namespace iddl = '" << theIdxDDLNamespace << "';";
   aCtx->loadProlog(lProlog.str(), lHints);
 }
 
@@ -245,6 +247,165 @@
 }
 
 
+/*******************************************************************************
+
+********************************************************************************/
+void
+StaticCollectionManagerImpl::createIndex(const Item& aQName)
+{
+  ZORBA_DM_TRY
+  {
+    Item lFunc = theFactory->createQName(theIdxDDLNamespace, "create");
+
+    std::vector<ItemSequence_t> lArgs;
+    lArgs.push_back(new SingletonItemSequence(aQName));
+
+    ItemSequence_t lSeq = theContext->invoke(lFunc, lArgs);
+    Iterator_t lIter = lSeq->getIterator();
+    lIter->open();
+    Item lRes;
+    lIter->next(lRes);
+  }
+  ZORBA_DM_CATCH
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+void
+StaticCollectionManagerImpl::deleteIndex(const Item& aQName)
+{
+  // do a check here in order to get better (non-confusing) error messages
+  if (!isDeclaredIndex(aQName)) 
+  {
+    throw ZORBA_EXCEPTION(zerr::ZDDY0021_INDEX_NOT_DECLARED,
+    ERROR_PARAMS(aQName.getStringValue()));
+  }
+
+  ZORBA_DM_TRY
+  {
+    if (!isAvailableIndex(aQName)) 
+    {
+      throw ZORBA_EXCEPTION(zerr::ZDDY0023_INDEX_DOES_NOT_EXIST,
+      ERROR_PARAMS(aQName.getStringValue()));
+    }
+
+    Item lFunc = theFactory->createQName(theIdxDDLNamespace, "delete");
+
+    std::vector<ItemSequence_t> lArgs;
+    lArgs.push_back(new SingletonItemSequence(aQName));
+
+    ItemSequence_t lSeq = theContext->invoke(lFunc, lArgs);
+    Iterator_t lIter = lSeq->getIterator();
+    lIter->open();
+    Item lRes;
+    lIter->next(lRes);
+  }
+  ZORBA_DM_CATCH
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+ItemSequence_t
+StaticCollectionManagerImpl::availableIndexes() const
+{
+  ZORBA_DM_TRY
+  {
+    Item lFunc = theFactory->createQName(theIdxDDLNamespace,
+                                         "available-indexes");
+
+    std::vector<ItemSequence_t> lArgs;
+    return theContext->invoke(lFunc, lArgs);
+  }
+  ZORBA_DM_CATCH
+  return 0;
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+bool
+StaticCollectionManagerImpl::isAvailableIndex(const Item& aQName) const
+{
+  // do a check here in order to get better (non-confusing) error messages
+  if (!isDeclaredIndex(aQName)) 
+  {
+    throw ZORBA_EXCEPTION(zerr::ZDDY0001_COLLECTION_NOT_DECLARED,
+    ERROR_PARAMS(aQName.getStringValue()));
+  }
+
+  ZORBA_DM_TRY
+  {
+    Item lFunc = theFactory->createQName(theIdxDDLNamespace,
+                                         "is-available-index");
+
+    std::vector<ItemSequence_t> lArgs;
+    lArgs.push_back(new SingletonItemSequence(aQName));
+
+    ItemSequence_t lSeq = theContext->invoke(lFunc, lArgs);
+    Iterator_t lIter = lSeq->getIterator();
+    lIter->open();
+    Item lRes;
+    if (!lIter->next(lRes))
+      return false;
+
+    return lRes.getBooleanValue();
+  }
+  ZORBA_DM_CATCH
+  return false;
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+ItemSequence_t
+StaticCollectionManagerImpl::declaredIndexes() const
+{
+  ZORBA_DM_TRY
+  {
+    Item lFunc = theFactory->createQName(theIdxDDLNamespace,
+                                         "declared-indexes");
+
+    std::vector<ItemSequence_t> lArgs;
+    return theContext->invoke(lFunc, lArgs);
+  }
+  ZORBA_DM_CATCH
+  return 0;
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+bool
+StaticCollectionManagerImpl::isDeclaredIndex(const Item& aQName) const
+{
+  ZORBA_DM_TRY
+  {
+    Item lFunc = theFactory->createQName(theIdxDDLNamespace,
+                                         "is-declared-index");
+
+    std::vector<ItemSequence_t> lArgs;
+    lArgs.push_back(new SingletonItemSequence(aQName));
+
+    ItemSequence_t lSeq = theContext->invoke(lFunc, lArgs);
+    Iterator_t lIter = lSeq->getIterator();
+    lIter->open();
+    Item lRes;
+    if (!lIter->next(lRes))
+      return false;
+    return lRes.getBooleanValue();
+  }
+  ZORBA_DM_CATCH
+  return false;
+}
+
+
 /////////////////////////////////////////////////////////////////////////////////
 //                                                                             //
 //  StaticCollectionManagerSetImpl                                             //
@@ -451,6 +612,132 @@
 
 ********************************************************************************/
 void
+StaticCollectionManagerSetImpl::createIndex(const Item& aQName)
+{
+  for (MgrSet::iterator lIter = theMgrs.begin();
+       lIter != theMgrs.end();
+       ++lIter) 
+  {
+    if ((*lIter)->isDeclaredIndex(aQName)) 
+    {
+        (*lIter)->createIndex(aQName);
+        return;
+    }
+  }
+
+  throw ZORBA_EXCEPTION(zerr::ZDDY0021_INDEX_NOT_DECLARED,
+  ERROR_PARAMS(aQName.getStringValue()));
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+void
+StaticCollectionManagerSetImpl::deleteIndex(const Item& aQName)
+{
+  for (MgrSet::iterator lIter = theMgrs.begin();
+       lIter != theMgrs.end();
+       ++lIter) 
+  {
+    if ((*lIter)->isDeclaredIndex(aQName)) 
+    {
+        (*lIter)->deleteIndex(aQName);
+        return;
+    }
+  }
+
+  throw ZORBA_EXCEPTION(zerr::ZDDY0021_INDEX_NOT_DECLARED,
+  ERROR_PARAMS(aQName.getStringValue()));
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+ItemSequence_t
+StaticCollectionManagerSetImpl::availableIndexes() const
+{
+  std::vector<ItemSequence_t> lSequences;
+  for (MgrSet::const_iterator lIter = theMgrs.begin();
+       lIter != theMgrs.end();
+       ++lIter)
+  {
+    lSequences.push_back((*lIter)->availableIndexes());
+  }
+  // need to do duplicate elimination because
+  // indexes are coming from static contexts
+  // which might be imported multiple times
+  return new ItemSequenceChainer(lSequences, true);
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+bool
+StaticCollectionManagerSetImpl::isAvailableIndex(const Item& aQName) const
+{
+  for (MgrSet::const_iterator lIter = theMgrs.begin();
+       lIter != theMgrs.end(); 
+       ++lIter) 
+  {
+    if ((*lIter)->isDeclaredIndex(aQName) &&
+        (*lIter)->isAvailableIndex(aQName)) 
+    {
+      return true;
+    }
+  }
+  return false;
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+ItemSequence_t
+StaticCollectionManagerSetImpl::declaredIndexes() const
+{
+  std::vector<ItemSequence_t> lSequences;
+  for (MgrSet::const_iterator lIter = theMgrs.begin();
+       lIter != theMgrs.end(); 
+       ++lIter) 
+  {
+    lSequences.push_back((*lIter)->declaredIndexes());
+  }
+  // we need to do duplicate elimination of the sequence because
+  // the contexts might contain the declaration of a index
+  // multiple times. This happens if the set of contexts contains
+  // the context that declares the index as well as some
+  // contexts that result from compiling modules that import
+  // the module declaring the index.
+  return new ItemSequenceChainer(lSequences, true);
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+bool
+StaticCollectionManagerSetImpl::isDeclaredIndex(const Item& aQName) const
+{
+  for (MgrSet::const_iterator lIter = theMgrs.begin();
+       lIter != theMgrs.end(); 
+       ++lIter) 
+  {
+    if ((*lIter)->isDeclaredIndex(aQName)) 
+    {
+      return true;
+    }
+  }
+  return false;
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+void
 StaticCollectionManagerSetImpl::registerDiagnosticHandler(
     DiagnosticHandler* aDiagnosticHandler)
 {

=== modified file 'src/api/staticcollectionmanagerimpl.h'
--- src/api/staticcollectionmanagerimpl.h	2011-09-14 11:08:52 +0000
+++ src/api/staticcollectionmanagerimpl.h	2011-12-12 17:30:21 +0000
@@ -80,6 +80,7 @@
   ItemFactory            * theFactory;
   std::string              theColDDLNamespace;
   std::string              theColDMLNamespace;
+  std::string              theIdxDDLNamespace;
   
   StaticContext_t          theContext;
   CollectionManagerImpl*   theCollMgr;
@@ -125,6 +126,24 @@
   virtual bool
   isDeclaredCollection(const Item& aQName) const;
 
+  virtual void
+  createIndex(const Item& aQName);
+
+  virtual void
+  deleteIndex(const Item& aQName);
+
+  virtual ItemSequence_t
+  availableIndexes() const;
+
+  virtual bool
+  isAvailableIndex(const Item& aQName) const;
+
+  virtual ItemSequence_t
+  declaredIndexes() const;
+
+  virtual bool
+  isDeclaredIndex(const Item& aQName) const;
+
 }; /* class StaticCollectionManagerImpl */
 
 
@@ -187,6 +206,24 @@
   virtual bool
   isDeclaredCollection(const Item& aQName) const;
 
+  virtual void
+  createIndex(const Item& aQName);
+
+  virtual void
+  deleteIndex(const Item& aQName);
+
+  virtual ItemSequence_t
+  availableIndexes() const;
+
+  virtual bool
+  isAvailableIndex(const Item& aQName) const;
+
+  virtual ItemSequence_t
+  declaredIndexes() const;
+
+  virtual bool
+  isDeclaredIndex(const Item& aQName) const;
+
 }; /* class StaticCollectionManagerSetImpl */
 
 

=== modified file 'src/store/api/item_factory.h'
--- src/store/api/item_factory.h	2011-07-22 07:23:17 +0000
+++ src/store/api/item_factory.h	2011-12-12 17:30:21 +0000
@@ -548,47 +548,6 @@
         zstring&            baseURI,
         bool                isInSubstitutionGroup = false) = 0;
 
-#ifdef USE_POS
-  /**
-   * Create a new element node N and place it at a given position among the
-   * children of a given parent node. If no parent is given, N becomes the
-   * root (and single node) of a new XML tree.
-   *
-   * @param result         The new node N created by this method
-   * @param parent         The parent P of the new node; may be NULL.
-   * @param pos            The position, among the children of P, that N will
-   *                       occupy. If pos == current number of P's
-   *                       children, then N is appended to the list of children.
-   * @param nodeName       The fully qualified name of the new node.
-   * @param typeName       The fully qualified name of the new node's type.
-   *                       Not allowed to be NULL, use xsd:untyped instead.
-   * @param haveTypedValue Whether the node has a typed value or not (element
-   *                       nodes with complex type and element-only content do
-   *                       not have typed value).
-   * @param haveEmptyValue True if the typed value of the node is the empty
-   *                       sequence. This is the case if the element has a
-   *                       complex type with empty content.
-   * @param localBindings  A set of namespace bindings. The namespaces property
-   *                       of N will be the union of this set and the namespaces
-   *                       property of P.
-   * @param baseUri        The base uri of N. It may be NULL, in which case, the
-   *                       base-uri property of N is the same as that of P.
-   * @return               Always true (if any errors occur, the method throws
-   *                       exceptions)
-   */
- virtual bool createElementNode(
-        Item_t&             result,
-        Item*               parent,
-        ulong               pos,
-        Item_t&             nodeName,
-        Item_t&             typeName,
-        bool                haveTypedValue,
-        bool                haveEmptyValue,
-        const NsBindings&   localBindings,
-        zstring&            baseURI,
-        bool                isInSubstitutionGroup = false) = 0;
-#endif
-
   /**
    * Create a new attribute node N and place it as the last attribute of a given
    * parent node. If no parent is given, N becomes the root (and single node) of
@@ -619,43 +578,6 @@
         Item_t&              typeName,
         std::vector<Item_t>& typedValue) = 0;
 
-#ifdef USE_POS
-  /**
-   * Create a new attribute node N and place it at a given position among the
-   * attributes of a given parent node. If no parent is given, N becomes the
-   * root (and single node) of a new XML tree.
-   *
-   * @param result     The new node N created by this method
-   * @param parent     The parent P of the new node; may be NULL.
-   * @param pos        The position, among the attributes of P, that N will occupy.
-   *                   If pos == current number of P's attributes, then N is
-   *                   appended to the list of attributes.
-   * @param nodeName   The fully qualified name of the new node. The nemaspace
-   *                   binding implied by this name will be added to the namespaces
-   *                   of P. If the name prefix is "xml" and the local name is
-   *                   "base", then the base-uri property of P will be set or
-   *                   updated accordingly.
-   * @param typeName   The fully qualified name of the new node's type.
-   * @param typedValue The typed value of the new node.
-   * @return           Always true (if any errors occur, the method throws exceptions)
-   */
-  virtual bool createAttributeNode(
-        Item_t&              result,
-        Item*                parent,
-        ulong                pos,
-        Item_t&              nodeName,
-        Item_t&              typeName,
-        Item_t&              typedValue) = 0;
-
-  virtual bool createAttributeNode(
-        Item_t&              result,
-        Item*                parent,
-        ulong                pos,
-        Item_t&              nodeName,
-        Item_t&              typeName,
-        std::vector<Item_t>& typedValue) = 0;
-#endif
-
   /**
    * Create a new text node N and place it as the last child of a given parent
    * node. If no parent is given, N becomes the root (and single node) of a new
@@ -671,27 +593,6 @@
         Item*    parent,
         zstring& content) = 0;
 
-#ifdef USE_POS
-  /**
-   * Create a new text node N and place it at a given position among the
-   * children of a given parent node. If no parent is given, N becomes the
-   * root (and single node) of a new XML tree.
-   *
-   * @param result  The new node N created by this method
-   * @param parent  The parent P of the new node; may be NULL.
-   * @param pos     The position, among the children of P, that N will occupy.
-   *                If pos == current number of P's children, then N is appended
-   *                to the list of children.
-   * @param content The content of the new node.
-   * @return        Always true (if any errors occur, the method throws exceptions)
-   */
-  virtual bool createTextNode(
-        Item_t&  result,
-        Item*    parent,
-        ulong    pos,
-        zstring& content) = 0;
-#endif
-
   /**
    * Create a new text node N to store the typed value of an element node P.
    * In this case, N can be the only child of P. 
@@ -730,31 +631,6 @@
         zstring& content,
         zstring& baseUri) = 0;
 
-#ifdef USE_POS
-  /**
-   * Create a new processing instruction node N and place it at a given position
-   * among the children of a given parent node. If no parent is given, N becomes
-   * the root (and single node) of a new XML tree.
-   *
-   * @param result  The new node N created by this method
-   * @param parent  The parent P of the new node; may be NULL.
-   * @param pos     The position, among the children of P, that N will occupy.
-   *                If pos == current number of P's children, then
-   *                N is appended to the list of children.
-   * @param target  The target of the new node.
-   * @param content The content of the new node.
-   * @param baseUri The base uri of the new node. May be NULL.
-   * @return        Always true (if any errors occur, the method throws exceptions)
-   */
-  virtual bool createPiNode (
-        Item_t&  result,
-        Item*    parent,
-        ulong    pos,
-        zstring& target,
-        zstring& content,
-        zstring& baseUri) = 0;
-#endif
-
   /**
    * Create a new comment node N and place it as the last child of a given
    * parent node. If no parent is given, N becomes the root (and single node)
@@ -770,27 +646,6 @@
         Item*    parent,
         zstring& content) = 0;
 
-#ifdef USE_POS
-  /**
-   * Create a new comment node N and place it at a given position among the
-   * children of a given parent node. If no parent is given, N becomes the
-   * root (and single node) of a new XML tree.
-   *
-   * @param result  The new node N created by this method
-   * @param parent  The parent P of the new node; may be NULL.
-   * @param pos     The position, among the children of P, that N will occupy.
-   *                If pos == current number of P's children, then
-   *                N is appended to the list of children.
-   * @param content The content of the new node.
-   * @return        Always true (if any errors occur, the method throws exceptions)
-   */
-  virtual bool createCommentNode (
-        Item_t&  result,
-        Item*    parent,
-        ulong    pos,
-        zstring& content) = 0;
-#endif
-
   /**
    * Create a pending updates list.
    */

=== modified file 'test/unit/module2.xq'
--- test/unit/module2.xq	2011-08-18 17:07:50 +0000
+++ test/unit/module2.xq	2011-12-12 17:30:21 +0000
@@ -16,8 +16,14 @@
 
 module namespace mod2 = "http://www.mod2.com/";;
 
+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/dml";;
+
 import module namespace mod3 = "http://www.mod3.com/"; at "file:///${CMAKE_CURRENT_BINARY_DIR}/module3.xq";
 
 declare namespace ann = "http://www.zorba-xquery.com/annotations";;
 
 declare %ann:ordered collection mod2:coll as node()*;
+
+declare index mod2:index
+  on nodes ddl:collection(xs:QName("mod2:coll"))
+  by data(@id) as xs:string;

=== modified file 'test/unit/staticcollectionmanager.cpp'
--- test/unit/staticcollectionmanager.cpp	2011-09-12 22:42:28 +0000
+++ test/unit/staticcollectionmanager.cpp	2011-12-12 17:30:21 +0000
@@ -40,6 +40,7 @@
 
   ItemFactory* lFac = z->getItemFactory();
   Item lCollName2 = lFac->createQName("http://www.mod2.com/";, "coll");
+  Item lIdxName   = lFac->createQName("http://www.mod2.com/";, "index");
   Item lCollName3 = lFac->createQName("http://www.mod3.com/";, "coll");
 
   ItemSequence_t lSeq = lColMgr->declaredCollections();
@@ -56,16 +57,35 @@
     return false;
   }
 
+  int num_idxs = 0;
+  lSeq = lColMgr->declaredIndexes();
+  lIter = lSeq->getIterator();
+  lIter->open();
+  while (lIter->next(lTmp)) {
+    std::cout << "name " << lTmp.getStringValue() << std::endl;
+    ++num_idxs;
+  }
+
+  if (num_idxs != 1) {
+    return false;
+  }
+
   if (!lColMgr->isDeclaredCollection(lCollName2) ||
       !lColMgr->isDeclaredCollection(lCollName3)) {
     return false;
   }
 
+  if (!lColMgr->isDeclaredIndex(lIdxName)) {
+    return false;
+  }
+
   lColMgr->createCollection(lCollName2);
   lColMgr->createCollection(lCollName3);
+  lColMgr->createIndex(lIdxName);
 
   if (!lColMgr->isAvailableCollection(lCollName2) ||
-      !lColMgr->isAvailableCollection(lCollName3)) {
+      !lColMgr->isAvailableCollection(lCollName3) ||
+      !lColMgr->isAvailableIndex(lIdxName)) {
     return false;
   }
 
@@ -82,11 +102,13 @@
     return false;
   }
 
+  lColMgr->deleteIndex(lIdxName);
   lColMgr->deleteCollection(lCollName2);
   lColMgr->deleteCollection(lCollName3);
 
   if (lColMgr->isAvailableCollection(lCollName2) ||
-      lColMgr->isAvailableCollection(lCollName3)) {
+      lColMgr->isAvailableCollection(lCollName3) ||
+      lColMgr->isAvailableIndex(lIdxName)) {
     return false;
   }
 


Follow ups