Dbxdroptag()
From Recital Documentation Wiki
PURPOSE
drop the specified tag from the tagged index file
SYNOPSIS
#include "dbl.h" int dbxdroptag(dbx, tagname) <input parameters> char *dbx; /* Tagged index file descriptor */ char *tagname; /* Address of a buffer containing the name of the tag to be dropped */ <output parameters> none
RETURN VALUE
The dbxdroptag() function returns 0 for success, or < 0 if an error occurs. See the section on return code values for a detailed list of return codes.
DESCRIPTION
The dbxdroptag() function is used to drop tag indexes from a specified tagged index file, .DBX. If the dropped tag is the last tag in the file then the .DBX file is removed, as there must be at least one tag in the file.
EXAMPLE
The following example creates a tag on the FLAG field for the shipwreck.dbf table, then drops the tag.
#include <stdio.h> #include "dbl.h" /* Recital/Library include file */ #include "dblproto.h" /* Recital/Library prototype file */ static dBFIELD fields[6] = { "VESSEL", 'C', 18, 0, 0, "LAT", 'N', 4, 1, 0, "LONG", 'N', 4, 1, 0, "AMOUNT", 'N', 10, 0, 0, "DATE", 'D', 8, 0, 0, "FLAG", 'C', 9, 0, 0 }; static void errorproc( char *func, char *str, int rc); main() { int rc; /* Return Code for error handling */ char *dbf; /* File descriptor for table */ char *dbx; /* File descriptor for tagged index */ rc = dbdcache(100); errorproc("dbdcache()","table cache specified.", rc); rc = dbicache(100); errorproc("dbicache()", "index cache specified.", rc); rc = dbfilemode(0,0); rc = dbopen("shipwreck.dbf", &dbf); errorproc("dbopen()","table opened in exclusive mode.", rc); rc = dbxcreate( dbf, fields[5].fieldnm, /* "FLAG", */ &dbx, fields[5].fieldnm, /* "FLAG", */ NULL, 0, 0); errorproc("dbxcreate()","tag created", rc); rc = dbxdroptag(dbx, fields[5].fieldnm); errorproc("dbxdroptag()","tagged index 'FLAG' dropped.", rc); rc = dbxclose(dbx); errorproc("dbxclose()", "tagged index closed.", rc); rc = dbclose(dbf); errorproc("dbclose()", "table closed.", rc); exit(0); } static void errorproc(func, str, rc) char *func; char *str; int rc; { if ( rc != SUCCESS ) { printf("\n Error performing function %s -> %d\n", func, rc); exit(1); } printf("Function: \t%s, \t%s - Ok\n", func, str); return; }