def get_node_list(self, gid, sid, did, scid, tid, cid=None): """ This function returns all check constraints nodes within that collection as a list. Args: gid: Server Group ID sid: Server ID did: Database ID scid: Schema ID tid: Table ID cid: Cehck constraint ID Returns: """ driver = get_driver(PG_DEFAULT_DRIVER) self.manager = driver.connection_manager(sid) self.conn = self.manager.connection(did=did) self.qtIdent = driver.qtIdent # Set the template path for the SQL scripts self.template_path = 'check_constraint/sql/#{0}#'.format( self.manager.version) schema, table = check_utils.get_parent(self.conn, tid) self.schema = schema self.table = table SQL = render_template("/".join([self.template_path, 'properties.sql']), tid=tid) status, res = self.conn.execute_dict(SQL) return res['rows']
def wrap(*args, **kwargs): self = args[0] driver = get_driver(PG_DEFAULT_DRIVER) self.manager = driver.connection_manager(kwargs['sid']) self.conn = self.manager.connection(did=kwargs['did']) self.qtIdent = driver.qtIdent self.datlastsysoid = \ self.manager.db_info[kwargs['did']]['datlastsysoid'] \ if self.manager.db_info is not None and \ kwargs['did'] in self.manager.db_info else 0 self.datistemplate = False if (self.manager.db_info is not None and kwargs['did'] in self.manager.db_info and 'datistemplate' in self.manager.db_info[kwargs['did']]): self.datistemplate = self.manager.db_info[ kwargs['did']]['datistemplate'] # Set the template path for the SQL scripts self.template_path = self.CHECK_CONSTRAINT_PATH.format( self.manager.version) schema, table = check_utils.get_parent(self.conn, kwargs['tid']) self.schema = schema self.table = table return f(*args, **kwargs)
def get_nodes(self, gid, sid, did, scid, tid, cid=None): """ This function returns all event check constraint as a list. Args: gid: Server Group ID sid: Server ID did: Database ID scid: Schema ID tid: Table ID cid: Check constraint ID Returns: """ driver = get_driver(PG_DEFAULT_DRIVER) self.manager = driver.connection_manager(sid) self.conn = self.manager.connection(did=did) self.qtIdent = driver.qtIdent # Set the template path for the SQL scripts self.template_path = 'check_constraint/sql/#{0}#'.format( self.manager.version) schema, table = check_utils.get_parent(self.conn, tid) self.schema = schema self.table = table res = [] SQL = render_template("/".join([self.template_path, 'nodes.sql']), tid=tid) status, rset = self.conn.execute_2darray(SQL) for row in rset['rows']: if "convalidated" in row and row["convalidated"]: icon = "icon-check_constraint_bad" valid = False else: icon = "icon-check_constraint" valid = True res.append( self.blueprint.generate_browser_node( row['oid'], tid, row['name'], icon=icon, valid=valid )) return res
def wrap(*args, **kwargs): self = args[0] driver = get_driver(PG_DEFAULT_DRIVER) self.manager = driver.connection_manager(kwargs['sid']) self.conn = self.manager.connection(did=kwargs['did']) self.qtIdent = driver.qtIdent # Set the template path for the SQL scripts self.template_path = 'check_constraint/sql/#{0}#'.format( self.manager.version) schema, table = check_utils.get_parent(self.conn, kwargs['tid']) self.schema = schema self.table = table return f(*args, **kwargs)
def wrap(*args, **kwargs): self = args[0] driver = get_driver(PG_DEFAULT_DRIVER) self.manager = driver.connection_manager(kwargs['sid']) self.conn = self.manager.connection(did=kwargs['did']) self.qtIdent = driver.qtIdent self.datlastsysoid = \ self.manager.db_info[kwargs['did']]['datlastsysoid'] \ if self.manager.db_info is not None and \ kwargs['did'] in self.manager.db_info else 0 # Set the template path for the SQL scripts self.template_path = 'check_constraint/sql/#{0}#'.format( self.manager.version) schema, table = check_utils.get_parent(self.conn, kwargs['tid']) self.schema = schema self.table = table return f(*args, **kwargs)
def get_node_list(self, gid, sid, did, scid, tid, cid=None): """ This function returns all check constraints nodes within that collection as a list. Args: gid: Server Group ID sid: Server ID did: Database ID scid: Schema ID tid: Table ID cid: Cehck constraint ID Returns: """ driver = get_driver(PG_DEFAULT_DRIVER) self.manager = driver.connection_manager(sid) self.conn = self.manager.connection(did=did) self.qtIdent = driver.qtIdent # Set the template path for the SQL scripts self.template_path = self.CHECK_CONSTRAINT_PATH.format( self.manager.version) schema, table = check_utils.get_parent(self.conn, tid) self.schema = schema self.table = table SQL = render_template("/".join( [self.template_path, self._PROPERTIES_SQL]), tid=tid) status, res = self.conn.execute_dict(SQL) for row in res['rows']: row['_type'] = self.node_type return res['rows']