File: speed12.c

package info (click to toggle)
whitedb 0.7.3%2Bgit200711-1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 3,340 kB
  • sloc: ansic: 33,250; javascript: 3,299; python: 790; lex: 359; java: 277; makefile: 192; sh: 164; yacc: 138; sed: 41
file content (26 lines) | stat: -rw-r--r-- 625 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* 
create an index for the field 3 in the previously built
database of 10 million records.

real	0m6.540s
user	0m6.436s
sys	0m0.098s

*/

#include <whitedb/dbapi.h>
#include <whitedb/indexapi.h> // must additionally include indexapi.h
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv) {
  void *db, *rec;
  char *name="10";
  int tmp;  
  db = wg_attach_database(name, 1000000000);
  if (!db) { printf("db creation failed \n"); exit(0); }
  tmp=wg_create_index(db,3,WG_INDEX_TYPE_TTREE,NULL,0);
  if (tmp) printf("Index creation failed\n");
  else printf("Index creation succeeded\n");  
  return 0;
}