Resolved few typos, comments, and also some query correction in the SQL
templates for different nodes.pull/3/head
							parent
							
								
									b7f6df34ab
								
							
						
					
					
						commit
						87623cb997
					
				| 
						 | 
				
			
			@ -31,14 +31,15 @@ class EventTriggerModule(CollectionNodeModule):
 | 
			
		|||
    Methods:
 | 
			
		||||
    -------
 | 
			
		||||
    * __init__(*args, **kwargs)
 | 
			
		||||
      - Method is used to initialize the EventTriggerModule and it's base module.
 | 
			
		||||
      - Method is used to initialize the EventTriggerModule and it's base
 | 
			
		||||
        module.
 | 
			
		||||
 | 
			
		||||
    * get_nodes(gid, sid, did)
 | 
			
		||||
      - Method is used to generate the browser collection node.
 | 
			
		||||
 | 
			
		||||
    * script_load()
 | 
			
		||||
      - Load the module script for Event trigger, when any of the database node is
 | 
			
		||||
        initialized.
 | 
			
		||||
      - Load the module script for Event trigger, when any of the database node
 | 
			
		||||
        is initialized.
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    NODE_TYPE = 'event_trigger'
 | 
			
		||||
| 
						 | 
				
			
			@ -65,15 +66,16 @@ class EventTriggerModule(CollectionNodeModule):
 | 
			
		|||
    @property
 | 
			
		||||
    def node_inode(self):
 | 
			
		||||
        """
 | 
			
		||||
        If a node have child return True otherwise False
 | 
			
		||||
        Always returns false, it is a leaf node, and do not have children
 | 
			
		||||
        nodes.
 | 
			
		||||
        """
 | 
			
		||||
        return False
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def script_load(self):
 | 
			
		||||
        """
 | 
			
		||||
        Load the module script for event_trigger, when any of the database node is
 | 
			
		||||
        initialized.
 | 
			
		||||
        Load the module script for event_trigger, when any of the database node
 | 
			
		||||
        is initialized.
 | 
			
		||||
        """
 | 
			
		||||
        return database.DatabaseModule.NODE_TYPE
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -96,8 +98,7 @@ class EventTriggerView(PGChildNodeView):
 | 
			
		|||
      - Method is used to initialize the EventTriggerView and it's base view.
 | 
			
		||||
 | 
			
		||||
    * module_js()
 | 
			
		||||
      - This property defines (if javascript) exists for this node.
 | 
			
		||||
        Override this property for your own logic
 | 
			
		||||
      - Returns the javascript module for event trigger.
 | 
			
		||||
 | 
			
		||||
    * check_precondition()
 | 
			
		||||
      - This function will behave as a decorator which will checks
 | 
			
		||||
| 
						 | 
				
			
			@ -105,42 +106,36 @@ class EventTriggerView(PGChildNodeView):
 | 
			
		|||
        manager,conn & template_path properties to self
 | 
			
		||||
 | 
			
		||||
    * list()
 | 
			
		||||
      - This function is used to list all the event trigger nodes within
 | 
			
		||||
        that collection.
 | 
			
		||||
      - Lists proroperties of all the nodes of type - event trigger.
 | 
			
		||||
 | 
			
		||||
    * nodes()
 | 
			
		||||
      - This function will used to create all the child node within that collection.
 | 
			
		||||
        Here it will create all the event trigger node.
 | 
			
		||||
      - Creates all the child nodes of type - event trigger.
 | 
			
		||||
 | 
			
		||||
    * properties(gid, sid, did, etid)
 | 
			
		||||
      - This function will show the properties of the selected
 | 
			
		||||
        event trigger node
 | 
			
		||||
      - Returns the properties of the given event trigger node
 | 
			
		||||
 | 
			
		||||
    * update(gid, sid, did, etid)
 | 
			
		||||
      - This function will update the data for the selected event trigger node.
 | 
			
		||||
      - Updates the data for the given event trigger node.
 | 
			
		||||
 | 
			
		||||
    * msql(gid, sid, did, etid)
 | 
			
		||||
      - This function is used to return modified SQL for the selected
 | 
			
		||||
        event trigger node.
 | 
			
		||||
      - Return modified SQL for the given event trigger node based on the
 | 
			
		||||
        request data.
 | 
			
		||||
 | 
			
		||||
    * get_sql(data, etid)
 | 
			
		||||
      - This function will generate sql from model data
 | 
			
		||||
      - Generates the sql from model data
 | 
			
		||||
 | 
			
		||||
    * sql(gid, sid, did, etid):
 | 
			
		||||
      - This function will generate sql to show it in sql pane for the selected
 | 
			
		||||
        event trigger node.
 | 
			
		||||
      - Generates the reversed engineered query for the given event trigger
 | 
			
		||||
        node.
 | 
			
		||||
 | 
			
		||||
    * get_event_funcs(gid, sid, did, etid):
 | 
			
		||||
      - This function gets the event functions and returns an ajax response
 | 
			
		||||
        for the event trigger node.
 | 
			
		||||
      - Returns the event functions available in that database.
 | 
			
		||||
 | 
			
		||||
    * dependents(gid, sid, did, etid):
 | 
			
		||||
      - This function get the dependents and return ajax response for the
 | 
			
		||||
        event trigger node.
 | 
			
		||||
      - Returns the dependents list for the given event trigger node.
 | 
			
		||||
 | 
			
		||||
    * dependencies(self, gid, sid, did, etid):
 | 
			
		||||
      - This function get the dependencies and return ajax response for the
 | 
			
		||||
        event trigger node.
 | 
			
		||||
      - Returns the dependencies list for the given event trigger node.
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    node_type = blueprint.node_type
 | 
			
		||||
