bulkmail_begin

one of the documented procedures in this installation of the ACS
Usage:
bulkmail_begin   db   user_id   { description "" }
What it does:
Initializes a new bulkmail instance. Returns a bulkmail_id.
Defined in: /web/philip/tcl/bulkmail-utils.tcl

Source code:


    ns_share bulkmail_instances_mutex
    ns_share bulkmail_instance_mutexes_mutex
    ns_share bulkmail_instances
    ns_share bulkmail_instance_mutexes

    ns_mutex lock $bulkmail_instances_mutex
    if { [catch {
	set bulkmail_id [database_to_tcl_string $db "select bulkmail_id_sequence.nextval from dual"]
	ns_db dml $db "insert into bulkmail_instances (bulkmail_id, creation_date, creation_user, description) values ($bulkmail_id, sysdate, $user_id, '[DoubleApos $description]')"
	
	ns_set put $bulkmail_instances $bulkmail_id [list 0 0]
    } errmsg] } {
	ns_log Notice "Error creating bulkmail instance: $errmsg"
    }
    ns_mutex unlock $bulkmail_instances_mutex

    ns_mutex lock $bulkmail_instance_mutexes_mutex
    if { [catch {
	ns_set put $bulkmail_instance_mutexes $bulkmail_id [ns_mutex create]
    } errmsg] } {
	ns_log Error "Error creating instance mutex: $errmsg\n"
    } 
    ns_mutex unlock $bulkmail_instance_mutexes_mutex
    
    return $bulkmail_id


philg@mit.edu