MaintainableDBConnRef.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. namespace Wikimedia\Rdbms;
  3. /**
  4. * Helper class to handle automatically marking connections as reusable (via RAII pattern)
  5. * as well handling deferring the actual network connection until the handle is used
  6. *
  7. * @note: proxy methods are defined explicity to avoid interface errors
  8. * @ingroup Database
  9. * @since 1.29
  10. */
  11. class MaintainableDBConnRef extends DBConnRef implements IMaintainableDatabase {
  12. public function tableName( $name, $format = 'quoted' ) {
  13. return $this->__call( __FUNCTION__, func_get_args() );
  14. }
  15. public function tableNames() {
  16. return $this->__call( __FUNCTION__, func_get_args() );
  17. }
  18. public function tableNamesN() {
  19. return $this->__call( __FUNCTION__, func_get_args() );
  20. }
  21. public function sourceFile(
  22. $filename,
  23. callable $lineCallback = null,
  24. callable $resultCallback = null,
  25. $fname = false,
  26. callable $inputCallback = null
  27. ) {
  28. $this->assertRoleAllowsWrites();
  29. return $this->__call( __FUNCTION__, func_get_args() );
  30. }
  31. public function sourceStream(
  32. $fp,
  33. callable $lineCallback = null,
  34. callable $resultCallback = null,
  35. $fname = __METHOD__,
  36. callable $inputCallback = null
  37. ) {
  38. $this->assertRoleAllowsWrites();
  39. return $this->__call( __FUNCTION__, func_get_args() );
  40. }
  41. public function dropTable( $tableName, $fName = __METHOD__ ) {
  42. $this->assertRoleAllowsWrites();
  43. return $this->__call( __FUNCTION__, func_get_args() );
  44. }
  45. public function deadlockLoop() {
  46. $this->assertRoleAllowsWrites();
  47. return $this->__call( __FUNCTION__, func_get_args() );
  48. }
  49. public function listViews( $prefix = null, $fname = __METHOD__ ) {
  50. return $this->__call( __FUNCTION__, func_get_args() );
  51. }
  52. public function textFieldSize( $table, $field ) {
  53. return $this->__call( __FUNCTION__, func_get_args() );
  54. }
  55. public function streamStatementEnd( &$sql, &$newLine ) {
  56. return $this->__call( __FUNCTION__, func_get_args() );
  57. }
  58. public function duplicateTableStructure(
  59. $oldName, $newName, $temporary = false, $fname = __METHOD__
  60. ) {
  61. $this->assertRoleAllowsWrites();
  62. return $this->__call( __FUNCTION__, func_get_args() );
  63. }
  64. public function tableLocksHaveTransactionScope() {
  65. return $this->__call( __FUNCTION__, func_get_args() );
  66. }
  67. public function lockTables( array $read, array $write, $method ) {
  68. $this->assertRoleAllowsWrites();
  69. return $this->__call( __FUNCTION__, func_get_args() );
  70. }
  71. public function unlockTables( $method ) {
  72. $this->assertRoleAllowsWrites();
  73. return $this->__call( __FUNCTION__, func_get_args() );
  74. }
  75. public function indexUnique( $table, $index ) {
  76. return $this->__call( __FUNCTION__, func_get_args() );
  77. }
  78. public function listTables( $prefix = null, $fname = __METHOD__ ) {
  79. return $this->__call( __FUNCTION__, func_get_args() );
  80. }
  81. public function fieldInfo( $table, $field ) {
  82. return $this->__call( __FUNCTION__, func_get_args() );
  83. }
  84. }
  85. /**
  86. * @deprecated since 1.33
  87. */
  88. class_alias( MaintainableDBConnRef::class, 'MaintainableDBConnRef' );