| 
						 | 
				
			
			@ -172,7 +167,7 @@ class EventTriggerView(PGChildNodeView):
 | 
			
		|||
 | 
			
		||||
    def module_js(self):
 | 
			
		||||
        """
 | 
			
		||||
        This property defines whether javascript exists for this node.
 | 
			
		||||
        Returns the javascript module for event trigger.
 | 
			
		||||
        """
 | 
			
		||||
        return make_response(
 | 
			
		||||
                render_template(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +1,20 @@
 | 
			
		|||
SELECT lan.oid as oid, lanname as name, lanpltrusted as trusted, lanacl as acl, hp.proname as lanproc,
 | 
			
		||||
    vp.proname as lanval, description, pg_get_userbyid(lan.lanowner) as lanowner, ip.proname as laninl,
 | 
			
		||||
SELECT
 | 
			
		||||
    lan.oid as oid, lanname as name, lanpltrusted as trusted,
 | 
			
		||||
    array_to_string(lanacl::text[], ', ') as acl, hp.proname as lanproc,
 | 
			
		||||
    vp.proname as lanval, description,
 | 
			
		||||
    pg_get_userbyid(lan.lanowner) as lanowner, ip.proname as laninl,
 | 
			
		||||
    (SELECT array_agg(label) FROM pg_seclabels sl1 WHERE sl1.objoid=lan.oid) AS labels,
 | 
			
		||||
    (SELECT array_agg(provider) FROM pg_seclabels sl2 WHERE sl2.objoid=lan.oid) AS providers
 | 
			
		||||
FROM pg_language lan JOIN pg_proc hp on hp.oid=lanplcallfoid LEFT OUTER JOIN pg_proc ip on ip.oid=laninline
 | 
			
		||||
LEFT OUTER JOIN pg_proc vp on vp.oid=lanvalidator
 | 
			
		||||
LEFT OUTER JOIN pg_description des ON (des.objoid=lan.oid AND des.objsubid=0 AND des.classoid='pg_language'::regclass)
 | 
			
		||||
FROM
 | 
			
		||||
    pg_language lan JOIN pg_proc hp ON hp.oid=lanplcallfoid
 | 
			
		||||
    LEFT OUTER JOIN pg_proc ip ON ip.oid=laninline
 | 
			
		||||
    LEFT OUTER JOIN pg_proc vp ON vp.oid=lanvalidator
 | 
			
		||||
    LEFT OUTER JOIN pg_description des
 | 
			
		||||
        ON (
 | 
			
		||||
            des.objoid=lan.oid AND des.objsubid=0 AND
 | 
			
		||||
            des.classoid='pg_language'::regclass
 | 
			
		||||
        )
 | 
			
		||||
WHERE lanispl IS TRUE
 | 
			
		||||
{% if lid %}
 | 
			
		||||
AND lan.oid={{lid}}::int
 | 
			
		||||
{% endif %}
 | 
			
		||||
ORDER BY lanname
 | 
			
		||||
{% if lid %} AND
 | 
			
		||||
    lan.oid={{lid}}::int
 | 
			
		||||
{% endif %} ORDER BY lanname
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +1,20 @@
 | 
			
		|||
SELECT lan.oid as oid, lanname as name, lanpltrusted as trusted, lanacl as acl, hp.proname as lanproc,
 | 
			
		||||
    vp.proname as lanval, description, pg_get_userbyid(lan.lanowner) as lanowner, ip.proname as laninl,
 | 
			
		||||
SELECT
 | 
			
		||||
    lan.oid as oid, lanname as name, lanpltrusted as trusted,
 | 
			
		||||
    array_to_string(lanacl::text[], ', ') as acl, hp.proname as lanproc,
 | 
			
		||||
    vp.proname as lanval, description,
 | 
			
		||||
    pg_get_userbyid(lan.lanowner) as lanowner, ip.proname as laninl,
 | 
			
		||||
    (SELECT array_agg(label) FROM pg_seclabels sl1 WHERE sl1.objoid=lan.oid) AS labels,
 | 
			
		||||
    (SELECT array_agg(provider) FROM pg_seclabels sl2 WHERE sl2.objoid=lan.oid) AS providers
 | 
			
		||||
FROM pg_language lan JOIN pg_proc hp on hp.oid=lanplcallfoid LEFT OUTER JOIN pg_proc ip on ip.oid=laninline
 | 
			
		||||
LEFT OUTER JOIN pg_proc vp on vp.oid=lanvalidator
 | 
			
		||||
LEFT OUTER JOIN pg_description des ON (des.objoid=lan.oid AND des.objsubid=0 AND des.classoid='pg_language'::regclass)
 | 
			
		||||
FROM
 | 
			
		||||
    pg_language lan JOIN pg_proc hp ON hp.oid=lanplcallfoid
 | 
			
		||||
    LEFT OUTER JOIN pg_proc ip ON ip.oid=laninline
 | 
			
		||||
    LEFT OUTER JOIN pg_proc vp ON vp.oid=lanvalidator
 | 
			
		||||
    LEFT OUTER JOIN pg_description des
 | 
			
		||||
        ON (
 | 
			
		||||
            des.objoid=lan.oid AND des.objsubid=0 AND
 | 
			
		||||
            des.classoid='pg_language'::regclass
 | 
			
		||||
        )
 | 
			
		||||
WHERE lanispl IS TRUE
 | 
			
		||||
{% if lid %}
 | 
			
		||||
AND lan.oid={{lid}}::int
 | 
			
		||||
{% endif %}
 | 
			
		||||
ORDER BY lanname
 | 
			
		||||
{% if lid %} AND
 | 
			
		||||
    lan.oid={{lid}}::int
 | 
			
		||||
{% endif %} ORDER BY lanname
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +1,12 @@
 | 
			
		|||
{% if scid %}
 | 
			
		||||
SELECT 
 | 
			
		||||
SELECT
 | 
			
		||||
    cl.oid as oid,
 | 
			
		||||
    relname as name, 
 | 
			
		||||
    nsp.nspname as schema, 
 | 
			
		||||
    pg_get_userbyid(relowner) AS seqowner, 
 | 
			
		||||
    relname as name,
 | 
			
		||||
    nsp.nspname as schema,
 | 
			
		||||
    pg_get_userbyid(relowner) AS seqowner,
 | 
			
		||||
    description as comment,
 | 
			
		||||
    array_to_string(relacl::text[], ', ') as acl,
 | 
			
		||||
    (SELECT array_agg(provider || '=' || label) FROM pg_shseclabel sl1 WHERE sl1.objoid=cl.oid) AS securities
 | 
			
		||||
    (SELECT array_agg(provider || '=' || label) FROM pg_seclabels sl1 WHERE sl1.objoid=cl.oid) AS securities
 | 
			
		||||
FROM pg_class cl
 | 
			
		||||
    LEFT OUTER JOIN pg_namespace nsp ON cl.relnamespace = nsp.oid
 | 
			
		||||
    LEFT OUTER JOIN pg_description des ON (des.objoid=cl.oid
 | 
			
		||||
| 
						 | 
				
			
			@ -14,4 +14,4 @@ FROM pg_class cl
 | 
			
		|||
WHERE relkind = 'S' AND relnamespace  = {{scid}}::oid
 | 
			
		||||
{% if seid %}AND cl.oid = {{seid}}::oid {% endif %}
 | 
			
		||||
ORDER BY relname
 | 
			
		||||
{% endif %}
 | 
			
		||||
{% endif %}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ SELECT
 | 
			
		|||
    has_database_privilege(db.oid, 'CREATE') as cancreate,
 | 
			
		||||
    current_setting('default_tablespace') AS default_tablespace,
 | 
			
		||||
    descr.description as comments,
 | 
			
		||||
    datacl AS acl
 | 
			
		||||
    array_to_string(datacl::text[], ', ') AS acl
 | 
			
		||||
FROM pg_database db
 | 
			
		||||
    LEFT OUTER JOIN pg_tablespace ta ON db.dattablespace=ta.OID
 | 
			
		||||
    LEFT OUTER JOIN pg_shdescription descr ON (
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ SELECT
 | 
			
		|||
    current_setting('default_tablespace') AS default_tablespace,
 | 
			
		||||
    descr.description as comments,
 | 
			
		||||
    (SELECT array_agg(provider || '=' || label) FROM pg_shseclabel sl1 WHERE sl1.objoid=db.oid) AS seclabels,
 | 
			
		||||
    datacl AS acl
 | 
			
		||||
    array_to_string(datacl::text[], ', ') AS acl
 | 
			
		||||
FROM pg_database db
 | 
			
		||||
    LEFT OUTER JOIN pg_tablespace ta ON db.dattablespace=ta.OID
 | 
			
		||||
    LEFT OUTER JOIN pg_shdescription descr ON (
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ SELECT
 | 
			
		|||
    current_setting('default_tablespace') AS default_tablespace,
 | 
			
		||||
    descr.description as comments,
 | 
			
		||||
    (SELECT array_agg(provider || '=' || label) FROM pg_shseclabel sl1 WHERE sl1.objoid=db.oid) AS seclabels,
 | 
			
		||||
    datacl AS acl
 | 
			
		||||
    array_to_string(datacl::text[], ', ') AS acl
 | 
			
		||||
FROM pg_database db
 | 
			
		||||
    LEFT OUTER JOIN pg_tablespace ta ON db.dattablespace=ta.OID
 | 
			
		||||
    LEFT OUTER JOIN pg_shdescription descr ON (
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +1,9 @@
 | 
			
		|||
{### SQL to fetch tablespace object properties ###}
 | 
			
		||||
SELECT
 | 
			
		||||
    ts.oid, spcname AS name, spclocation, spcoptions,
 | 
			
		||||
    pg_get_userbyid(spcowner) as spcuser, spcacl,
 | 
			
		||||
    pg_get_userbyid(spcowner) as spcuser,
 | 
			
		||||
    pg_catalog.shobj_description(oid, 'pg_tablespace') AS description,
 | 
			
		||||
    spcacl as acl
 | 
			
		||||
    array_to_string(spcacl::text[], ', ') as acl
 | 
			
		||||
FROM
 | 
			
		||||
    pg_tablespace ts
 | 
			
		||||
{% if tsid %}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,13 +1,13 @@
 | 
			
		|||
{### SQL to fetch tablespace object properties ###}
 | 
			
		||||
SELECT
 | 
			
		||||
    ts.oid, spcname AS name, spcoptions, pg_get_userbyid(spcowner) as spcuser,
 | 
			
		||||
    pg_catalog.pg_tablespace_location(ts.oid) AS spclocation, spcacl::text[],
 | 
			
		||||
    pg_catalog.pg_tablespace_location(ts.oid) AS spclocation,
 | 
			
		||||
    array_to_string(spcacl::text[], ', ') as acl,
 | 
			
		||||
    pg_catalog.shobj_description(oid, 'pg_tablespace') AS description,
 | 
			
		||||
    (SELECT
 | 
			
		||||
        array_agg(provider || '=' || label)
 | 
			
		||||
    FROM pg_shseclabel sl1
 | 
			
		||||
    WHERE sl1.objoid=ts.oid) AS seclabels,
 | 
			
		||||
    spcacl as acl
 | 
			
		||||
    WHERE sl1.objoid=ts.oid) AS seclabels
 | 
			
		||||
FROM
 | 
			
		||||
    pg_tablespace ts
 | 
			
		||||
{% if tsid %}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,11 @@
 | 
			
		|||
{### SQL to fetch tablespace object properties ###}
 | 
			
		||||
SELECT ts.oid, spcname AS name, spclocation, spcoptions, pg_get_userbyid(spcowner) as spcuser, spcacl, spcacl as acl
 | 
			
		||||
pg_catalog.shobj_description(oid, 'pg_tablespace') AS description
 | 
			
		||||
FROM pg_tablespace ts
 | 
			
		||||
SELECT
 | 
			
		||||
    ts.oid, spcname AS name, spclocation, spcoptions,
 | 
			
		||||
    pg_get_userbyid(spcowner) as spcuser,
 | 
			
		||||
    array_to_string(spcacl::text[], ', ') as acl,
 | 
			
		||||
    pg_catalog.shobj_description(oid, 'pg_tablespace') AS description
 | 
			
		||||
FROM
 | 
			
		||||
    pg_tablespace ts
 | 
			
		||||
{% if tsid %}
 | 
			
		||||
WHERE ts.oid={{ tsid|qtLiteral }}::OID
 | 
			
		||||
{% endif %}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue