Exemplo n.º 1
0
 /// <summary>Take the fields of the index and take value from the query</summary>
 /// <param name="ci">The class info involved</param>
 /// <param name="index">The index</param>
 /// <param name="query"></param>
 /// <returns>The key of the index</returns>
 public static NeoDatis.Tool.Wrappers.OdbComparable ComputeKey(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
                                                               ci, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfoIndex index, NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery
                                                               query)
 {
     string[] attributesNames = ci.GetAttributeNames(index.GetAttributeIds());
     NeoDatis.Odb.Core.Layers.Layer2.Meta.AttributeValuesMap values = query.GetCriteria
                                                                          ().GetValues();
     return(BuildIndexKey(index.GetName(), values, attributesNames));
 }
 /// <summary>Used to rebuild an index</summary>
 public virtual void RebuildIndex(string className, string indexName, bool verbose
                                  )
 {
     if (verbose)
     {
         NeoDatis.Tool.DLogger.Info("Rebuilding index " + indexName + " on class " + className
                                    );
     }
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo = GetMetaModel().GetClassInfo
                                                                    (className, true);
     if (!classInfo.HasIndex(indexName))
     {
         throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.IndexDoesNotExist
                                                    .AddParameter(indexName).AddParameter(className));
     }
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfoIndex cii = classInfo.GetIndexWithName
                                                                   (indexName);
     DeleteIndex(className, indexName, verbose);
     AddIndexOn(className, indexName, classInfo.GetAttributeNames(cii.GetAttributeIds(
                                                                      )), verbose, !cii.IsUnique());
 }