| @@ 2213-2229 (lines=17) @@ | ||
| 2210 | return $ok; |
|
| 2211 | } |
|
| 2212 | ||
| 2213 | public function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, |
|
| 2214 | $fname = __METHOD__ |
|
| 2215 | ) { |
|
| 2216 | if ( !$conds ) { |
|
| 2217 | throw new DBUnexpectedError( $this, __METHOD__ . ' called with empty $conds' ); |
|
| 2218 | } |
|
| 2219 | ||
| 2220 | $delTable = $this->tableName( $delTable ); |
|
| 2221 | $joinTable = $this->tableName( $joinTable ); |
|
| 2222 | $sql = "DELETE FROM $delTable WHERE $delVar IN (SELECT $joinVar FROM $joinTable "; |
|
| 2223 | if ( $conds != '*' ) { |
|
| 2224 | $sql .= 'WHERE ' . $this->makeList( $conds, self::LIST_AND ); |
|
| 2225 | } |
|
| 2226 | $sql .= ')'; |
|
| 2227 | ||
| 2228 | $this->query( $sql, $fname ); |
|
| 2229 | } |
|
| 2230 | ||
| 2231 | /** |
|
| 2232 | * Returns the size of a text field, or -1 for "unlimited" |
|
| @@ 1096-1110 (lines=15) @@ | ||
| 1093 | * @throws DBUnexpectedError |
|
| 1094 | * @return bool|ResultWrapper |
|
| 1095 | */ |
|
| 1096 | function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = __METHOD__ ) { |
|
| 1097 | if ( !$conds ) { |
|
| 1098 | throw new DBUnexpectedError( $this, __METHOD__ . ' called with empty $conds' ); |
|
| 1099 | } |
|
| 1100 | ||
| 1101 | $delTable = $this->tableName( $delTable ); |
|
| 1102 | $joinTable = $this->tableName( $joinTable ); |
|
| 1103 | $sql = "DELETE $delTable FROM $delTable, $joinTable WHERE $delVar=$joinVar "; |
|
| 1104 | ||
| 1105 | if ( $conds != '*' ) { |
|
| 1106 | $sql .= ' AND ' . $this->makeList( $conds, self::LIST_AND ); |
|
| 1107 | } |
|
| 1108 | ||
| 1109 | return $this->query( $sql, $fname ); |
|
| 1110 | } |
|
| 1111 | ||
| 1112 | /** |
|
| 1113 | * @param string $table |
|