Example #1
0
        /**
         * add index by the name of keys
         */
        public void addIndex(string name, List <string> keys)
        {
            if (null == this.getIndexbyName(name))
            {
                MysqlIndexType newIndex = new MysqlIndexType(name);

                for (int i = 0; i < keys.Count; i++)
                {
                    MysqlCreateStruct getStruct = this.getStructByName(keys[i]);
                    if (getStruct != null)
                    {
                        newIndex.addRefererStruct(getStruct);
                    }
                    else
                    {
                        throw new Exception("key " + keys[i] + " not exists");
                    }

                    this.crIndizies.Add(newIndex);
                }
            }
            else
            {
                throw new Exception("Index with name " + name + " allready exists");
            }
        }
Example #2
0
        public void addFieldToIndex(string name, string fieldName)
        {
            MysqlIndexType editIndex = this.getIndexbyName(name);

            if (null != editIndex)
            {
                MysqlCreateStruct getStruct = this.getStructByName(fieldName);
                if (getStruct != null)
                {
                    editIndex.addRefererStruct(getStruct);
                }
                else
                {
                    throw new Exception("key " + fieldName + " not exists");
                }
            }
        }