static pthread_mutex_t mutexFinish = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t mutexWordGen = PTHREAD_MUTEX_INITIALIZER;
+static void
+printQueryWords(StringBuf *b, char **words) {
+ char **wptr = words, *ptr;
+
+ b->strlen = 0;
+ while(*wptr) {
+ if ( wptr != words )
+ sb_add(b, " ", 1);
+
+ ptr = *wptr;
+ while( *ptr ) {
+ if ( *ptr == '\'' )
+ sb_add( b, "'", 1 );
+ sb_add( b, ptr, 1 );
+ ptr++;
+ }
+
+ wptr++;
+ }
+}
+
/*
* main test function, executed in thread
*/
char **words;
struct timeval begin;
double elapsed;
+ StringBuf b = {NULL,0,0};
for(i=0;i<benchCount;i++) {
/*
if ( rowMode ) {
elapsed = elapsedtime(&begin);
- printf("INSERT INTO fb_row (id, f_and, f_or, nclients, nres, elapsed) VALUES (%d, '%c', '%c', %d, %d, %g);\n",
+ printQueryWords(&b, words);
+
+ printf("INSERT INTO fb_row (id, f_and, f_or, nclients, query, nres, elapsed) VALUES (%d, '%c', '%c', %d, '%s', %d, %g);\n",
Id,
( benchFlags & FLG_AND ) ? 't' : 'f',
( benchFlags & FLG_OR ) ? 't' : 'f',
nClients,
+ b.str,
db->nres - nres,
elapsed
);
" f_and boolean NOT NULL,\n"
" f_or boolean NOT NULL,\n"
" nclients integer NOT NULL,\n"
+ " query text NOT NULL,\n"
" nres integer NOT NULL,\n"
" elapsed double precision NOT NULL\n"
");\n",