23 #include "wxgis/datasource/datasource.h"
25 #ifdef wxGIS_USE_POSTGRES
28 #include "wxgis/datasource/featuredataset.h"
29 #include "wxgis/datasource/filter.h"
31 class OGRPGDataSource :
public OGRDataSource
50 int nSoftTransactionLevel;
54 int DeleteLayer(
int iLayer);
63 OGRSpatialReference **papoSRS;
65 void *poLayerInCopyMode;
67 CPLString osCurrentSchema;
72 PGver sPostgreSQLVersion;
73 PGver sPostGISVersion;
76 int bBinaryTimeFormatIsInt8;
77 int bUseEscapeStringSyntax;
80 PGconn *GetPGConn() {
return hPGConn; }
89 class WXDLLIMPEXP_GIS_DS wxGISPostgresDataSource :
92 DECLARE_CLASS(wxGISPostgresDataSource)
94 wxGISPostgresDataSource(const wxString &sName, const wxString &sPass, const wxString &sPort = wxT("5432"), const wxString &sAddres = wxT("localhost"), const wxString &sDBName = wxT("postgres"), const wxString &sConnectTimeout = wxT("30"),
bool bIsBinaryCursor = false);
95 wxGISPostgresDataSource(const CPLString &szPath);
96 virtual ~wxGISPostgresDataSource(
void);
99 virtual
void Close(
void);
100 virtual
size_t GetSubsetsCount(
void) const;
102 virtual
wxGISDataset* GetSubset(const wxString &sTableName);
103 virtual wxString GetName(
void) const;
104 virtual
bool Open(
bool bUpdate = true,
bool bShared = true);
106 bool ExecuteSQL(const wxString &sStatement);
107 bool CreateDatabase(const wxString &sDBName, const wxString &sTemplate = wxT("template_postgis"), const wxString &sOwner = wxT("postgres"), const wxString &sEncoding = wxT("UTF8"));
108 wxGISDataset* ExecuteSQL2(const wxString &sStatement, const wxString &sDialect = wxT("OGRSQL"));
113 bool CreateSchema(const wxString &sSchemaName);
114 bool DeleteSchema(const wxString &sSchemaName);
115 bool RenameSchema(const wxString &sSchemaName, const wxString &sSchemaNewName);
116 bool RenameTable(const wxString &sSchemaName, const wxString &sTableName, const wxString &sTableNewName, const wxString &sPkIdxName = wxEmptyString, const wxString &sGeomIdxName = wxEmptyString);
117 bool MoveTable(const wxString &sTableName, const wxString &sSchemaName, const wxString &sSchemaNewName);
119 virtual
bool Rename(const wxString &sNewName);
120 virtual
bool Copy(const CPLString &szDestPath,
ITrackCancel* const pTrackCancel = NULL);
121 virtual
bool Move(const CPLString &szDestPath,
ITrackCancel* const pTrackCancel = NULL);
122 virtual
void Cache(
ITrackCancel* const pTrackCancel = NULL);
123 virtual
char **GetFileList();
125 virtual OGRDataSource* const GetDataSourceRef(
void)
const {
return m_poDS; };
126 virtual wxFontEncoding GetEncoding()
const {
return m_Encoding; };
127 static wxString NormalizeTableName(
const wxString &sSrcName);
128 virtual void ReadConnectionFile();
130 wxGISDataset* GetDatasetFromOGRLayer(
const CPLString &sPath, OGRLayer* poLayer);
132 OGRDataSource *m_poDS;
133 OGRDataSource *m_poDS4SQL;
134 wxString m_sName, m_sPass, m_sPort, m_sAddres, m_sDBName, m_sConnectTimeout;
135 bool m_bIsBinaryCursor, m_bPathPresent;
136 wxFontEncoding m_Encoding;
145 class WXDLLIMPEXP_GIS_DS wxGISPostgresFeatureDataset :
148 DECLARE_CLASS(wxGISPostgresFeatureDataset)
150 wxGISPostgresFeatureDataset(const CPLString &sPath, OGRLayer* poLayer = NULL, OGRDataSource* poDS = NULL);
151 virtual ~wxGISPostgresFeatureDataset(
void);
153 virtual
bool CanDelete(
void);
154 virtual
bool Delete(
ITrackCancel* const pTrackCancel = NULL);
156 CPLString m_sLayerName;
165 class WXDLLIMPEXP_GIS_DS wxGISPostgresTable :
168 DECLARE_CLASS(wxGISPostgresTable)
170 wxGISPostgresTable(const CPLString &sPath, OGRLayer* poLayer = NULL, OGRDataSource* poDS = NULL);
171 virtual ~wxGISPostgresTable(
void);
173 virtual
bool CanDelete(
void);
174 virtual
bool Delete(
ITrackCancel* const pTrackCancel = NULL);
176 CPLString m_sLayerName;
179 #endif //wxGIS_USE_POSTGRES
A TrackCancel interface class.
Definition: core.h:144
Definition: featuredataset.h:32