Example #1
0
        // update the root page of a table or an index
        // if succeeded, return true. Vice versa
        public bool TryUpdateSchemaRecord(string name, int rootPage)
        {
            //load both table and index
            Catalog_table a = new Catalog_table(_databaseName);
            Catalog_index b = new Catalog_index(_databaseName);

            //if it's the name of a table
            if (a.If_in(name))
            {
                return(a.Update(name, rootPage));
            }

            //if it's the name of an index
            else if (b.If_in(name))
            {
                return(b.Update(name, rootPage));
            }

            //if it's neither index nor table
            else
            {
                return(false);
            }
        }