Resolved few typos, comments, and also some query correction in the SQL

templates for different nodes.
This commit is contained in:
Ashesh Vashi 2016-03-11 00:58:52 +05:30
parent b7f6df34ab
commit 87623cb997
10 changed files with 78 additions and 63 deletions

View File

@ -31,14 +31,15 @@ class EventTriggerModule(CollectionNodeModule):
Methods: Methods:
------- -------
* __init__(*args, **kwargs) * __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) * get_nodes(gid, sid, did)
- Method is used to generate the browser collection node. - Method is used to generate the browser collection node.
* script_load() * script_load()
- Load the module script for Event trigger, when any of the database node is - Load the module script for Event trigger, when any of the database node
initialized. is initialized.
""" """
NODE_TYPE = 'event_trigger' NODE_TYPE = 'event_trigger'
@ -65,15 +66,16 @@ class EventTriggerModule(CollectionNodeModule):
@property @property
def node_inode(self): 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 return False
@property @property
def script_load(self): def script_load(self):
""" """
Load the module script for event_trigger, when any of the database node is Load the module script for event_trigger, when any of the database node
initialized. is initialized.
""" """
return database.DatabaseModule.NODE_TYPE return database.DatabaseModule.NODE_TYPE
@ -96,8 +98,7 @@ class EventTriggerView(PGChildNodeView):
- Method is used to initialize the EventTriggerView and it's base view. - Method is used to initialize the EventTriggerView and it's base view.
* module_js() * module_js()
- This property defines (if javascript) exists for this node. - Returns the javascript module for event trigger.
Override this property for your own logic
* check_precondition() * check_precondition()
- This function will behave as a decorator which will checks - This function will behave as a decorator which will checks
@ -105,42 +106,36 @@ class EventTriggerView(PGChildNodeView):
manager,conn & template_path properties to self manager,conn & template_path properties to self
* list() * list()
- This function is used to list all the event trigger nodes within - Lists proroperties of all the nodes of type - event trigger.
that collection.
* nodes() * nodes()
- This function will used to create all the child node within that collection. - Creates all the child nodes of type - event trigger.
Here it will create all the event trigger node.
* properties(gid, sid, did, etid) * properties(gid, sid, did, etid)
- This function will show the properties of the selected - Returns the properties of the given event trigger node
event trigger node
* update(gid, sid, did, etid) * 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) * msql(gid, sid, did, etid)
- This function is used to return modified SQL for the selected - Return modified SQL for the given event trigger node based on the
event trigger node. request data.
* get_sql(data, etid) * get_sql(data, etid)
- This function will generate sql from model data - Generates the sql from model data
* sql(gid, sid, did, etid): * sql(gid, sid, did, etid):
- This function will generate sql to show it in sql pane for the selected - Generates the reversed engineered query for the given event trigger
event trigger node. node.
* get_event_funcs(gid, sid, did, etid): * get_event_funcs(gid, sid, did, etid):
- This function gets the event functions and returns an ajax response - Returns the event functions available in that database.
for the event trigger node.
* dependents(gid, sid, did, etid): * dependents(gid, sid, did, etid):
- This function get the dependents and return ajax response for the - Returns the dependents list for the given event trigger node.
event trigger node.
* dependencies(self, gid, sid, did, etid): * dependencies(self, gid, sid, did, etid):
- This function get the dependencies and return ajax response for the - Returns the dependencies list for the given event trigger node.
event trigger node.
""" """
node_type = blueprint.node_type node_type = blueprint.node_type
@ -172,7 +167,7 @@ class EventTriggerView(PGChildNodeView):
def module_js(self): def module_js(self):
""" """
This property defines whether javascript exists for this node. Returns the javascript module for event trigger.
""" """
return make_response( return make_response(
render_template( render_template(

View File

@ -1,12 +1,20 @@
SELECT lan.oid as oid, lanname as name, lanpltrusted as trusted, lanacl as acl, hp.proname as lanproc, SELECT
vp.proname as lanval, description, pg_get_userbyid(lan.lanowner) as lanowner, ip.proname as laninl, 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(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 (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 FROM
LEFT OUTER JOIN pg_proc vp on vp.oid=lanvalidator pg_language lan JOIN pg_proc hp ON hp.oid=lanplcallfoid
LEFT OUTER JOIN pg_description des ON (des.objoid=lan.oid AND des.objsubid=0 AND des.classoid='pg_language'::regclass) 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 WHERE lanispl IS TRUE
{% if lid %} {% if lid %} AND
AND lan.oid={{lid}}::int lan.oid={{lid}}::int
{% endif %} {% endif %} ORDER BY lanname
ORDER BY lanname

View File

@ -1,12 +1,20 @@
SELECT lan.oid as oid, lanname as name, lanpltrusted as trusted, lanacl as acl, hp.proname as lanproc, SELECT
vp.proname as lanval, description, pg_get_userbyid(lan.lanowner) as lanowner, ip.proname as laninl, 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(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 (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 FROM
LEFT OUTER JOIN pg_proc vp on vp.oid=lanvalidator pg_language lan JOIN pg_proc hp ON hp.oid=lanplcallfoid
LEFT OUTER JOIN pg_description des ON (des.objoid=lan.oid AND des.objsubid=0 AND des.classoid='pg_language'::regclass) 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 WHERE lanispl IS TRUE
{% if lid %} {% if lid %} AND
AND lan.oid={{lid}}::int lan.oid={{lid}}::int
{% endif %} {% endif %} ORDER BY lanname
ORDER BY lanname

View File

@ -1,12 +1,12 @@
{% if scid %} {% if scid %}
SELECT SELECT
cl.oid as oid, cl.oid as oid,
relname as name, relname as name,
nsp.nspname as schema, nsp.nspname as schema,
pg_get_userbyid(relowner) AS seqowner, pg_get_userbyid(relowner) AS seqowner,
description as comment, description as comment,
array_to_string(relacl::text[], ', ') as acl, 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 FROM pg_class cl
LEFT OUTER JOIN pg_namespace nsp ON cl.relnamespace = nsp.oid LEFT OUTER JOIN pg_namespace nsp ON cl.relnamespace = nsp.oid
LEFT OUTER JOIN pg_description des ON (des.objoid=cl.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 WHERE relkind = 'S' AND relnamespace = {{scid}}::oid
{% if seid %}AND cl.oid = {{seid}}::oid {% endif %} {% if seid %}AND cl.oid = {{seid}}::oid {% endif %}
ORDER BY relname ORDER BY relname
{% endif %} {% endif %}

View File

@ -5,7 +5,7 @@ SELECT
has_database_privilege(db.oid, 'CREATE') as cancreate, has_database_privilege(db.oid, 'CREATE') as cancreate,
current_setting('default_tablespace') AS default_tablespace, current_setting('default_tablespace') AS default_tablespace,
descr.description as comments, descr.description as comments,
datacl AS acl array_to_string(datacl::text[], ', ') AS acl
FROM pg_database db FROM pg_database db
LEFT OUTER JOIN pg_tablespace ta ON db.dattablespace=ta.OID LEFT OUTER JOIN pg_tablespace ta ON db.dattablespace=ta.OID
LEFT OUTER JOIN pg_shdescription descr ON ( LEFT OUTER JOIN pg_shdescription descr ON (

View File

@ -6,7 +6,7 @@ SELECT
current_setting('default_tablespace') AS default_tablespace, current_setting('default_tablespace') AS default_tablespace,
descr.description as comments, descr.description as comments,
(SELECT array_agg(provider || '=' || label) FROM pg_shseclabel sl1 WHERE sl1.objoid=db.oid) AS seclabels, (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 FROM pg_database db
LEFT OUTER JOIN pg_tablespace ta ON db.dattablespace=ta.OID LEFT OUTER JOIN pg_tablespace ta ON db.dattablespace=ta.OID
LEFT OUTER JOIN pg_shdescription descr ON ( LEFT OUTER JOIN pg_shdescription descr ON (

View File

@ -6,7 +6,7 @@ SELECT
current_setting('default_tablespace') AS default_tablespace, current_setting('default_tablespace') AS default_tablespace,
descr.description as comments, descr.description as comments,
(SELECT array_agg(provider || '=' || label) FROM pg_shseclabel sl1 WHERE sl1.objoid=db.oid) AS seclabels, (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 FROM pg_database db
LEFT OUTER JOIN pg_tablespace ta ON db.dattablespace=ta.OID LEFT OUTER JOIN pg_tablespace ta ON db.dattablespace=ta.OID
LEFT OUTER JOIN pg_shdescription descr ON ( LEFT OUTER JOIN pg_shdescription descr ON (

View File

@ -1,9 +1,9 @@
{### SQL to fetch tablespace object properties ###} {### SQL to fetch tablespace object properties ###}
SELECT SELECT
ts.oid, spcname AS name, spclocation, spcoptions, 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, pg_catalog.shobj_description(oid, 'pg_tablespace') AS description,
spcacl as acl array_to_string(spcacl::text[], ', ') as acl
FROM FROM
pg_tablespace ts pg_tablespace ts
{% if tsid %} {% if tsid %}

View File

@ -1,13 +1,13 @@
{### SQL to fetch tablespace object properties ###} {### SQL to fetch tablespace object properties ###}
SELECT SELECT
ts.oid, spcname AS name, spcoptions, pg_get_userbyid(spcowner) as spcuser, 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, pg_catalog.shobj_description(oid, 'pg_tablespace') AS description,
(SELECT (SELECT
array_agg(provider || '=' || label) array_agg(provider || '=' || label)
FROM pg_shseclabel sl1 FROM pg_shseclabel sl1
WHERE sl1.objoid=ts.oid) AS seclabels, WHERE sl1.objoid=ts.oid) AS seclabels
spcacl as acl
FROM FROM
pg_tablespace ts pg_tablespace ts
{% if tsid %} {% if tsid %}

View File

@ -1,7 +1,11 @@
{### SQL to fetch tablespace object properties ###} {### SQL to fetch tablespace object properties ###}
SELECT ts.oid, spcname AS name, spclocation, spcoptions, pg_get_userbyid(spcowner) as spcuser, spcacl, spcacl as acl SELECT
pg_catalog.shobj_description(oid, 'pg_tablespace') AS description ts.oid, spcname AS name, spclocation, spcoptions,
FROM pg_tablespace ts 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 %} {% if tsid %}
WHERE ts.oid={{ tsid|qtLiteral }}::OID WHERE ts.oid={{ tsid|qtLiteral }}::OID
{% endif %} {% endif %}