Archived
1
0
Fork 0

Added output test for mysql

This commit is contained in:
Fredric N 2010-09-20 23:06:57 +02:00 committed by Henrik Hautakoski
parent e93422ecef
commit 131a8b9501
4 changed files with 55 additions and 17 deletions

View file

@ -1,4 +1,4 @@
/* arch/mysql.c - Mysql implementation
/* output/mysql.c - Mysql output-driver
*
* Copyright (C) 2010 Fredric Nilsson <fredric@fiktivkod.org>
*
@ -20,9 +20,6 @@
#include "../common/xalloc.h"
#include "../notify/event.h"
#define STRSZ(s) (sizeof(char) * strlen(s))
typedef struct {
char *host;
int port;

View file

@ -63,7 +63,13 @@ indexer :
t_indexer.c -o test_indexer
mysql :
$(CC) -D DB_DEBUG $(CFLAGS) $(LDFLAGS) ../src/arch/mysql.c t_mysql.c -o test_mysql
$(CC) -D DB_DEBUG $(CFLAGS) $(LDFLAGS) \
../src/output/mysql.c \
../src/common/die.c \
../src/common/xalloc.c \
../src/ini/iniparser.c \
../src/ini/dictionary.c \
t_mysql.c -o test_mysql
queue :
$(CC) $(CFLAGS) ../src/notify/queue.c t_queue.c -o test_queue

9
test/config.ini Normal file
View file

@ -0,0 +1,9 @@
[general]
test = mytest ;
[mysql]
host = localhost ;
username = user ;
password = pw ;
database = development ;
table = filesystem ;

View file

@ -1,20 +1,46 @@
#include <stdio.h>
#include "../src/arch/db.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "../src/output/output.h"
#include "../src/ini/iniparser.h"
#include "../src/notify/event.h"
int main(int argc, char *argv[]) {
printf("Run!\n");
arch_db_init("localhost", "warez", "elebobo", "filesystem", "filesystem");
sleep(10);
arch_db_insert("/this/is/my/path/to/", "myfile", 0);
arch_db_delete("/this/is/my/path/to/", "myfile");
arch_db_close();
printf("Here 1\n");
dictionary *config = iniparser_load("config.ini");
printf("Here 2\n");
notify_event ev;
printf("Here 3\n");
ev.path = "/home/kalle/bilder";
ev.filename = "kalle.jpg";
ev.type = NOTIFY_CREATE;
printf("Here 4\n");
output_init(config);
printf("Here 5\n");
int r = output_process(&ev);
printf("Here 6\n");
if (r != 0) {
printf("Error:\n");
printf(output_error(r));
}
printf("Here 7\n");
output_exit();
printf("Here 8\n");
return 0;
}
}