//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
// RCS-ID:      $Id:  $
// Copyright (C) 2002 - 2009, The pgAdmin Development Team
// This software is released under the Artistic Licence
//
// pgPartition.h Greenplum Partitioned Table Partition
//
//////////////////////////////////////////////////////////////////////////

#ifndef PGPARTITION_H
#define PGPARTITION_H

#include "pgSchema.h"
#include "pgTable.h"

 

class pgPartitionFactory : public pgTableObjFactory
{
public:
    pgPartitionFactory();
    virtual dlgProperty *CreateDialog(frmMain *frame, pgObject *node, pgObject *parent) { return 0; };
    virtual pgObject *CreateObjects(pgCollection *obj, ctlTree *browser, const wxString &restr=wxEmptyString);
    virtual pgCollection *CreateCollection(pgObject *obj);
};

extern pgPartitionFactory partitionFactory;

class pgPartition : public pgTable
{
public:
    pgPartition(pgSchema *newSchema, const wxString& newName = wxT(""));
    ~pgPartition();
    wxString GetSql(ctlTree *browser);
};


class pgPartitionObject : public pgTableObject
{
public:
    pgPartitionObject(pgPartition *newTable, pgaFactory &factory, const wxString& newName = wxT(""))
        : pgTableObject(newTable, factory, newName) { };
    virtual pgTable *GetTable() const { return table; }
    OID GetTableOid() const {return table->GetOid(); }
    wxString GetTableOidStr() const {return NumToStr(table->GetOid()) + wxT("::oid"); }
};


class pgPartitionCollection : public pgTableCollection
{
public:
    pgPartitionCollection(pgaFactory *factory, pgPartition *_table);
};


class pgPartitionObjCollection : public pgTableObjCollection
{
public:
    pgPartitionObjCollection(pgaFactory *factory, pgPartition *_table)
        : pgTableObjCollection(factory, (pgTable *)_table ) { };
    virtual pgTable *GetTable() const { return table; }
};



#endif
