/***************************************************************************
                   Insert Class Header ( InsertData.h )
                -----------------------------------------

	begin      : 2013/07/09
	copyright  : (C) 2013 Solbox Inc.
	author     : Development 1 Team
					- 2013/07/09 - 1st dadamin
	email      : dev1@solbox.com
	version    : 3.2.0

	CopyRight(C) 2005 Solbox Inc. All Rights reserved.
	Redistribution and use in source and binary forms, with or with out
	modification, are not permitted in outside of Solbox Inc.
***************************************************************************/
#ifndef __INSERT_H__
#define __INSERT_H__

class CInsert
{
public:
	CInsert() {};
	virtual ~CInsert() {};

	virtual bool Insert(map <string, string > &svc, map <string, string > &val, session & sql) = 0;

protected:
	bool run(string strsql, session & sql);
	void timeToString(time_t stamp, char *buf);
};

// Postgresql
class CInsertPostgresqlAccess : public CInsert
{
public:
	CInsertPostgresqlAccess() {};
	virtual ~CInsertPostgresqlAccess() {};

	virtual bool Insert(map <string, string > &svc, map <string, string > &val, session & sql);
};

class CInsertPostgresqlStorage : public CInsert
{
public:
	CInsertPostgresqlStorage() {};
	virtual ~CInsertPostgresqlStorage() {};

	virtual bool Insert(map <string, string > &svc, map <string, string > &val, session & sql);	
};

class CInsertPostgresqlNetwork : public CInsert
{
public:
	CInsertPostgresqlNetwork() {};
	virtual ~CInsertPostgresqlNetwork() {};

	virtual bool Insert(map <string, string > &svc, map <string, string > &val, session & sql);
};

class CInsertPostgresqlTransfer : public CInsert
{
public:
	CInsertPostgresqlTransfer() {};
	virtual ~CInsertPostgresqlTransfer() {};

	virtual bool Insert(map <string, string > &svc, map <string, string > &val, session & sql);
};

// Abstract Factory returning a Insert
class CInsertFactory 
{
public:
	CInsert* Create(string dbtype, string dtype);

	inline string GetDBType() { return m_dbtype; }
	inline string GetUsedType() { return m_usedtype; }

private:
	string m_dbtype;
	string m_usedtype;
};
#endif // __INSERT_H__
