#ifndef __MOD_MSSQL_H
#define __MOD_MSSQL_H

#if _MSC_VER > 1000
#pragma once
#endif
 // _MSC_VER > 1000

#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers

#import <msado15.dll> no_namespace rename("EOF", "EndOfFile") \
	exclude("_Connection", "_Command", "_Parameter", "_Recordset") \
	rename("_Connection_Deprecated", "_Connection") \
	rename("_Command_Deprecated", "_Command") \
	rename("_Parameter_Deprecated", "_Parameter") \
	rename("_Recordset_Deprecated", "_Recordset")

#include <ole2.h>
#include <oledb.h>
#include <sqloledb.h> 
#include <objbase.h>
#include <stdio.h>
#include "..\mdamodule.h"

#define uint64_t	unsigned __int64
#define	uint32_t	unsigned __int32
#define	uint8_t		unsigned	char

/* Since this struct is now created using new() we must
 * explicitly initialise new members in mod_create() !!! */
struct mod_t {
	char *lasterrormessage;
	char *string;
	wchar_t *query;
	mod_result *mod_result_head;
	mod_result *mod_result_tail;
	mod_config *cfg;
	char *connectionstring;
	size_t stringlen;
	int querylen;
	int lasterrno;
	uint8_t status;
	_ConnectionPtr pConnection;
	
};

int mod_executesql (void *handle, char *query);

struct providers_t {
	HKEY key;
	wchar_t *subkey;
	char *provider;
	int installed;
};

#endif
