dbmanager: fix #5812,

move PG informations to postgis/info_model.py
This commit is contained in:
Giuseppe Sucameli 2012-11-28 22:25:51 +01:00
parent 563cce9111
commit 3542b0897d
4 changed files with 33 additions and 35 deletions

View File

@ -56,23 +56,14 @@ class DatabaseInfo:
tbl = [
("Library:", info[0]),
("Scripts:", info[1]),
("GEOS:", info[3]),
("Proj:", info[4]),
("Use stats:", info[5])
("GEOS:", info[1]),
("Proj:", info[2])
]
ret.append( HtmlTable( tbl ) )
if info[1] != None and info[1] != info[2]:
ret.append( HtmlParagraph( u"<warning> Version of installed scripts doesn't match version of released scripts!\n" \
"This is probably a result of incorrect PostGIS upgrade." ) )
if not self.db.connector.has_geometry_columns:
ret.append( HtmlParagraph( u"<warning> geometry_columns table doesn't exist!\n" \
"This table is essential for many GIS applications for enumeration of tables." ) )
elif not self.db.connector.has_geometry_columns_access:
ret.append( HtmlParagraph( u"<warning> This user doesn't have privileges to read contents of geometry_columns table!\n" \
"This table is essential for many GIS applications for enumeration of tables." ) )
return ret

View File

@ -115,18 +115,17 @@ class PostGisDBConnector(DBConnector):
def getSpatialInfo(self):
""" returns tuple about postgis support:
- lib version
- installed scripts version
- released scripts version
- geos version
- proj version
- whether uses stats
- installed scripts version
- released scripts version
"""
if not self.has_spatial:
return
c = self._get_cursor()
try:
self._execute(c, u"SELECT postgis_lib_version(), postgis_scripts_installed(), postgis_scripts_released(), postgis_geos_version(), postgis_proj_version(), postgis_uses_stats()")
self._execute(c, u"SELECT postgis_lib_version(), postgis_geos_version(), postgis_proj_version(), postgis_scripts_installed(), postgis_scripts_released()")
except DbError:
return

View File

@ -97,6 +97,34 @@ class PGTableInfo(TableInfo):
return ret
def getSpatialInfo(self):
ret = []
info = self.db.connector.getSpatialInfo()
if info == None:
return
tbl = [
("Library:", info[0]),
("Scripts:", info[3]),
("GEOS:", info[1]),
("Proj:", info[2])
]
ret.append( HtmlTable( tbl ) )
if info[1] != None and info[1] != info[2]:
ret.append( HtmlParagraph( u"<warning> Version of installed scripts doesn't match version of released scripts!\n" \
"This is probably a result of incorrect PostGIS upgrade." ) )
if not self.db.connector.has_geometry_columns:
ret.append( HtmlParagraph( u"<warning> geometry_columns table doesn't exist!\n" \
"This table is essential for many GIS applications for enumeration of tables." ) )
elif not self.db.connector.has_geometry_columns_access:
ret.append( HtmlParagraph( u"<warning> This user doesn't have privileges to read contents of geometry_columns table!\n" \
"This table is essential for many GIS applications for enumeration of tables." ) )
return ret
def fieldsDetails(self):
tbl = []

View File

@ -36,26 +36,6 @@ class SLDatabaseInfo(DatabaseInfo):
]
return HtmlTable( tbl )
def spatialInfo(self):
ret = []
info = self.db.connector.getSpatialInfo()
if info == None:
return
tbl = [
("Library:", info[0]),
("GEOS:", info[1]),
("Proj:", info[2])
]
ret.append( HtmlTable( tbl ) )
if not self.db.connector.has_geometry_columns:
ret.append( HtmlParagraph( u"<warning> geometry_columns table doesn't exist!\n" \
"This table is essential for many GIS applications for enumeration of tables." ) )
return ret
def generalInfo(self):
info = self.db.connector.getInfo()
tbl = [