| @@ 1091-1105 (lines=15) @@ | ||
| 1088 | * @throws DBUnexpectedError |
|
| 1089 | * @return bool|ResultWrapper |
|
| 1090 | */ |
|
| 1091 | function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = __METHOD__ ) { |
|
| 1092 | if ( !$conds ) { |
|
| 1093 | throw new DBUnexpectedError( $this, 'DatabaseBase::deleteJoin() called with empty $conds' ); |
|
| 1094 | } |
|
| 1095 | ||
| 1096 | $delTable = $this->tableName( $delTable ); |
|
| 1097 | $joinTable = $this->tableName( $joinTable ); |
|
| 1098 | $sql = "DELETE $delTable FROM $delTable, $joinTable WHERE $delVar=$joinVar "; |
|
| 1099 | ||
| 1100 | if ( $conds != '*' ) { |
|
| 1101 | $sql .= ' AND ' . $this->makeList( $conds, LIST_AND ); |
|
| 1102 | } |
|
| 1103 | ||
| 1104 | return $this->query( $sql, $fname ); |
|
| 1105 | } |
|
| 1106 | ||
| 1107 | /** |
|
| 1108 | * @param string $table |
|
| @@ 2363-2380 (lines=18) @@ | ||
| 2360 | return $ok; |
|
| 2361 | } |
|
| 2362 | ||
| 2363 | public function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, |
|
| 2364 | $fname = __METHOD__ |
|
| 2365 | ) { |
|
| 2366 | if ( !$conds ) { |
|
| 2367 | throw new DBUnexpectedError( $this, |
|
| 2368 | 'DatabaseBase::deleteJoin() called with empty $conds' ); |
|
| 2369 | } |
|
| 2370 | ||
| 2371 | $delTable = $this->tableName( $delTable ); |
|
| 2372 | $joinTable = $this->tableName( $joinTable ); |
|
| 2373 | $sql = "DELETE FROM $delTable WHERE $delVar IN (SELECT $joinVar FROM $joinTable "; |
|
| 2374 | if ( $conds != '*' ) { |
|
| 2375 | $sql .= 'WHERE ' . $this->makeList( $conds, LIST_AND ); |
|
| 2376 | } |
|
| 2377 | $sql .= ')'; |
|
| 2378 | ||
| 2379 | $this->query( $sql, $fname ); |
|
| 2380 | } |
|
| 2381 | ||
| 2382 | /** |
|
| 2383 | * Returns the size of a text field, or -1 for "unlimited" |
|