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