| @@ 2401-2418 (lines=18) @@ | ||
| 2398 | return $ok; |
|
| 2399 | } |
|
| 2400 | ||
| 2401 | public function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, |
|
| 2402 | $fname = __METHOD__ |
|
| 2403 | ) { |
|
| 2404 | if ( !$conds ) { |
|
| 2405 | throw new DBUnexpectedError( $this, |
|
| 2406 | 'DatabaseBase::deleteJoin() called with empty $conds' ); |
|
| 2407 | } |
|
| 2408 | ||
| 2409 | $delTable = $this->tableName( $delTable ); |
|
| 2410 | $joinTable = $this->tableName( $joinTable ); |
|
| 2411 | $sql = "DELETE FROM $delTable WHERE $delVar IN (SELECT $joinVar FROM $joinTable "; |
|
| 2412 | if ( $conds != '*' ) { |
|
| 2413 | $sql .= 'WHERE ' . $this->makeList( $conds, LIST_AND ); |
|
| 2414 | } |
|
| 2415 | $sql .= ')'; |
|
| 2416 | ||
| 2417 | $this->query( $sql, $fname ); |
|
| 2418 | } |
|
| 2419 | ||
| 2420 | /** |
|
| 2421 | * Returns the size of a text field, or -1 for "unlimited" |
|
| @@ 1099-1113 (lines=15) @@ | ||
| 1096 | * @throws DBUnexpectedError |
|
| 1097 | * @return bool|ResultWrapper |
|
| 1098 | */ |
|
| 1099 | function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = __METHOD__ ) { |
|
| 1100 | if ( !$conds ) { |
|
| 1101 | throw new DBUnexpectedError( $this, 'DatabaseBase::deleteJoin() called with empty $conds' ); |
|
| 1102 | } |
|
| 1103 | ||
| 1104 | $delTable = $this->tableName( $delTable ); |
|
| 1105 | $joinTable = $this->tableName( $joinTable ); |
|
| 1106 | $sql = "DELETE $delTable FROM $delTable, $joinTable WHERE $delVar=$joinVar "; |
|
| 1107 | ||
| 1108 | if ( $conds != '*' ) { |
|
| 1109 | $sql .= ' AND ' . $this->makeList( $conds, LIST_AND ); |
|
| 1110 | } |
|
| 1111 | ||
| 1112 | return $this->query( $sql, $fname ); |
|
| 1113 | } |
|
| 1114 | ||
| 1115 | /** |
|
| 1116 | * @param string $table |
|