//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2011, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// frmPasteObject.h - Copy/Paste object functions
//
//////////////////////////////////////////////////////////////////////////

#ifndef FRMPASTEOBJECT_H
#define	FRMPASTEOBJECT_H

#include <wx/wx.h>

#include "pgAdmin3.h"
#include "frm/frmMain.h"
#include "schema/pgObject.h"
#include "schema/pgSchema.h"
#include "schema/pgTable.h"

class frmPasteObject
{
public:
	frmPasteObject(frmMain *form, pgObject *sourceobj, pgObject *targetobj);
	void process();
	virtual ~frmPasteObject();
private:
	wxArrayString getSchemaTables(pgSchema *srcschema);
	bool tableExists(pgSchema *srcschema, wxString quotedtablename);
	void GetLastResultError(pgConn *conn, PGresult *res, const wxString &msg = wxT(""));
	void handleCopyOut(pgConn *conn, wxFile & copystream);
	void handleCopyIn(pgConn *conn, wxFile & copystream, bool isbinary);
	void do_copy(pgConn *conn, wxString & sql, wxFile & copystream);
	wxArrayString stringToArray(wxString & src, wxString pattern);
	void copyTable(ctlTree *browser, pgSchema *srcschema, pgSchema *targetschema, pgTable *table1);

	frmMain  *mainform;
	pgObject *sourceobj;
	pgObject *targetobj;
	pgError  lastResultError;
	wxString pastemsg;
};

#endif	/* FRMPASTEOBJECT_H */
