acs_messaging_send_query (public)

 acs_messaging_send_query -message_id message_id -query query \
    [ -bind bind ]

Defined in packages/acs-messaging/tcl/acs-messaging-procs.tcl

Given an SQL query returning columns recipient_id, grouping_id, and wait_until, arrange for all to be sent for this message. Example: acs_message_send_query -message_id $new_message -query { select subscriber_id as recipient_id, forum_id as grouping_id, bboard_util.next_period(period) as wait_until from bboard_forum_subscribers where forum_id = :forum_id } -bind [list forum_id $forum_id] Assuming bboard_util.next_period(period) returns the next date at which a digest should be sent, the above will enter info to send all subscriptions for a single message. The bind argument, if given, must be a list, NOT an ns_set.

Switches:
-message_id (required)
-query (required)
-bind (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 db_dml db_dml (public) acs_messaging_send_query acs_messaging_send_query acs_messaging_send_query->db_dml

Testcases:
No testcase defined.
Source code:
    # Makes sure not to insert values that are already there--silent "failure"
    # because it's really a vacuous success.
    db_dml insert_messaging_by_query "
        insert into acs_messages_outgoing
            (message_id, to_address, grouping_id, wait_until)
        select :m__message_id, p.email, q.grouping_id,
               nvl(q.wait_until, SYSDATE) as wait_until
            from ($query) q, parties p
            where not exists (select 1 from acs_messages_outgoing o
                                  where o.message_id = :m__message_id
                                    and p.email = o.to_address)
              and p.party_id = q.recipient_id
    " -bind [concat $bind [list m__message_id $message_id]]
Generic XQL file:
<fullquery name="acs_messaging_send_query.insert_messaging_by_query">
    <querytext>
      
        insert into acs_messages_outgoing
            (message_id, to_address, grouping_id, wait_until)
        select :m__message_id, p.email, q.grouping_id,
               coalesce(q.wait_until, current_timestamp) as wait_until
            from ($query) q, parties p
            where not exists (select 1 from acs_messages_outgoing o
                                  where o.message_id = :m__message_id
                                    and p.email = o.to_address)
              and p.party_id = q.recipient_id
    
      </querytext>
</fullquery>
packages/acs-messaging/tcl/acs-messaging-procs.xql

PostgreSQL XQL file:
packages/acs-messaging/tcl/acs-messaging-procs-postgresql.xql

Oracle XQL file:
packages/acs-messaging/tcl/acs-messaging-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: