/////////////////////////////////////////////////////////////////////////////
// Name:        odbctools.h
// Purpose:     Crude odbc manipulation for wxWindows on win32 (mingw)
// Author:      Peter Weston (Peter.Weston AT holistech.co.uk)
// Modified by: 
// Created:     26-Apr-2002
// RCS-ID:      
// Copyright:   (c) Copyright 2002-2003 Peter Weston
// Licence:     wxWindows Library Licence, Version 3
/////////////////////////////////////////////////////////////////////////////
// V0.2 changes - swapped wxDllLoader for wxDynamicLibrary 
//                (wxDllLoader unavailable in wxWindows V2.4.1 by default)
// version: V0.2

#ifndef _ODBCTOOLS_H_
#define _ODBCTOOLS_H_

#ifndef WX_PRECOMP
    #include "wx/wx.h"
#endif
#include "wx/dynlib.h"

#define ODBCDRIVER "Microsoft Access Driver (*.mdb)"

class odbcTools {
// logs errors with wxLogError
public:
	odbcTools();
	odbcTools::~odbcTools();
	
	bool CreateAccessFile(const wxString filename);
	// creates an empty JET (.mdb) database file
	// deletes any existing file of the same name before creating new file
	// with default settings (latest installed version of jet, etc...)
	
	bool CreateDSN(const wxString dsn, const wxString filename);
	// dsn= Data source name - not sanity checked
	// filename= filename to be referenced by the dsn
	// will replace any existing DSN with the same name
private:
	typedef int (*SQLConfigDataSourceTYPE)(HWND, WORD, LPCSTR, LPCSTR);
	SQLConfigDataSourceTYPE SQLConfigDataSource;
	wxDynamicLibrary odbccp32lib;
	bool DoConfigCommand(const wxString command);
	char *getCmd(const wxString text);
};

#endif

