[COLLATIONS] Do not assign the paramter values, use separate variable for new value

This commit is contained in:
Ashesh Vashi
2020-04-08 12:53:48 +05:30
parent a84a62def8
commit 068b812245

View File

@@ -448,6 +448,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
) )
required_args = [ required_args = [
'schema',
'name' 'name'
] ]
@@ -470,31 +471,35 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
) )
) )
SQL = render_template("/".join([self.template_path, SQL = render_template(
'create.sql']), "/".join([self.template_path, 'create.sql']),
data=data, conn=self.conn) data=data, conn=self.conn
)
status, res = self.conn.execute_scalar(SQL) status, res = self.conn.execute_scalar(SQL)
if not status: if not status:
return internal_server_error(errormsg=res) return internal_server_error(errormsg=res)
# We need oid to to add object in tree at browser # We need oid to to add object in tree at browser
SQL = render_template("/".join([self.template_path, SQL = render_template(
'get_oid.sql']), data=data) "/".join([self.template_path, 'get_oid.sql']), data=data
)
status, coid = self.conn.execute_scalar(SQL) status, coid = self.conn.execute_scalar(SQL)
if not status: if not status:
return internal_server_error(errormsg=coid) return internal_server_error(errormsg=coid)
# Get updated schema oid # Get updated schema oid
SQL = render_template("/".join([self.template_path, SQL = render_template(
'get_oid.sql']), coid=coid) "/".join([self.template_path, 'get_oid.sql']), coid=coid
status, scid = self.conn.execute_scalar(SQL) )
status, new_scid = self.conn.execute_scalar(SQL)
if not status: if not status:
return internal_server_error(errormsg=coid) return internal_server_error(errormsg=coid)
return jsonify( return jsonify(
node=self.blueprint.generate_browser_node( node=self.blueprint.generate_browser_node(
coid, coid,
scid, new_scid,
data['name'], data['name'],
icon="icon-collation" icon="icon-collation"
) )