mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
Update building
This commit is contained in:
parent
4f20f50ea3
commit
94784a5cf8
@ -1098,18 +1098,18 @@ class TableField(TableSubItemObject):
|
||||
def getComment(self):
|
||||
"""Returns the comment for a field"""
|
||||
tab = self.table()
|
||||
#SQL Query checking if a comment exists for the field
|
||||
sql_cpt = u"Select count(*) from pg_description pd, pg_class pc, pg_attribute pa where relname = '%s' and attname = '%s' and pa.attrelid = pc.oid and pd.objoid = pc.oid and pd.objsubid = pa.attnum" % (tab.name, self.name)
|
||||
#SQL Query that return the comment of the field
|
||||
sql = u"Select pd.description from pg_description pd, pg_class pc, pg_attribute pa where relname = '%s' and attname = '%s' and pa.attrelid = pc.oid and pd.objoid = pc.oid and pd.objsubid = pa.attnum" % (tab.name, self.name)
|
||||
c = tab.database().connector._execute(None, sql_cpt)# Execute Check query
|
||||
res = tab.database().connector._fetchone(c)[0] #Store result
|
||||
if res == 1:
|
||||
# SQL Query checking if a comment exists for the field
|
||||
sql_cpt = "Select count(*) from pg_description pd, pg_class pc, pg_attribute pa where relname = '%s' and attname = '%s' and pa.attrelid = pc.oid and pd.objoid = pc.oid and pd.objsubid = pa.attnum" % (tab.name, self.name)
|
||||
# SQL Query that return the comment of the field
|
||||
sql = "Select pd.description from pg_description pd, pg_class pc, pg_attribute pa where relname = '%s' and attname = '%s' and pa.attrelid = pc.oid and pd.objoid = pc.oid and pd.objsubid = pa.attnum" % (tab.name, self.name)
|
||||
c = tab.database().connector._execute(None, sql_cpt) # Execute Check query
|
||||
res = tab.database().connector._fetchone(c)[0] # Store result
|
||||
if res == 1:
|
||||
# When a comment exists
|
||||
c = tab.database().connector._execute(None, sql) #Execute query
|
||||
res = tab.database().connector._fetchone(c)[0] #Store result
|
||||
tab.database().connector._close_cursor(c) #Close cursor
|
||||
return res #Return comment
|
||||
c = tab.database().connector._execute(None, sql) # Execute query
|
||||
res = tab.database().connector._fetchone(c)[0] # Store result
|
||||
tab.database().connector._close_cursor(c) # Close cursor
|
||||
return res # Return comment
|
||||
else:
|
||||
return ''
|
||||
|
||||
|
||||
@ -110,8 +110,8 @@ class PGTableInfo(TableInfo):
|
||||
if not self.table.isView:
|
||||
if self.table.rowCount is not None:
|
||||
if abs(self.table.estimatedRowCount - self.table.rowCount) > 1 and \
|
||||
(self.table.estimatedRowCount > 2 * self.table.rowCount or
|
||||
self.table.rowCount > 2 * self.table.estimatedRowCount):
|
||||
(self.table.estimatedRowCount > 2 * self.table.rowCount
|
||||
or self.table.rowCount > 2 * self.table.estimatedRowCount):
|
||||
ret.append(HtmlParagraph(QApplication.translate("DBManagerPlugin",
|
||||
"<warning> There's a significant difference between estimated and real row count. "
|
||||
'Consider running <a href="action:vacuumanalyze/run">VACUUM ANALYZE</a>.')))
|
||||
@ -162,7 +162,7 @@ class PGTableInfo(TableInfo):
|
||||
header = (
|
||||
"#", QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Type"),
|
||||
QApplication.translate("DBManagerPlugin", "Length"), QApplication.translate("DBManagerPlugin", "Null"),
|
||||
QApplication.translate("DBManagerPlugin", "Default"),QApplication.translate("DBManagerPlugin", "Comment"))
|
||||
QApplication.translate("DBManagerPlugin", "Default"), QApplication.translate("DBManagerPlugin", "Comment"))
|
||||
tbl.append(HtmlTableHeader(header))
|
||||
|
||||
# add table contents
|
||||
|
||||
@ -56,18 +56,18 @@ class DlgFieldProperties(QDialog, Ui_Dialog):
|
||||
self.chkNull.setChecked(not fld.notNull)
|
||||
if fld.hasDefault:
|
||||
self.editDefault.setText(fld.default)
|
||||
# Check with SQL query if a comment exists for the field
|
||||
sql_cpt = u"Select count(*) from pg_description pd, pg_class pc, pg_attribute pa where relname = '%s' and attname = '%s' and pa.attrelid = pc.oid and pd.objoid = pc.oid and pd.objsubid = pa.attnum" % (self.table.name, self.editName.text())
|
||||
# Get the comment for the field with SQL Query
|
||||
sql = u"Select pd.description from pg_description pd, pg_class pc, pg_attribute pa where relname = '%s' and attname = '%s' and pa.attrelid = pc.oid and pd.objoid = pc.oid and pd.objsubid = pa.attnum" % (self.table.name, self.editName.text())
|
||||
c = self.db.connector._execute(None, sql_cpt) #Execute check query
|
||||
res = self.db.connector._fetchone(c)[0]# Fetch data
|
||||
#Check if result is 1 then it's ok, else we don't want to get a value
|
||||
if res == 1:
|
||||
c = self.db.connector._execute(None, sql) #Execute query returning the comment value
|
||||
res = self.db.connector._fetchone(c)[0]# Fetch the comment value
|
||||
self.db.connector._close_cursor(c)#Close cursor
|
||||
self.editCom.setText(res) #Set comment value
|
||||
# Check with SQL query if a comment exists for the field
|
||||
sql_cpt = "Select count(*) from pg_description pd, pg_class pc, pg_attribute pa where relname = '%s' and attname = '%s' and pa.attrelid = pc.oid and pd.objoid = pc.oid and pd.objsubid = pa.attnum" % (self.table.name, self.editName.text())
|
||||
# Get the comment for the field with SQL Query
|
||||
sql = "Select pd.description from pg_description pd, pg_class pc, pg_attribute pa where relname = '%s' and attname = '%s' and pa.attrelid = pc.oid and pd.objoid = pc.oid and pd.objsubid = pa.attnum" % (self.table.name, self.editName.text())
|
||||
c = self.db.connector._execute(None, sql_cpt) # Execute check query
|
||||
res = self.db.connector._fetchone(c)[0] # Fetch data
|
||||
# Check if result is 1 then it's ok, else we don't want to get a value
|
||||
if res == 1:
|
||||
c = self.db.connector._execute(None, sql) # Execute query returning the comment value
|
||||
res = self.db.connector._fetchone(c)[0] # Fetch the comment value
|
||||
self.db.connector._close_cursor(c) # Close cursor
|
||||
self.editCom.setText(res) # Set comment value
|
||||
|
||||
def getField(self, newCopy=False):
|
||||
fld = TableField(self.table) if not self.fld or newCopy else self.fld
|
||||
@ -76,7 +76,7 @@ class DlgFieldProperties(QDialog, Ui_Dialog):
|
||||
fld.notNull = not self.chkNull.isChecked()
|
||||
fld.default = self.editDefault.text()
|
||||
fld.hasDefault = fld.default != ""
|
||||
#Get the comment from the LineEdit
|
||||
# Get the comment from the LineEdit
|
||||
fld.comment = self.editCom.text()
|
||||
try:
|
||||
modifier = int(self.editLength.text())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user