Initial revision
[ftsbench.git] / ftsbench.h
1 #ifndef __FTSBENCH_H__
2 #define __FTSBENCH_H__
3
4 #include <pthread.h>
5
6 /* utils */
7 typedef struct {
8         char*   str;
9         int             strlen;
10         int             length;
11 } StringBuf;
12
13 void sb_add(StringBuf *b, char *s, int length);
14
15 /* rand.c */
16 long rnd();
17 void srnd(long seed);
18
19 /* finngan.c */
20 void generate_doc(StringBuf *b);
21 char** generate_querywords();
22 void    finnegan_init(char *lex_file, char *doc_file);
23
24 typedef struct ftsDB {
25         void                    (*execQuery)(struct ftsDB*, char **, int); 
26         void                    (*startCreateScheme)(struct ftsDB*, int);
27         void                    (*finishCreateScheme)(struct ftsDB*);
28         void                    (*InsertRow)(struct ftsDB*, int, char*);
29
30         /* stats */
31         pthread_mutex_t nqueryMutex;
32         int                     nquery;
33
34         /* follow db specific fields */
35 } ftsDB;
36
37 #ifdef WITH_PGSQL
38 ftsDB* PGInit(char * connstr);
39 #else
40 #define PGInit  NULL
41 #endif
42
43 #ifdef WITH_MYSQL
44 ftsDB* MYInit(char * connstr);
45 #else
46 #define MYInit  NULL
47 #endif
48
49 #define FLG_GIST        (0x00000001)
50 #define FLG_GIN         (0x00000002)
51 #define FLG_FUNC        (0x00000004)
52 #define FLG_AND         (0x00000008)
53 #define FLG_OR          (0x00000010)
54 #define FLG_SORT        (0x00000020)
55
56 #endif