db_transaction From Online Manual

Revision as of 19:30, 25 July 2011 by Emanuele (talk | contribs) (Created page with "{{smcfunc |function=db_transaction |usage=$smcFunc['db_transaction'] (type, connection) |description=Same as calling queries for "BEGIN", "ROLLBACK", and "COMMIT". |parameters={{...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Usage:

$smcFunc['db_transaction'] (type, connection)


Description: Same as calling queries for "BEGIN", "ROLLBACK", and "COMMIT".

Parameters:

  • type A string defining the type of transaction. It can be one of the following: begin, rollback or commit. Default is commit.
  • connection the database connection.

Return: true on success, false on error.

Example:

$smcFunc['db_transaction']('begin');

// Do the table and indexes...
$smcFunc['db_query']('', $table_query,
	array(
		'security_override' => true,
	)
);
foreach ($index_queries as $query)
	$smcFunc['db_query']('', $query,
	array(
		'security_override' => true,
	)
);

$smcFunc['db_transaction']('commit');



Advertisement: