| @@ 2188-2205 (lines=18) @@ | ||
| 2185 | return $ok; |
|
| 2186 | } |
|
| 2187 | ||
| 2188 | public function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, |
|
| 2189 | $fname = __METHOD__ |
|
| 2190 | ) { |
|
| 2191 | if ( !$conds ) { |
|
| 2192 | throw new DBUnexpectedError( $this, |
|
| 2193 | 'DatabaseBase::deleteJoin() called with empty $conds' ); |
|
| 2194 | } |
|
| 2195 | ||
| 2196 | $delTable = $this->tableName( $delTable ); |
|
| 2197 | $joinTable = $this->tableName( $joinTable ); |
|
| 2198 | $sql = "DELETE FROM $delTable WHERE $delVar IN (SELECT $joinVar FROM $joinTable "; |
|
| 2199 | if ( $conds != '*' ) { |
|
| 2200 | $sql .= 'WHERE ' . $this->makeList( $conds, LIST_AND ); |
|
| 2201 | } |
|
| 2202 | $sql .= ')'; |
|
| 2203 | ||
| 2204 | $this->query( $sql, $fname ); |
|
| 2205 | } |
|
| 2206 | ||
| 2207 | /** |
|
| 2208 | * Returns the size of a text field, or -1 for "unlimited" |
|
| @@ 1104-1118 (lines=15) @@ | ||
| 1101 | * @throws DBUnexpectedError |
|
| 1102 | * @return bool|ResultWrapper |
|
| 1103 | */ |
|
| 1104 | function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = __METHOD__ ) { |
|
| 1105 | if ( !$conds ) { |
|
| 1106 | throw new DBUnexpectedError( $this, 'DatabaseBase::deleteJoin() called with empty $conds' ); |
|
| 1107 | } |
|
| 1108 | ||
| 1109 | $delTable = $this->tableName( $delTable ); |
|
| 1110 | $joinTable = $this->tableName( $joinTable ); |
|
| 1111 | $sql = "DELETE $delTable FROM $delTable, $joinTable WHERE $delVar=$joinVar "; |
|
| 1112 | ||
| 1113 | if ( $conds != '*' ) { |
|
| 1114 | $sql .= ' AND ' . $this->makeList( $conds, LIST_AND ); |
|
| 1115 | } |
|
| 1116 | ||
| 1117 | return $this->query( $sql, $fname ); |
|
| 1118 | } |
|
| 1119 | ||
| 1120 | /** |
|
| 1121 | * @param string $table |
|