/////////////////////////////////////////////////////////////////////////////
// Name:        dbserver.h
// Purpose:     Database Server
// Author:      Daniel Horak
// Modified by:
// RCS-ID:      $Id: dbserver.h,v 1.2 2003/12/21 22:04:34 horakdan Exp $
// Copyright:   (c) Daniel Horak
// Licence:     GPL
/////////////////////////////////////////////////////////////////////////////

#ifndef __DBSERVER_H
#define __DBSERVER_H

#ifdef HAVE_XSLT_SUPPORT
#include <libxml/xmlmemory.h>
#include <libxml/debugXML.h>
#include <libxml/HTMLtree.h>
#include <libxml/xmlIO.h>
#include <libxml/DOCBparser.h>
#include <libxml/xinclude.h>
#include <libxml/catalog.h>
#include <libxslt/xslt.h>
#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
#endif

// Types of servers
enum DBServerType {
	DBServerTypeGeneric,
	DBServerTypePostgreSQL,
	DBServerTypeOracle,
	DBServerTypeDB2,
	DBServerTypeMySQL,
	DBServerTypeInterBase
};

class DataDesignerView;

/*
 * --------------------------------------------------------------------------
 * Generic Database Server
 */
class DBServer : public wxObject
{
public:
	DBServer(DBServerType type, const wxString& name, const wxString& version = wxEmptyString,
		const wxString& xslt = wxEmptyString);
	virtual ~DBServer();
	
	wxString GetName()	{ return m_name; }
	wxString GetVersion()	{ return m_version; }
	wxString GetFullName()	{ return m_name + " " + m_version; }
	
	virtual wxString*	GetTypes()	{ return NULL; }
	virtual int		GetTypesCount()	{ return 0; }

	virtual wxString*	GetLanguages()	{ return NULL; }
	virtual int		GetLanguagesCount()	{ return 0; }
	
	virtual bool		ExportDDL(DataDesignerView *view);
#ifdef HAVE_XSLT_SUPPORT
	bool			Transform(DataDesignerView *view, xsltStylesheetPtr stylesheet);
	xsltStylesheetPtr	ParseStyle(wxString& xslt);
#endif
	
private:
	DBServerType	m_type;
	wxString	m_name;
	wxString	m_version;
	wxString	m_xslt;
#ifdef HAVE_XSLT_SUPPORT
	xsltStylesheetPtr	m_stylesheet;
#endif
};

void InitServers();
void DestroyServers();

int GetServerCount();
wxString *GetServerNames();
DBServer *GetServerByName(const wxString& name);

#endif // __DBSERVER_H


syntax highlighted by Code2HTML, v. 0.9.1