Fix SQLs generated for pgAgent related nodes which were causing issues after psycopg3 changes. #5011

This commit is contained in:
Aditya Toshniwal 2023-03-31 10:48:16 +05:30 committed by GitHub
parent 50391ae3fd
commit 21cbc6e9e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 71 additions and 53 deletions

View File

@ -215,7 +215,7 @@ class JobScheduleView(PGChildNodeView):
""" """
sql = render_template( sql = render_template(
"/".join([self.template_path, self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
jid=jid jid=jid, conn=self.conn
) )
status, res = self.conn.execute_dict(sql) status, res = self.conn.execute_dict(sql)
@ -242,7 +242,8 @@ class JobScheduleView(PGChildNodeView):
sql = render_template( sql = render_template(
"/".join([self.template_path, self._NODES_SQL]), "/".join([self.template_path, self._NODES_SQL]),
jscid=jscid, jscid=jscid,
jid=jid jid=jid,
conn=self.conn
) )
status, result = self.conn.execute_2darray(sql) status, result = self.conn.execute_2darray(sql)
@ -298,7 +299,7 @@ class JobScheduleView(PGChildNodeView):
""" """
sql = render_template( sql = render_template(
"/".join([self.template_path, self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
jscid=jscid, jid=jid jscid=jscid, jid=jid, conn=self.conn
) )
status, res = self.conn.execute_dict(sql) status, res = self.conn.execute_dict(sql)
@ -349,7 +350,8 @@ class JobScheduleView(PGChildNodeView):
"/".join([self.template_path, self._CREATE_SQL]), "/".join([self.template_path, self._CREATE_SQL]),
jid=jid, jid=jid,
data=data, data=data,
fetch_id=True fetch_id=True,
conn=self.conn
) )
status, res = self.conn.execute_void('BEGIN') status, res = self.conn.execute_void('BEGIN')
@ -366,7 +368,8 @@ class JobScheduleView(PGChildNodeView):
sql = render_template( sql = render_template(
"/".join([self.template_path, self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
jscid=res, jscid=res,
jid=jid jid=jid,
conn=self.conn
) )
status, res = self.conn.execute_2darray(sql) status, res = self.conn.execute_2darray(sql)
@ -419,7 +422,8 @@ class JobScheduleView(PGChildNodeView):
"/".join([self.template_path, self._UPDATE_SQL]), "/".join([self.template_path, self._UPDATE_SQL]),
jid=jid, jid=jid,
jscid=jscid, jscid=jscid,
data=data data=data,
conn=self.conn
) )
status, res = self.conn.execute_void(sql) status, res = self.conn.execute_void(sql)
@ -430,7 +434,8 @@ class JobScheduleView(PGChildNodeView):
sql = render_template( sql = render_template(
"/".join([self.template_path, self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
jscid=jscid, jscid=jscid,
jid=jid jid=jid,
conn=self.conn
) )
status, res = self.conn.execute_2darray(sql) status, res = self.conn.execute_2darray(sql)
@ -504,14 +509,16 @@ class JobScheduleView(PGChildNodeView):
"/".join([self.template_path, self._CREATE_SQL]), "/".join([self.template_path, self._CREATE_SQL]),
jid=jid, jid=jid,
data=data, data=data,
fetch_id=False fetch_id=False,
conn=self.conn
) )
else: else:
sql = render_template( sql = render_template(
"/".join([self.template_path, self._UPDATE_SQL]), "/".join([self.template_path, self._UPDATE_SQL]),
jid=jid, jid=jid,
jscid=jscid, jscid=jscid,
data=data data=data,
conn=self.conn
) )
return make_json_response( return make_json_response(

View File

@ -229,7 +229,8 @@ SELECT EXISTS(
sql = render_template( sql = render_template(
"/".join([self.template_path, self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
jid=jid, jid=jid,
has_connstr=self.manager.db_info['pgAgent']['has_connstr'] has_connstr=self.manager.db_info['pgAgent']['has_connstr'],
conn=self.conn
) )
status, res = self.conn.execute_dict(sql) status, res = self.conn.execute_dict(sql)
@ -257,7 +258,8 @@ SELECT EXISTS(
sql = render_template( sql = render_template(
"/".join([self.template_path, self._NODES_SQL]), "/".join([self.template_path, self._NODES_SQL]),
jstid=jstid, jstid=jstid,
jid=jid jid=jid,
conn=self.conn
) )
status, result = self.conn.execute_2darray(sql) status, result = self.conn.execute_2darray(sql)
@ -315,7 +317,8 @@ SELECT EXISTS(
"/".join([self.template_path, self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
jstid=jstid, jstid=jstid,
jid=jid, jid=jid,
has_connstr=self.manager.db_info['pgAgent']['has_connstr'] has_connstr=self.manager.db_info['pgAgent']['has_connstr'],
conn=self.conn
) )
status, res = self.conn.execute_dict(sql) status, res = self.conn.execute_dict(sql)
@ -356,7 +359,8 @@ SELECT EXISTS(
"/".join([self.template_path, self._CREATE_SQL]), "/".join([self.template_path, self._CREATE_SQL]),
jid=jid, jid=jid,
data=data, data=data,
has_connstr=self.manager.db_info['pgAgent']['has_connstr'] has_connstr=self.manager.db_info['pgAgent']['has_connstr'],
conn=self.conn
) )
status, res = self.conn.execute_scalar(sql) status, res = self.conn.execute_scalar(sql)
@ -367,7 +371,8 @@ SELECT EXISTS(
sql = render_template( sql = render_template(
"/".join([self.template_path, self._NODES_SQL]), "/".join([self.template_path, self._NODES_SQL]),
jstid=res, jstid=res,
jid=jid jid=jid,
conn=self.conn
) )
status, res = self.conn.execute_2darray(sql) status, res = self.conn.execute_2darray(sql)
@ -415,7 +420,8 @@ SELECT EXISTS(
"/".join([self.template_path, self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
jstid=jstid, jstid=jstid,
jid=jid, jid=jid,
has_connstr=self.manager.db_info['pgAgent']['has_connstr'] has_connstr=self.manager.db_info['pgAgent']['has_connstr'],
conn=self.conn
) )
status, res = self.conn.execute_dict(sql) status, res = self.conn.execute_dict(sql)
@ -439,7 +445,8 @@ SELECT EXISTS(
jid=jid, jid=jid,
jstid=jstid, jstid=jstid,
data=data, data=data,
has_connstr=self.manager.db_info['pgAgent']['has_connstr'] has_connstr=self.manager.db_info['pgAgent']['has_connstr'],
conn=self.conn
) )
status, res = self.conn.execute_void(sql) status, res = self.conn.execute_void(sql)
@ -450,7 +457,8 @@ SELECT EXISTS(
sql = render_template( sql = render_template(
"/".join([self.template_path, self._NODES_SQL]), "/".join([self.template_path, self._NODES_SQL]),
jstid=jstid, jstid=jstid,
jid=jid jid=jid,
conn=self.conn
) )
status, res = self.conn.execute_2darray(sql) status, res = self.conn.execute_2darray(sql)
@ -522,7 +530,8 @@ SELECT EXISTS(
"/".join([self.template_path, self._CREATE_SQL]), "/".join([self.template_path, self._CREATE_SQL]),
jid=jid, jid=jid,
data=data, data=data,
has_connstr=self.manager.db_info['pgAgent']['has_connstr'] has_connstr=self.manager.db_info['pgAgent']['has_connstr'],
conn=self.conn
) )
return make_json_response( return make_json_response(
@ -539,7 +548,8 @@ SELECT EXISTS(
"/".join([self.template_path, self._PROPERTIES_SQL]), "/".join([self.template_path, self._PROPERTIES_SQL]),
jstid=jstid, jstid=jstid,
jid=jid, jid=jid,
has_connstr=self.manager.db_info['pgAgent']['has_connstr'] has_connstr=self.manager.db_info['pgAgent']['has_connstr'],
conn=self.conn
) )
status, res = self.conn.execute_dict(sql) status, res = self.conn.execute_dict(sql)
@ -563,7 +573,8 @@ SELECT EXISTS(
jid=jid, jid=jid,
jstid=jstid, jstid=jstid,
data=data, data=data,
has_connstr=self.manager.db_info['pgAgent']['has_connstr'] has_connstr=self.manager.db_info['pgAgent']['has_connstr'],
conn=self.conn
) )
return make_json_response( return make_json_response(

View File

@ -1,7 +1,7 @@
{##################################################} {##################################################}
{# This will be specific macro for pga_exception. #} {# This will be specific macro for pga_exception. #}
{##################################################} {##################################################}
{% macro INSERT(jscid, data) -%} {% macro INSERT(jscid, data, conn) -%}
-- Inserting a schedule exception {% if jscid %}(schedule: {{ jscid|qtLiteral(conn)}}){% endif %} -- Inserting a schedule exception {% if jscid %}(schedule: {{ jscid|qtLiteral(conn)}}){% endif %}
INSERT INTO pgagent.pga_exception ( INSERT INTO pgagent.pga_exception (
@ -11,14 +11,14 @@ INSERT INTO pgagent.pga_exception (
); );
{%- endmacro %} {%- endmacro %}
{% macro UPDATE(jscid, data) -%} {% macro UPDATE(jscid, data, conn) -%}
-- Updating an existing schedule exception (id: {{ data.jexid|qtLiteral(conn) }}, schedule: {{ jscid|qtLiteral(conn) }}) -- Updating an existing schedule exception (id: {{ data.jexid|qtLiteral(conn) }}, schedule: {{ jscid|qtLiteral(conn) }})
UPDATE pgagent.pga_exception SET UPDATE pgagent.pga_exception SET
{% if 'jexdate' in data %}jexdate={% if data.jexdate %}to_date({{ data.jexdate|qtLiteral(conn) }}, 'YYYY-MM-DD')::date{% else %}NULL::date{% endif %}{% endif %}{% if 'jextime' in data%}{% if 'jexdate' in data %}, {% endif %}jextime={% if data.jextime %}{{ data.jextime|qtLiteral(conn) }}::time without time zone{% else %}NULL::time without time zone{% endif %}{% endif %} {% if 'jexdate' in data %}jexdate={% if data.jexdate %}to_date({{ data.jexdate|qtLiteral(conn) }}, 'YYYY-MM-DD')::date{% else %}NULL::date{% endif %}{% endif %}{% if 'jextime' in data%}{% if 'jexdate' in data %}, {% endif %}jextime={% if data.jextime %}{{ data.jextime|qtLiteral(conn) }}::time without time zone{% else %}NULL::time without time zone{% endif %}{% endif %}
WHERE jexid={{ data.jexid|qtLiteral(conn) }}::integer AND jexscid={{ jscid|qtLiteral(conn) }}::integer; WHERE jexid={{ data.jexid|qtLiteral(conn) }}::integer AND jexscid={{ jscid|qtLiteral(conn) }}::integer;
{%- endmacro %} {%- endmacro %}
{% macro DELETE(jscid, data) -%} {% macro DELETE(jscid, data, conn) -%}
-- Deleting a schedule exception (id: {{ data.jexid|qtLiteral(conn) }}, schedule: {{ jscid|qtLiteral(conn) }}) -- Deleting a schedule exception (id: {{ data.jexid|qtLiteral(conn) }}, schedule: {{ jscid|qtLiteral(conn) }})
DELETE FROM pgagent.pga_exception WHERE jexid={{ data.jexid|qtLiteral(conn) }}::integer AND jexscid={{ jscid|qtLiteral(conn) }}::integer; DELETE FROM pgagent.pga_exception WHERE jexid={{ data.jexid|qtLiteral(conn) }}::integer AND jexscid={{ jscid|qtLiteral(conn) }}::integer;
{%- endmacro %} {%- endmacro %}

View File

@ -1,7 +1,7 @@
{################################################} {################################################}
{# This will be specific macro for pga_jobstep. #} {# This will be specific macro for pga_jobstep. #}
{################################################} {################################################}
{% macro INSERT(has_connstr, jid, data) -%} {% macro INSERT(has_connstr, jid, data, conn) -%}
-- Inserting a step (jobid: {{ jid|qtLiteral(conn) }}) -- Inserting a step (jobid: {{ jid|qtLiteral(conn) }})
INSERT INTO pgagent.pga_jobstep ( INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind, jstjobid, jstname, jstenabled, jstkind,
@ -13,7 +13,7 @@ INSERT INTO pgagent.pga_jobstep (
{{ data.jstcode|qtLiteral(conn) }}::text, {{ data.jstdesc|qtLiteral(conn) }}::text {{ data.jstcode|qtLiteral(conn) }}::text, {{ data.jstdesc|qtLiteral(conn) }}::text
) {% if jid %}RETURNING jstid{% endif %}; ) {% if jid %}RETURNING jstid{% endif %};
{%- endmacro %} {%- endmacro %}
{% macro UPDATE(has_connstr, jid, jstid, data) -%} {% macro UPDATE(has_connstr, jid, jstid, data, conn) -%}
{% if 'jstname' in data or 'jstenabled' in data or 'jstdesc' in data or 'jstonerror' in data or 'jstcode' in data %} {% if 'jstname' in data or 'jstenabled' in data or 'jstdesc' in data or 'jstonerror' in data or 'jstcode' in data %}
{% set is_comma_required = True %} {% set is_comma_required = True %}
{% else %} {% else %}
@ -36,11 +36,11 @@ SET
WHERE jstid={{ jstid|qtLiteral(conn) }}::integer AND jstjobid={{ jid|qtLiteral(conn) }}::integer; WHERE jstid={{ jstid|qtLiteral(conn) }}::integer AND jstjobid={{ jid|qtLiteral(conn) }}::integer;
{%- endmacro %} {%- endmacro %}
{% macro DELETE(jid, jstid) -%} {% macro DELETE(jid, jstid, conn) -%}
-- Deleting a step (id: {{ jstid|qtLiteral(conn) }}, jobid: {{ jid|qtLiteral(conn) }}) -- Deleting a step (id: {{ jstid|qtLiteral(conn) }}, jobid: {{ jid|qtLiteral(conn) }})
DELETE FROM pgagent.pga_jobstep WHERE jstid={{ jstid|qtLiteral(conn) }}::integer AND jstjobid={{ jid|qtLiteral(conn) }}::integer; DELETE FROM pgagent.pga_jobstep WHERE jstid={{ jstid|qtLiteral(conn) }}::integer AND jstjobid={{ jid|qtLiteral(conn) }}::integer;
{%- endmacro %} {%- endmacro %}
{% macro PROPERTIES(has_connstr, jid, jstid) -%} {% macro PROPERTIES(has_connstr, jid, jstid, conn) -%}
SELECT SELECT
jstid, jstjobid, jstname, jstdesc, jstenabled, jstkind = 's'::bpchar as jstkind, jstid, jstjobid, jstname, jstdesc, jstenabled, jstkind = 's'::bpchar as jstkind,
jstcode, CASE WHEN (jstdbname != '' OR jstkind = 'b'::bpchar) THEN true ELSE false END AS jstconntype, jstcode, CASE WHEN (jstdbname != '' OR jstkind = 'b'::bpchar) THEN true ELSE false END AS jstconntype,

View File

@ -2,7 +2,7 @@
{# This will be specific macro for pga_schedule. #} {# This will be specific macro for pga_schedule. #}
{#################################################} {#################################################}
{% import 'macros/pga_exception.macros' as EXCEPTIONS %} {% import 'macros/pga_exception.macros' as EXCEPTIONS %}
{% macro INSERT(jid, data) -%} {% macro INSERT(jid, data, conn) -%}
-- Inserting a schedule{% if jid %} (jobid: {{ jid|qtLiteral(conn) }}){% endif %} -- Inserting a schedule{% if jid %} (jobid: {{ jid|qtLiteral(conn) }}){% endif %}
INSERT INTO pgagent.pga_schedule( INSERT INTO pgagent.pga_schedule(
@ -26,9 +26,9 @@ INSERT INTO pgagent.pga_schedule(
) RETURNING jscid INTO scid;{% if 'jscexceptions' in data %} ) RETURNING jscid INTO scid;{% if 'jscexceptions' in data %}
{% for exc in data.jscexceptions %} {% for exc in data.jscexceptions %}
{{ EXCEPTIONS.INSERT(None, exc) }}{% endfor %}{% endif %} {{ EXCEPTIONS.INSERT(None, exc, conn) }}{% endfor %}{% endif %}
{%- endmacro %} {%- endmacro %}
{% macro UPDATE(jid, jscid, data) -%} {% macro UPDATE(jid, jscid, data, conn) -%}
{% if 'jscname' in data or 'jscenabled' in data or 'jscdesc' in data or 'jscstart' in data or 'jscend' in data or 'jscmonths' in data or 'jscminutes' in data or 'jscmonthdays' in data or 'jschours' in data or 'jscweekdays' in data %} {% if 'jscname' in data or 'jscenabled' in data or 'jscdesc' in data or 'jscstart' in data or 'jscend' in data or 'jscmonths' in data or 'jscminutes' in data or 'jscmonthdays' in data or 'jschours' in data or 'jscweekdays' in data %}
-- Updating the schedule (id: {{ jscid|qtLiteral(conn) }}, jobid: {{ jid|qtLiteral(conn) }}) -- Updating the schedule (id: {{ jscid|qtLiteral(conn) }}, jobid: {{ jid|qtLiteral(conn) }})
@ -59,31 +59,31 @@ WHERE jscid={{ jscid|qtLiteral(conn) }}::integer AND jscjobid={{ jid|qtLiteral(c
{% if 'added' in data.jscexceptions and data.jscexceptions.added|length > 0 %} {% if 'added' in data.jscexceptions and data.jscexceptions.added|length > 0 %}
{% for exc in data.jscexceptions.added %} {% for exc in data.jscexceptions.added %}
{{ EXCEPTIONS.INSERT(jscid, exc) }} {{ EXCEPTIONS.INSERT(jscid, exc, conn) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'deleted' in data.jscexceptions and data.jscexceptions.deleted|length > 0 %} {% if 'deleted' in data.jscexceptions and data.jscexceptions.deleted|length > 0 %}
{% for exc in data.jscexceptions.deleted %} {% for exc in data.jscexceptions.deleted %}
{{ EXCEPTIONS.DELETE(jscid, exc) }} {{ EXCEPTIONS.DELETE(jscid, exc, conn) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if 'changed' in data.jscexceptions and data.jscexceptions.changed|length > 0 %} {% if 'changed' in data.jscexceptions and data.jscexceptions.changed|length > 0 %}
{% for exc in data.jscexceptions.changed %} {% for exc in data.jscexceptions.changed %}
{{ EXCEPTIONS.UPDATE(jscid, exc) }} {{ EXCEPTIONS.UPDATE(jscid, exc, conn) }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}
{% macro DELETE(jid, jscid) -%} {% macro DELETE(jid, jscid, conn) -%}
-- Removing the existing schedule (id: {{ jscid|qtLiteral(conn) }}, jobid: {{ jid|qtLiteral(conn) }}) -- Removing the existing schedule (id: {{ jscid|qtLiteral(conn) }}, jobid: {{ jid|qtLiteral(conn) }})
DELETE FROM pgagent.pga_schedule WHERE jscid={{ jscid|qtLiteral(conn) }}::integer AND jscjobid={{ jid|qtLiteral(conn) }}::integer; DELETE FROM pgagent.pga_schedule WHERE jscid={{ jscid|qtLiteral(conn) }}::integer AND jscjobid={{ jid|qtLiteral(conn) }}::integer;
{%- endmacro %} {%- endmacro %}
{% macro FETCH_CURRENT() -%} {% macro FETCH_CURRENT() -%}
SELECT jscid FROM pgagent.pga_schedule WHERE xmin::text = (txid_current() % (2^32)::bigint)::text; SELECT jscid FROM pgagent.pga_schedule WHERE xmin::text = (txid_current() % (2^32)::bigint)::text;
{%- endmacro %} {%- endmacro %}
{% macro PROPERTIES(jid, jscid) -%} {% macro PROPERTIES(jid, jscid, conn) -%}
SELECT SELECT
jscid, jscjobid, jscname, jscdesc, jscenabled, jscstart, jscend, jscid, jscjobid, jscname, jscdesc, jscenabled, jscstart, jscend,
jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths,

View File

@ -17,12 +17,12 @@ INSERT INTO pgagent.pga_job(
-- Steps -- Steps
{% for step in data.jsteps %}{{ STEP.INSERT(has_connstr, None, step) }}{% endfor %} {% for step in data.jsteps %}{{ STEP.INSERT(has_connstr, None, step, conn) }}{% endfor %}
{% endif %}{% if 'jschedules' in data and data.jschedules|length > 0 %} {% endif %}{% if 'jschedules' in data and data.jschedules|length > 0 %}
-- Schedules -- Schedules
{% for schedule in data.jschedules %}{{ SCHEDULE.INSERT(None, schedule) }}{% endfor %} {% for schedule in data.jschedules %}{{ SCHEDULE.INSERT(None, schedule, conn) }}{% endfor %}
{% endif %} {% endif %}
END END

View File

@ -1,2 +1,2 @@
{% import 'macros/pga_schedule.macros' as SCHEDULE %} {% import 'macros/pga_schedule.macros' as SCHEDULE %}
{{ SCHEDULE.PROPERTIES(jid, jscid) }} {{ SCHEDULE.PROPERTIES(jid, jscid, conn) }}

View File

@ -1,2 +1,2 @@
{% import 'macros/pga_jobstep.macros' as STEP %} {% import 'macros/pga_jobstep.macros' as STEP %}
{{ STEP.PROPERTIES(has_connstr, jid, jstid) }} {{ STEP.PROPERTIES(has_connstr, jid, jstid, conn) }}

View File

@ -11,19 +11,19 @@ SET {% if 'jobjclid' in data %}jobjclid={{ data.jobjclid|qtLiteral(conn) }}::int
WHERE jobid = {{ jid }}; WHERE jobid = {{ jid }};
{% endif %}{% if 'jsteps' in data %} {% endif %}{% if 'jsteps' in data %}
{% if 'deleted' in data.jsteps %}{% for step in data.jsteps.deleted %}{{ STEP.DELETE(jid, step.jstid) }}{% endfor %}{% endif %} {% if 'deleted' in data.jsteps %}{% for step in data.jsteps.deleted %}{{ STEP.DELETE(jid, step.jstid, conn) }}{% endfor %}{% endif %}
{% if 'changed' in data.jsteps %}{% for step in data.jsteps.changed %}{{ STEP.UPDATE(has_connstr, jid, step.jstid, step) }}{% endfor %}{% endif %} {% if 'changed' in data.jsteps %}{% for step in data.jsteps.changed %}{{ STEP.UPDATE(has_connstr, jid, step.jstid, step, conn) }}{% endfor %}{% endif %}
{% if 'added' in data.jsteps %}{% for step in data.jsteps.added %}{{ STEP.INSERT(has_connstr, jid, step) }}{% endfor %}{% endif %}{% endif %}{% if 'jschedules' in data %} {% if 'added' in data.jsteps %}{% for step in data.jsteps.added %}{{ STEP.INSERT(has_connstr, jid, step, conn) }}{% endfor %}{% endif %}{% endif %}{% if 'jschedules' in data %}
{% if 'deleted' in data.jschedules %}{% for schedule in data.jschedules.deleted %}{{ SCHEDULE.DELETE(jid, schedule.jscid) }}{% endfor %}{% endif %} {% if 'deleted' in data.jschedules %}{% for schedule in data.jschedules.deleted %}{{ SCHEDULE.DELETE(jid, schedule.jscid, conn) }}{% endfor %}{% endif %}
{% if 'changed' in data.jschedules %}{% for schedule in data.jschedules.changed %}{{ SCHEDULE.UPDATE(jid, schedule.jscid, schedule) }}{% endfor %}{% endif %} {% if 'changed' in data.jschedules %}{% for schedule in data.jschedules.changed %}{{ SCHEDULE.UPDATE(jid, schedule.jscid, schedule, conn) }}{% endfor %}{% endif %}
{% if 'added' in data.jschedules %} {% if 'added' in data.jschedules %}
DO $$ DO $$
DECLARE DECLARE
scid integer; scid integer;
BEGIN BEGIN
{% for schedule in data.jschedules.added %}{{ SCHEDULE.INSERT(jid, schedule) }}{% endfor %} {% for schedule in data.jschedules.added %}{{ SCHEDULE.INSERT(jid, schedule, conn) }}{% endfor %}
END END
$$; $$;
{% endif %} {% endif %}

View File

@ -1,2 +1,2 @@
{% import 'macros/pga_jobstep.macros' as STEP %} {% import 'macros/pga_jobstep.macros' as STEP %}
{{ STEP.INSERT(has_connstr, jid, data) }} {{ STEP.INSERT(has_connstr, jid, data, conn) }}

View File

@ -1,2 +1,2 @@
{% import 'macros/pga_jobstep.macros' as STEP %} {% import 'macros/pga_jobstep.macros' as STEP %}
{{ STEP.DELETE(jid, jstid) }} {{ STEP.DELETE(jid, jstid, conn) }}

View File

@ -1,2 +1,2 @@
{% import 'macros/pga_jobstep.macros' as STEP %} {% import 'macros/pga_jobstep.macros' as STEP %}
{{ STEP.PROPERTIES(has_connstr, jid, jstid) }} {{ STEP.PROPERTIES(has_connstr, jid, jstid, conn) }}

View File

@ -1,2 +1,2 @@
{% import 'macros/pga_jobstep.macros' as STEP %} {% import 'macros/pga_jobstep.macros' as STEP %}
{{ STEP.UPDATE(has_connstr, jid, jstid, data) }} {{ STEP.UPDATE(has_connstr, jid, jstid, data, conn) }}

View File

@ -3,7 +3,7 @@ DO $$
DECLARE DECLARE
scid integer; scid integer;
BEGIN BEGIN
{{ SCHEDULE.INSERT(jid, data) }} {{ SCHEDULE.INSERT(jid, data, conn) }}
END END
$$;{% if fetch_id %} $$;{% if fetch_id %}

View File

@ -1,2 +1,2 @@
{% import 'macros/pga_schedule.macros' as SCHEDULE %} {% import 'macros/pga_schedule.macros' as SCHEDULE %}
{{ SCHEDULE.DELETE(jid, jscid) }} {{ SCHEDULE.DELETE(jid, jscid, conn) }}

View File

@ -1,2 +1,2 @@
{% import 'macros/pga_schedule.macros' as SCHEDULE %} {% import 'macros/pga_schedule.macros' as SCHEDULE %}
{{ SCHEDULE.PROPERTIES(jid, jscid) }} {{ SCHEDULE.PROPERTIES(jid, jscid, conn) }}

View File

@ -1,2 +1,2 @@
{% import 'macros/pga_schedule.macros' as SCHEDULE %} {% import 'macros/pga_schedule.macros' as SCHEDULE %}
{{ SCHEDULE.UPDATE(jid, jscid, data) }} {{ SCHEDULE.UPDATE(jid, jscid, data, conn) }}