wiki.techinc.nl/includes/libs/rdbms/database/MaintainableDBConnRef.php
Aaron Schulz 9906c80f5d rdbms: fix reference variables in MaintainableDBConnRef::streamStatementEnd()
This fixes a bug in sql.php where extra semicolons kept getting
added to the command history

Change-Id: I856d6ef5f62c8b95ab5f52f998e325c3e32756d6
2021-03-25 17:48:12 -07:00

120 lines
3.1 KiB
PHP

<?php
namespace Wikimedia\Rdbms;
/**
* Helper class to handle automatically marking connections as reusable (via RAII pattern)
* as well handling deferring the actual network connection until the handle is used
*
* @note: proxy methods are defined explicity to avoid interface errors
* @ingroup Database
* @since 1.29
*/
class MaintainableDBConnRef extends DBConnRef implements IMaintainableDatabase {
public function tableName( $name, $format = 'quoted' ) {
return $this->__call( __FUNCTION__, func_get_args() );
}
public function tableNames( ...$tables ) {
return $this->__call( __FUNCTION__, func_get_args() );
}
public function tableNamesN( ...$tables ) {
return $this->__call( __FUNCTION__, func_get_args() );
}
public function sourceFile(
$filename,
callable $lineCallback = null,
callable $resultCallback = null,
$fname = false,
callable $inputCallback = null
) {
$this->assertRoleAllowsWrites();
return $this->__call( __FUNCTION__, func_get_args() );
}
public function sourceStream(
$fp,
callable $lineCallback = null,
callable $resultCallback = null,
$fname = __METHOD__,
callable $inputCallback = null
) {
$this->assertRoleAllowsWrites();
return $this->__call( __FUNCTION__, func_get_args() );
}
public function dropTable( $table, $fname = __METHOD__ ) {
$this->assertRoleAllowsWrites();
return $this->__call( __FUNCTION__, func_get_args() );
}
public function truncate( $tables, $fname = __METHOD__ ) {
$this->assertRoleAllowsWrites();
return $this->__call( __FUNCTION__, func_get_args() );
}
public function deadlockLoop( ...$args ) {
$this->assertRoleAllowsWrites();
return $this->__call( __FUNCTION__, func_get_args() );
}
public function listViews( $prefix = null, $fname = __METHOD__ ) {
return $this->__call( __FUNCTION__, func_get_args() );
}
public function textFieldSize( $table, $field ) {
return $this->__call( __FUNCTION__, func_get_args() );
}
public function streamStatementEnd( &$sql, &$newLine ) {
return $this->__call( __FUNCTION__, [ &$sql, &$newLine ] );
}
public function duplicateTableStructure(
$oldName, $newName, $temporary = false, $fname = __METHOD__
) {
$this->assertRoleAllowsWrites();
return $this->__call( __FUNCTION__, func_get_args() );
}
public function tableLocksHaveTransactionScope() {
return $this->__call( __FUNCTION__, func_get_args() );
}
public function lockTables( array $read, array $write, $method ) {
$this->assertRoleAllowsWrites();
return $this->__call( __FUNCTION__, func_get_args() );
}
public function unlockTables( $method ) {
$this->assertRoleAllowsWrites();
return $this->__call( __FUNCTION__, func_get_args() );
}
public function indexUnique( $table, $index, $fname = __METHOD__ ) {
return $this->__call( __FUNCTION__, func_get_args() );
}
public function listTables( $prefix = null, $fname = __METHOD__ ) {
return $this->__call( __FUNCTION__, func_get_args() );
}
public function fieldInfo( $table, $field ) {
return $this->__call( __FUNCTION__, func_get_args() );
}
}
/**
* @deprecated since 1.33
*/
class_alias( MaintainableDBConnRef::class, 'MaintainableDBConnRef' );