| @@ 2230-2247 (lines=18) @@ | ||
| 2227 | return $ok; |
|
| 2228 | } |
|
| 2229 | ||
| 2230 | public function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, |
|
| 2231 | $fname = __METHOD__ |
|
| 2232 | ) { |
|
| 2233 | if ( !$conds ) { |
|
| 2234 | throw new DBUnexpectedError( $this, |
|
| 2235 | 'DatabaseBase::deleteJoin() called with empty $conds' ); |
|
| 2236 | } |
|
| 2237 | ||
| 2238 | $delTable = $this->tableName( $delTable ); |
|
| 2239 | $joinTable = $this->tableName( $joinTable ); |
|
| 2240 | $sql = "DELETE FROM $delTable WHERE $delVar IN (SELECT $joinVar FROM $joinTable "; |
|
| 2241 | if ( $conds != '*' ) { |
|
| 2242 | $sql .= 'WHERE ' . $this->makeList( $conds, LIST_AND ); |
|
| 2243 | } |
|
| 2244 | $sql .= ')'; |
|
| 2245 | ||
| 2246 | $this->query( $sql, $fname ); |
|
| 2247 | } |
|
| 2248 | ||
| 2249 | /** |
|
| 2250 | * Returns the size of a text field, or -1 for "unlimited" |
|
| @@ 1086-1100 (lines=15) @@ | ||
| 1083 | * @throws DBUnexpectedError |
|
| 1084 | * @return bool|ResultWrapper |
|
| 1085 | */ |
|
| 1086 | function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = __METHOD__ ) { |
|
| 1087 | if ( !$conds ) { |
|
| 1088 | throw new DBUnexpectedError( $this, 'DatabaseBase::deleteJoin() called with empty $conds' ); |
|
| 1089 | } |
|
| 1090 | ||
| 1091 | $delTable = $this->tableName( $delTable ); |
|
| 1092 | $joinTable = $this->tableName( $joinTable ); |
|
| 1093 | $sql = "DELETE $delTable FROM $delTable, $joinTable WHERE $delVar=$joinVar "; |
|
| 1094 | ||
| 1095 | if ( $conds != '*' ) { |
|
| 1096 | $sql .= ' AND ' . $this->makeList( $conds, LIST_AND ); |
|
| 1097 | } |
|
| 1098 | ||
| 1099 | return $this->query( $sql, $fname ); |
|
| 1100 | } |
|
| 1101 | ||
| 1102 | /** |
|
| 1103 | * @param string $table |
|