Difference between revisions of "Dbicache()"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 11: Line 11:
  
 
<input parameter>
 
<input parameter>
int size; /* Index cache size in blocks */
+
int size; /* Index cache size in blocks */
  
 
<output parameters>
 
<output parameters>
Line 36: Line 36:
 
<code lang="c">
 
<code lang="c">
 
#include "dbl.h"
 
#include "dbl.h"
int rc; /* Return code */
+
int rc; /* Return code */
  
 
rc = dbicache(100);
 
rc = dbicache(100);
Line 42: Line 42:
 
rc = dbicreat("person.ndx", "SSN", 10, 'C');
 
rc = dbicreat("person.ndx", "SSN", 10, 'C');
 
if (rc = = SUCCESS){
 
if (rc = = SUCCESS){
printf("index person created n");
+
printf("index person created \n");
 
} else {
 
} else {
printf("error number %d n, rc);
+
printf("error number %d \n, rc);
 
exit (1);
 
exit (1);
 
}
 
}
 
} else {
 
} else {
printf("error number %d n, rc);
+
printf("error number %d \n, rc);
 
exit (1);
 
exit (1);
 
}
 
}

Revision as of 11:03, 1 May 2009

PURPOSE

specify size of the index cache


SYNOPSIS

#include "dbl.h"
 
	int	dbicache(size)
 
	<input parameter>
	int	size;		/* Index cache size in blocks */
 
	<output parameters>
	none


RETURN VALUE

The dbicache() 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 dbicache() function is used to specify the size of the index cache in 512 byte disk blocks. Index caching improves performance of index operations.


EXAMPLE

The following example sets the icache (index cache) to 100 then creates an .NDX file "person.ndx" whose key expression, length and type are "SSN", 10 and 'C' respectively. "SSN" is a field name of the associated .DBF file.


#include "dbl.h"
	int	rc;	/* Return code */
 
	rc = dbicache(100);
	if (rc = = SUCCESS){
		rc = dbicreat("person.ndx", "SSN", 10, 'C');
		if (rc = = SUCCESS){
			printf("index person created \n");
		} else {
			printf("error number %d \n, rc);
			exit (1);
		}
	} else {
		printf("error number %d \n, rc);
		exit (1);
	}


SEE ALSO

dbdcache(), dbiclose(), dbicreat(), dbiopen()