Function d_trbegin is called to mark the beginning of a new database transaction. All database changes made between the call to d_trbegin and a subsequent call to d_trend are grouped as a transaction and written to the database as unit by function d_trend. Any read locks which were active before the call to d_trbegin remain active after the call.
The transaction id, tid, is a string which identifies or names a transaction. The contents of this string is arbitrary. It is intended to be used to uniquely indentify each transaction and is to be generated by the program. It is passed to the archive logging functions by d_trend to mark specific transactions.
CURRENCY CHANGES None
RETURN CODES
-25 S_TRANSID Transaction id not specified or NULL.
-26 S_TRACTIVE Transaction already active. Transactions cannot be nested.
EXAMPLE
char tr_id[25]; /*transaction id string */ int tr_tot =0 ; /* total number of transactions */ .. sprintf (tr_id,"tr~%d:order entry",++tr_tot); d_trbegin(tr_id); .. /* enter customer info */ .. /* enter order info */ .. /* check invetory */ if (items_requested > items_ available) { d_trabort(); .. /* inform user */ } else { .. /* complete update */ d_trend(); }