Code Duplication    Length = 20-22 lines in 8 locations

web_interface/astpp/system/database/drivers/mysqli/mysqli_driver.php 1 location

@@ 217-238 (lines=22) @@
214
	 * @access	public
215
	 * @return	bool
216
	 */
217
	function trans_begin($test_mode = FALSE)
218
	{
219
		if ( ! $this->trans_enabled)
220
		{
221
			return TRUE;
222
		}
223
224
		// When transactions are nested we only begin/commit/rollback the outermost ones
225
		if ($this->_trans_depth > 0)
226
		{
227
			return TRUE;
228
		}
229
230
		// Reset the transaction failure flag.
231
		// If the $test_mode flag is set to TRUE transactions will be rolled back
232
		// even if the queries produce a successful result.
233
		$this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
234
235
		$this->simple_query('SET AUTOCOMMIT=0');
236
		$this->simple_query('START TRANSACTION'); // can also be BEGIN or BEGIN WORK
237
		return TRUE;
238
	}
239
240
	// --------------------------------------------------------------------
241

web_interface/astpp/system/database/drivers/mssql/mssql_driver.php 1 location

@@ 172-192 (lines=21) @@
169
	 * @access	public
170
	 * @return	bool
171
	 */
172
	function trans_begin($test_mode = FALSE)
173
	{
174
		if ( ! $this->trans_enabled)
175
		{
176
			return TRUE;
177
		}
178
179
		// When transactions are nested we only begin/commit/rollback the outermost ones
180
		if ($this->_trans_depth > 0)
181
		{
182
			return TRUE;
183
		}
184
185
		// Reset the transaction failure flag.
186
		// If the $test_mode flag is set to TRUE transactions will be rolled back
187
		// even if the queries produce a successful result.
188
		$this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
189
190
		$this->simple_query('BEGIN TRAN');
191
		return TRUE;
192
	}
193
194
	// --------------------------------------------------------------------
195

web_interface/astpp/system/database/drivers/mysql/mysql_driver.php 1 location

@@ 217-238 (lines=22) @@
214
	 * @access	public
215
	 * @return	bool
216
	 */
217
	function trans_begin($test_mode = FALSE)
218
	{
219
		if ( ! $this->trans_enabled)
220
		{
221
			return TRUE;
222
		}
223
224
		// When transactions are nested we only begin/commit/rollback the outermost ones
225
		if ($this->_trans_depth > 0)
226
		{
227
			return TRUE;
228
		}
229
230
		// Reset the transaction failure flag.
231
		// If the $test_mode flag is set to TRUE transactions will be rolled back
232
		// even if the queries produce a successful result.
233
		$this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
234
235
		$this->simple_query('SET AUTOCOMMIT=0');
236
		$this->simple_query('START TRANSACTION'); // can also be BEGIN or BEGIN WORK
237
		return TRUE;
238
	}
239
240
	// --------------------------------------------------------------------
241

web_interface/astpp/system/database/drivers/oci8/oci8_driver.php 1 location

@@ 312-332 (lines=21) @@
309
	 * @access	public
310
	 * @return	bool
311
	 */
312
	public function trans_begin($test_mode = FALSE)
313
	{
314
		if ( ! $this->trans_enabled)
315
		{
316
			return TRUE;
317
		}
318
319
		// When transactions are nested we only begin/commit/rollback the outermost ones
320
		if ($this->_trans_depth > 0)
321
		{
322
			return TRUE;
323
		}
324
325
		// Reset the transaction failure flag.
326
		// If the $test_mode flag is set to TRUE transactions will be rolled back
327
		// even if the queries produce a successful result.
328
		$this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
329
330
		$this->_commit = OCI_DEFAULT;
331
		return TRUE;
332
	}
333
334
	// --------------------------------------------------------------------
335

web_interface/astpp/system/database/drivers/odbc/odbc_driver.php 1 location

@@ 182-201 (lines=20) @@
179
	 * @access	public
180
	 * @return	bool
181
	 */
182
	function trans_begin($test_mode = FALSE)
183
	{
184
		if ( ! $this->trans_enabled)
185
		{
186
			return TRUE;
187
		}
188
189
		// When transactions are nested we only begin/commit/rollback the outermost ones
190
		if ($this->_trans_depth > 0)
191
		{
192
			return TRUE;
193
		}
194
195
		// Reset the transaction failure flag.
196
		// If the $test_mode flag is set to TRUE transactions will be rolled back
197
		// even if the queries produce a successful result.
198
		$this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
199
200
		return odbc_autocommit($this->conn_id, FALSE);
201
	}
202
203
	// --------------------------------------------------------------------
204

web_interface/astpp/system/database/drivers/postgre/postgre_driver.php 1 location

@@ 205-224 (lines=20) @@
202
	 * @access	public
203
	 * @return	bool
204
	 */
205
	function trans_begin($test_mode = FALSE)
206
	{
207
		if ( ! $this->trans_enabled)
208
		{
209
			return TRUE;
210
		}
211
212
		// When transactions are nested we only begin/commit/rollback the outermost ones
213
		if ($this->_trans_depth > 0)
214
		{
215
			return TRUE;
216
		}
217
218
		// Reset the transaction failure flag.
219
		// If the $test_mode flag is set to TRUE transactions will be rolled back
220
		// even if the queries produce a successful result.
221
		$this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
222
223
		return @pg_exec($this->conn_id, "begin");
224
	}
225
226
	// --------------------------------------------------------------------
227

web_interface/astpp/system/database/drivers/sqlite/sqlite_driver.php 1 location

@@ 199-219 (lines=21) @@
196
	 * @access	public
197
	 * @return	bool
198
	 */
199
	function trans_begin($test_mode = FALSE)
200
	{
201
		if ( ! $this->trans_enabled)
202
		{
203
			return TRUE;
204
		}
205
206
		// When transactions are nested we only begin/commit/rollback the outermost ones
207
		if ($this->_trans_depth > 0)
208
		{
209
			return TRUE;
210
		}
211
212
		// Reset the transaction failure flag.
213
		// If the $test_mode flag is set to TRUE transactions will be rolled back
214
		// even if the queries produce a successful result.
215
		$this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
216
217
		$this->simple_query('BEGIN TRANSACTION');
218
		return TRUE;
219
	}
220
221
	// --------------------------------------------------------------------
222

web_interface/astpp/system/database/drivers/sqlsrv/sqlsrv_driver.php 1 location

@@ 182-201 (lines=20) @@
179
	 * @access	public
180
	 * @return	bool
181
	 */
182
	function trans_begin($test_mode = FALSE)
183
	{
184
		if ( ! $this->trans_enabled)
185
		{
186
			return TRUE;
187
		}
188
189
		// When transactions are nested we only begin/commit/rollback the outermost ones
190
		if ($this->_trans_depth > 0)
191
		{
192
			return TRUE;
193
		}
194
195
		// Reset the transaction failure flag.
196
		// If the $test_mode flag is set to TRUE transactions will be rolled back
197
		// even if the queries produce a successful result.
198
		$this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
199
200
		return sqlsrv_begin_transaction($this->conn_id);
201
	}
202
203
	// --------------------------------------------------------------------
204