Skip to content

Commit

Permalink
dbmanager: fix #5812,
Browse files Browse the repository at this point in the history
move PG informations to postgis/info_model.py
  • Loading branch information
brushtyler committed Nov 29, 2012
1 parent 563cce9 commit 3542b08
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 35 deletions.
13 changes: 2 additions & 11 deletions python/plugins/db_manager/db_plugins/info_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,14 @@ def spatialInfo(self):

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

Expand Down
7 changes: 3 additions & 4 deletions python/plugins/db_manager/db_plugins/postgis/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,17 @@ def getInfo(self):
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

Expand Down
28 changes: 28 additions & 0 deletions python/plugins/db_manager/db_plugins/postgis/info_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,34 @@ def generalInfo(self):

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 = []
Expand Down
20 changes: 0 additions & 20 deletions python/plugins/db_manager/db_plugins/spatialite/info_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,6 @@ def connectionDetails(self):
]
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 = [
Expand Down

0 comments on commit 3542b08

Please sign in to comment.