#ifndef	__MODODBC_H__
#define	__MODODBC_H__

#ifdef WIN32
# include <windows.h>
# include <stdio.h>
#else
# include <stdlib.h>
# include <string.h>
# include <stdio.h>
# include <unistd.h>
# include <ctype.h>
# include <iconv.h>
#endif

#include "../mdamodule.h"
#include <sql.h>
#include <sqlext.h>

enum sqlserver {
	MySQL,
	MSSQL,
	PostgreSQL,
	OTHER
};

struct modctx {
	SQLHDBC hdbc; /* Connection Handle */
	SQLHSTMT hstmt; /* Statement Handle */
	mod_config *cfg;
	mod_result *result_head;
	mod_result *result_tail;
	SQLCHAR *odbcerrstr;
	char *errorstring;
	char *string;
	char *string2;
	size_t stringlen;
	size_t string2len;
#ifndef WIN32
	iconv_t iconv_cd;
#endif
	SQLSMALLINT odbcerrstr_len;
	enum sqlserver sqlserver;
	int sqlserver_major;
	int sqlserver_minor;
	int sqlserver_patch;
	int nativeerror;
	uint8_t status;
};

#endif

