# _CP_trans

_CP_trans is equivalent to one of several
BASIC transaction processing statements depending on the op parameter.
Valid values of op are:

| _CP_TRANS_ONOFF | Equivalent to the BASIC transaction on/off statement. Pass in the on/off parameter in exp, and _CP_str_null in str. |
| --- | --- |
| _CP_TRANS_START | Equivalent to the BASIC begin work {str} statement. If no transaction name is desired, then pass 0 in exp and _CP_str_null in str. If a transaction name is desired, then pass 1 in exp and the desired name in str. |
| _CP_TRANS_COMMIT | Equivalent to the BASIC commit work statement. Pass 0 in exp and _CP_str_null in str. |
| _CP_TRANS_ROLLBACK | Equivalent to the BASIC rollback work statement. A 0 must be passed in exp and _CP_str_null in str. |
| _CP_CACHE | Equivalent to the BASIC transaction cache on/off statement. Pass in the on/off parameter in exp, and _CP_str_null in str. |
| _CP_FLUSH | Equivalent to the BASIC transaction flush on/off statement. Pass in the on/off parameter in exp, and _CP_str_null in str. |

## Syntax

```
int _CP_trans(int op, int exp, CPSTR * str)
```

## Description

This function returns -1 if
an error occurs. The error code is contained in _CP_errno and is always PE_ACCESS.

## See also

- [begin work statement](https://d3codex.com/pickbasic-flashbasic/begin-work-statement/)
- [commit work statement](https://d3codex.com/pickbasic-flashbasic/commit-work-statement/)
- [C functions overview](https://d3codex.com/cfunctions/c-functions-overview/)
- [rollback work statement](https://d3codex.com/pickbasic-flashbasic/rollback-work-statement/)
- [transaction statement](https://d3codex.com/pickbasic-flashbasic/transaction-statement/)

---
Source: https://d3codex.com/cfunctions/cp-trans/ - part of the D3Codex reference.
