Added support for editing of result sets from tables with OIDs in query tool.

This commit is contained in:
Yosry Muhammad
2019-07-29 12:26:53 +05:30
committed by Akshay Joshi
parent 2ef3080d0e
commit 82d209946f
6 changed files with 143 additions and 40 deletions
+7 -3
View File
@@ -863,6 +863,7 @@ class QueryToolCommand(BaseCommand, FetchedRowTracker):
self.is_updatable_resultset = False
self.primary_keys = None
self.pk_names = None
self.table_has_oids = False
def get_sql(self, default_conn=None):
return None
@@ -873,13 +874,16 @@ class QueryToolCommand(BaseCommand, FetchedRowTracker):
def get_primary_keys(self):
return self.pk_names, self.primary_keys
def has_oids(self):
return self.table_has_oids
def can_edit(self):
return self.is_updatable_resultset
def can_filter(self):
return False
def check_updatable_results_pkeys(self):
def check_updatable_results_pkeys_oids(self):
"""
This function is used to check whether the last successful query
produced updatable results and sets the necessary flags and
@@ -895,8 +899,8 @@ class QueryToolCommand(BaseCommand, FetchedRowTracker):
# Get the path to the sql templates
sql_path = 'sqleditor/sql/#{0}#'.format(manager.version)
self.is_updatable_resultset, self.primary_keys, pk_names, table_oid = \
is_query_resultset_updatable(conn, sql_path)
self.is_updatable_resultset, self.table_has_oids, self.primary_keys, \
pk_names, table_oid = is_query_resultset_updatable(conn, sql_path)
# Create pk_names attribute in the required format
if pk_names is not None: