Do() статический приватный Метод

static private Do ( Expr expr ) : void
expr Expr
Результат void
Пример #1
0
 /// <summary>
 /// Optimizes database structures and updates indexes. The internal
 /// database structures are completely rebuilt which often leads to
 /// a reduction of the total database size.
 /// </summary>
 public void OptimizeAll()
 {
     if (_data == null)
     {
         throw new ObjectDisposedException("Database");
     }
     Updates.Do(new DBOptimize(Data, Context, true, null));
 }
Пример #2
0
 private void Add(string path, NodeCache nodeCache)
 {
     if (_data == null)
     {
         throw new ObjectDisposedException("Database");
     }
     if (nodeCache != null)
     {
         FDoc doc = new FDoc(nodeCache, path.Token());
         Updates.Do(new DBAdd(Data, null, doc, path, Context));
     }
 }
Пример #3
0
        //Many of the following are ported from FNDb.java to eliminate the overhead of the XQuery function evaluation

        /// <summary>
        /// Deletes the document at the specified path.
        /// </summary>
        /// <param name="path">The path of the document to delete.</param>
        public void Delete(string path)
        {
            if (_data == null)
            {
                throw new ObjectDisposedException("Database");
            }
            IntList docs = Data.resources.docs(path);

            using (new Updates())
            {
                for (int i = docs.size() - 1; i >= 0; i--)
                {
                    Updates.Do(new DeleteNode(docs.get(i), Data, null));
                }
            }
        }
Пример #4
0
        private void Replace(string path, NodeCache nodeCache)
        {
            if (_data == null)
            {
                throw new ObjectDisposedException("Database");
            }
            int pre = Data.resources.doc(path);

            if (pre != -1)
            {
                if (Data.resources.docs(path).size() != 1)
                {
                    throw new ArgumentException("Simple document expected as replacement target");
                }
                using (new Updates())
                {
                    Updates.Do(new DeleteNode(pre, Data, null));
                    Add(path, nodeCache);
                }
            }
        }
Пример #5
0
        /// <summary>
        /// Renames the document at the specified path.
        /// </summary>
        /// <param name="path">The path of the document to rename.</param>
        /// <param name="newName">The new name of the document.</param>
        public void Rename(string path, string newName)
        {
            if (_data == null)
            {
                throw new ObjectDisposedException("Database");
            }
            IntList docs = Data.resources.docs(path);

            using (new Updates())
            {
                for (int i = 0, s = docs.size(); i < s; i++)
                {
                    int    pre    = docs.get(i);
                    string target = org.basex.core.cmd.Rename.target(Data, pre, path, newName);
                    if (!String.IsNullOrEmpty(target))
                    {
                        Updates.Do(new ReplaceValue(pre, Data, null, target.Token()));
                    }
                }
            }
        }