5use InvalidArgumentException;
55 } elseif ( is_array(
$conn ) && count(
$conn ) >= 4 &&
$conn[self::FLD_DOMAIN] !==
false ) {
56 $this->params =
$conn;
58 throw new InvalidArgumentException(
"Missing lazy connection arguments." );
62 public function __call( $name, array $arguments ) {
63 if ( $this->conn ===
null ) {
65 $this->conn = $this->lb->getConnection( $index, $groups, $wiki, $flags );
68 return $this->conn->$name( ...$arguments );
80 return $this->
__call( __FUNCTION__, func_get_args() );
84 return $this->
__call( __FUNCTION__, func_get_args() );
88 return $this->
__call( __FUNCTION__, func_get_args() );
92 return $this->
__call( __FUNCTION__, func_get_args() );
96 return $this->
__call( __FUNCTION__, func_get_args() );
100 return $this->
__call( __FUNCTION__, func_get_args() );
104 return $this->
__call( __FUNCTION__, func_get_args() );
108 if ( $this->conn ===
null && $prefix ===
null ) {
111 return $domain->getTablePrefix();
112 } elseif ( $this->conn !==
null && $prefix ===
null ) {
114 return $this->
__call( __FUNCTION__, func_get_args() );
121 if ( $this->conn ===
null && $schema ===
null ) {
124 return $domain->getSchema();
125 } elseif ( $this->conn !==
null && $schema ===
null ) {
127 return $this->
__call( __FUNCTION__, func_get_args() );
134 return $this->
__call( __FUNCTION__, func_get_args() );
137 public function setLBInfo( $nameOrArray, $value =
null ) {
143 return $this->
__call( __FUNCTION__, func_get_args() );
147 return $this->
__call( __FUNCTION__, func_get_args() );
151 return $this->
__call( __FUNCTION__, func_get_args() );
155 return $this->
__call( __FUNCTION__, func_get_args() );
159 return $this->
__call( __FUNCTION__, func_get_args() );
163 return $this->
__call( __FUNCTION__, func_get_args() );
167 return $this->
__call( __FUNCTION__, func_get_args() );
171 return $this->
__call( __FUNCTION__, func_get_args() );
175 return $this->
__call( __FUNCTION__, func_get_args() );
179 return $this->
__call( __FUNCTION__, func_get_args() );
182 public function setFlag( $flag, $remember = self::REMEMBER_NOTHING ) {
183 return $this->
__call( __FUNCTION__, func_get_args() );
186 public function clearFlag( $flag, $remember = self::REMEMBER_NOTHING ) {
187 return $this->
__call( __FUNCTION__, func_get_args() );
191 return $this->
__call( __FUNCTION__, func_get_args() );
195 return $this->
__call( __FUNCTION__, func_get_args() );
199 return $this->
__call( __FUNCTION__, func_get_args() );
203 if ( $this->conn ===
null ) {
209 return $this->
__call( __FUNCTION__, func_get_args() );
213 if ( $this->conn ===
null ) {
216 $index = $this->lb->getWriterIndex();
222 return $this->lb->getServerType( $index );
226 return $this->
__call( __FUNCTION__, func_get_args() );
230 return $this->
__call( __FUNCTION__, func_get_args() );
234 return $this->
__call( __FUNCTION__, func_get_args() );
238 return $this->
__call( __FUNCTION__, func_get_args() );
242 return $this->
__call( __FUNCTION__, func_get_args() );
246 return $this->
__call( __FUNCTION__, func_get_args() );
250 return $this->
__call( __FUNCTION__, func_get_args() );
254 return $this->
__call( __FUNCTION__, func_get_args() );
258 return $this->
__call( __FUNCTION__, func_get_args() );
262 return $this->
__call( __FUNCTION__, func_get_args() );
266 return $this->
__call( __FUNCTION__, func_get_args() );
270 return $this->
__call( __FUNCTION__, func_get_args() );
274 return $this->
__call( __FUNCTION__, func_get_args() );
277 public function close( $fname = __METHOD__, $owner =
null ) {
281 public function query( $sql, $fname = __METHOD__, $flags = 0 ) {
283 $flags |= IDatabase::QUERY_REPLICA_ROLE;
286 return $this->
__call( __FUNCTION__, [ $sql, $fname, $flags ] );
290 return $this->
__call( __FUNCTION__, func_get_args() );
294 return $this->
__call( __FUNCTION__, func_get_args() );
298 $table, $var, $cond =
'', $fname = __METHOD__, $options = [], $join_conds = []
300 return $this->
__call( __FUNCTION__, func_get_args() );
304 $table, $var, $cond =
'', $fname = __METHOD__, $options = [], $join_conds = []
306 return $this->
__call( __FUNCTION__, func_get_args() );
310 $table, $vars, $conds =
'', $fname = __METHOD__,
311 $options = [], $join_conds = []
313 return $this->
__call( __FUNCTION__, func_get_args() );
317 $table, $vars, $conds =
'', $fname = __METHOD__,
318 $options = [], $join_conds = []
320 return $this->
__call( __FUNCTION__, func_get_args() );
324 return $this->
__call( __FUNCTION__, func_get_args() );
328 $table, $vars, $conds, $fname = __METHOD__,
329 $options = [], $join_conds = []
331 return $this->
__call( __FUNCTION__, func_get_args() );
335 $tables, $vars =
'*', $conds =
'', $fname = __METHOD__, $options = [], $join_conds = []
337 return $this->
__call( __FUNCTION__, func_get_args() );
341 $tables, $vars =
'*', $conds =
'', $fname = __METHOD__, $options = [], $join_conds = []
343 return $this->
__call( __FUNCTION__, func_get_args() );
347 $table, $conds =
'', $fname = __METHOD__, $options = [], $join_conds = []
351 return $this->
__call( __FUNCTION__, func_get_args() );
354 public function fieldExists( $table, $field, $fname = __METHOD__ ) {
355 return $this->
__call( __FUNCTION__, func_get_args() );
358 public function indexExists( $table, $index, $fname = __METHOD__ ) {
359 return $this->
__call( __FUNCTION__, func_get_args() );
363 return $this->
__call( __FUNCTION__, func_get_args() );
366 public function insert( $table, $rows, $fname = __METHOD__, $options = [] ) {
369 return $this->
__call( __FUNCTION__, func_get_args() );
372 public function update( $table, $set, $conds, $fname = __METHOD__, $options = [] ) {
375 return $this->
__call( __FUNCTION__, func_get_args() );
378 public function makeList( array $a, $mode = self::LIST_COMMA ) {
379 return $this->
__call( __FUNCTION__, func_get_args() );
383 return $this->
__call( __FUNCTION__, func_get_args() );
387 return $this->
__call( __FUNCTION__, func_get_args() );
391 return $this->
__call( __FUNCTION__, func_get_args() );
394 public function bitAnd( $fieldLeft, $fieldRight ) {
395 return $this->
__call( __FUNCTION__, func_get_args() );
398 public function bitOr( $fieldLeft, $fieldRight ) {
399 return $this->
__call( __FUNCTION__, func_get_args() );
403 return $this->
__call( __FUNCTION__, func_get_args() );
407 $delim, $table, $field, $conds =
'', $join_conds = []
409 return $this->
__call( __FUNCTION__, func_get_args() );
413 return $this->
__call( __FUNCTION__, func_get_args() );
417 return $this->
__call( __FUNCTION__, func_get_args() );
421 return $this->
__call( __FUNCTION__, func_get_args() );
425 return $this->
__call( __FUNCTION__, func_get_args() );
429 return $this->
__call( __FUNCTION__, func_get_args() );
433 $table, $vars, $conds =
'', $fname = __METHOD__,
434 $options = [], $join_conds = []
436 return $this->
__call( __FUNCTION__, func_get_args() );
440 return $this->
__call( __FUNCTION__, func_get_args() );
454 if ( $this->conn ===
null ) {
457 return $domain->getDatabase();
460 return $this->
__call( __FUNCTION__, func_get_args() );
464 return $this->
__call( __FUNCTION__, func_get_args() );
468 return $this->
__call( __FUNCTION__, func_get_args() );
472 return $this->
__call( __FUNCTION__, func_get_args() );
476 return $this->
__call( __FUNCTION__, func_get_args() );
480 return $this->
__call( __FUNCTION__, func_get_args() );
484 return $this->
__call( __FUNCTION__, func_get_args() );
490 return $this->
__call( __FUNCTION__, func_get_args() );
493 public function replace( $table, $uniqueKeys, $rows, $fname = __METHOD__ ) {
496 return $this->
__call( __FUNCTION__, func_get_args() );
500 $table, array $rows, $uniqueKeys, array $set, $fname = __METHOD__
504 return $this->
__call( __FUNCTION__, func_get_args() );
508 $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = __METHOD__
512 return $this->
__call( __FUNCTION__, func_get_args() );
515 public function delete( $table, $conds, $fname = __METHOD__ ) {
518 return $this->
__call( __FUNCTION__, func_get_args() );
522 $destTable, $srcTable, $varMap, $conds,
523 $fname = __METHOD__, $insertOptions = [], $selectOptions = [], $selectJoinConds = []
527 return $this->
__call( __FUNCTION__, func_get_args() );
531 return $this->
__call( __FUNCTION__, func_get_args() );
535 return $this->
__call( __FUNCTION__, func_get_args() );
539 $table, $vars, array $permute_conds, $extra_conds =
'', $fname = __METHOD__,
540 $options = [], $join_conds = []
542 return $this->
__call( __FUNCTION__, func_get_args() );
546 return $this->
__call( __FUNCTION__, func_get_args() );
550 return $this->
__call( __FUNCTION__, func_get_args() );
554 return $this->
__call( __FUNCTION__, func_get_args() );
558 return $this->
__call( __FUNCTION__, func_get_args() );
562 return $this->
__call( __FUNCTION__, func_get_args() );
566 return $this->
__call( __FUNCTION__, func_get_args() );
570 return $this->
__call( __FUNCTION__, func_get_args() );
574 return $this->
__call( __FUNCTION__, func_get_args() );
578 return $this->
__call( __FUNCTION__, func_get_args() );
582 return $this->
__call( __FUNCTION__, func_get_args() );
586 return $this->
__call( __FUNCTION__, func_get_args() );
590 return $this->
__call( __FUNCTION__, func_get_args() );
595 return $this->
__call( __FUNCTION__, func_get_args() );
600 return $this->
__call( __FUNCTION__, func_get_args() );
609 return $this->
__call( __FUNCTION__, func_get_args() );
613 return $this->
__call( __FUNCTION__, func_get_args() );
617 return $this->
__call( __FUNCTION__, func_get_args() );
621 $fname = __METHOD__, $cancelable = IDatabase::ATOMIC_NOT_CANCELABLE
624 return $this->
__call( __FUNCTION__, func_get_args() );
629 return $this->
__call( __FUNCTION__, func_get_args() );
634 return $this->
__call( __FUNCTION__, func_get_args() );
638 $fname, callable $callback, $cancelable = self::ATOMIC_NOT_CANCELABLE
641 return $this->
__call( __FUNCTION__, func_get_args() );
644 public function begin( $fname = __METHOD__, $mode = IDatabase::TRANSACTION_EXPLICIT ) {
645 return $this->
__call( __FUNCTION__, func_get_args() );
648 public function commit( $fname = __METHOD__, $flush = self::FLUSHING_ONE ) {
649 return $this->
__call( __FUNCTION__, func_get_args() );
652 public function rollback( $fname = __METHOD__, $flush = self::FLUSHING_ONE ) {
653 return $this->
__call( __FUNCTION__, func_get_args() );
656 public function flushSnapshot( $fname = __METHOD__, $flush = self::FLUSHING_ONE ) {
657 return $this->
__call( __FUNCTION__, func_get_args() );
661 return $this->
__call( __FUNCTION__, func_get_args() );
665 return $this->
__call( __FUNCTION__, func_get_args() );
668 public function ping( &$rtt =
null ) {
669 return func_num_args()
670 ? $this->
__call( __FUNCTION__, [ &$rtt ] )
671 : $this->
__call( __FUNCTION__, [] );
675 return $this->
__call( __FUNCTION__, func_get_args() );
679 return $this->
__call( __FUNCTION__, func_get_args() );
683 return $this->
__call( __FUNCTION__, func_get_args() );
687 return $this->
__call( __FUNCTION__, func_get_args() );
691 return $this->
__call( __FUNCTION__, func_get_args() );
695 return $this->
__call( __FUNCTION__, func_get_args() );
699 return $this->
__call( __FUNCTION__, func_get_args() );
705 return $this->
__call( __FUNCTION__, func_get_args() );
708 public function lock( $lockName, $method, $timeout = 5 ) {
711 return $this->
__call( __FUNCTION__, func_get_args() );
714 public function unlock( $lockName, $method ) {
717 return $this->
__call( __FUNCTION__, func_get_args() );
723 return $this->
__call( __FUNCTION__, func_get_args() );
727 return $this->
__call( __FUNCTION__, func_get_args() );
731 return $this->
__call( __FUNCTION__, func_get_args() );
735 return $this->
__call( __FUNCTION__, func_get_args() );
739 return $this->
__call( __FUNCTION__, func_get_args() );
743 return $this->
__call( __FUNCTION__, func_get_args() );
747 return $this->
__call( __FUNCTION__, func_get_args() );
751 return $this->
__call( __FUNCTION__, func_get_args() );
755 return $this->
__call( __FUNCTION__, func_get_args() );
759 if ( $this->conn ===
null ) {
760 return $this->
getType() .
' object #' . spl_object_id( $this );
763 return $this->
__call( __FUNCTION__, func_get_args() );
792 "Cannot directly change the selected DB domain; any underlying connection handle " .
793 "is owned by a LoadBalancer instance and possibly shared with other callers. " .
794 "LoadBalancer automatically manages DB domain re-selection of unused handles."
803 $this->lb->reuseConnection( $this->conn );
812class_alias( DBConnRef::class,
'DBConnRef' );
Class to handle database/schema/prefix specifications for IDatabase.
static newFromId( $domain)