wc_transaction_query()
Run a MySQL transaction query, if supported.
No Hooks.
Return
null
. Nothing (null).
Usage
wc_transaction_query( $type, $force );
- $type(string)
- Types: start (default), commit, rollback.
Default: 'start' - $force(true|false)
- use of transactions.
Default: false
Changelog
Since 2.5.0 | Introduced. |
wc_transaction_query() wc transaction query code WC 9.3.1
function wc_transaction_query( $type = 'start', $force = false ) { global $wpdb; $wpdb->hide_errors(); wc_maybe_define_constant( 'WC_USE_TRANSACTIONS', true ); if ( Constants::is_true( 'WC_USE_TRANSACTIONS' ) || $force ) { switch ( $type ) { case 'commit': $wpdb->query( 'COMMIT' ); break; case 'rollback': $wpdb->query( 'ROLLBACK' ); break; default: $wpdb->query( 'START TRANSACTION' ); break; } } }