/*
 * db.h
 *
 * Copyright (C) 2011		OpenTech Labs
 *				Andrew Clayton <andrew@opentechlabs.co.uk>
 * Released under the GNU General Public License (GPL) version 3.
 * See COPYING
 */

#ifndef _DB_H_
#define _DB_H_

/* For Tokyocabinet (user sessions) */
#include <tcutil.h>
#include <tctdb.h>
#include <stdbool.h>
#include <stdint.h>
#include <libgen.h>

/* MySQL */
#include <my_global.h>
#include <mysql.h>

MYSQL *db_conn(void);

#endif /* _DB_H_ */

/*
 * db.h
 *
 * Copyright (C) 2011		OpenTech Labs
 *				Andrew Clayton <andrew@opentechlabs.co.uk>
 * Released under the GNU General Public License (GPL) version 3.
 * See COPYING
 */

#ifndef _DB_H_
#define _DB_H_

/* For Tokyocabinet (user sessions) */
#include <tcutil.h>
#include <tctdb.h>
#include <stdbool.h>
#include <stdint.h>
#include <libgen.h>

/* MySQL */

/*
 * The FCGI printf function seemed to be causing a conflict here, under F16
 * with GCC 4.6.2
 *
 * Just undef printf for the my_global stuff and then define it back again.
 */
#undef printf
#include <my_global.h>
#define printf FCGI_printf

#include <mysql.h>

MYSQL *db_conn(void);

#endif /* _DB_H_ */

Fix compiler warnings under F16/GCC 4.6.2
Fix compiler warnings under F16/GCC 4.6.2

When compiling receiptomatic under Fedora 16 with GCC 4.6.2 we were
getting the following warnings...

gcc -Wall -std=c99 -O2 -g -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -fPIE -c receiptomatic-www.c
-D_RECEIPTOMATIC_WWW_ -I../../libctemplate `pkg-config --cflags
glib-2.0` `pkg-config --cflags gmime-2.0` `mysql_config --cflags`
In file included from /usr/include/mysql/my_global.h:1039:0,
                 from db.h:21,
                 from common.h:31,
                 from receiptomatic-www.c:22:
/usr/include/mysql/my_dbug.h:59:3: warning: ‘FCGI_printf’ is an
unrecognized format function type [-Wformat]

This seemed to be a conflict between the FCGI_printf definition and the
use of 'ATTRIBUTE_FORMAT(printf, 1, 2)' in my_global.h

The workaround seems to be to undef printf before including my_global.h
and then defining it back again afterwards.

Signed-off-by: Andrew Clayton <02e0a999c50b1f88df7a8f5a04e1b76b35ea6a88@opentechlabs.co.uk>
