#ident "$URL: svn://elmer/devel/SVN/SDDAS/trunk/libdB/ReIndex.c $ %D% SwRI" #include "dbf.h" /***************************************************************************** | >FILE: ReIndex.c | | | | DESCRIPTION | | This routine preforms a reindex of the current index array associated | | with the structure D. | | | | ROUTINE | | int ReIndex(D) | | | | ARGUMENTS | | dbfRecord *D pointer to database structure | | | | NECESSARY SUBPROGRAMS | | do_index() index routine | | | | EXTERNAL VARIABLES | | None | | | | INTERNAL VARIABLES | | int size size in bytes of the field to index | | | | SUBSYSTEM | | Generic Database | | | *****************************************************************************/ dbRet_t ReIndex(SDDAS_INT dbf, SDDAS_INT ndx) { dbfRecord_t *D; ndxRecord_t *N; SDDAS_INT size; if ((D = GetOldDbfHandle(dbf)) == NULL) return FAILURE; if ((N = GetOldNdxHandle(dbf, ndx)) == NULL) return FAILURE; if (N->Index == NULL) return SUCCESS; size = N->KeyLen + DB_ALIGN(N->KeyLen) + sizeof (SDDAS_INT); db_Qsort(N->Index, D->NumRecs, size, N->KeyLen); N->iStatus = Updated; return SUCCESS; }