| 232 | } |
| 233 | |
| 234 | bool BinaryBoolNode::executeOr(thread_db* tdbb, Request* request) const |
| 235 | { |
| 236 | // If either operand is true, then the result is true; |
| 237 | // If both are false, the result is false; |
| 238 | // Otherwise, the result is NULL. |
| 239 | // |
| 240 | // op 1 op 2 result |
| 241 | // ---- ---- ------ |
| 242 | // F F F |
| 243 | // F T T |
| 244 | // F N N |
| 245 | // T F T |
| 246 | // T T T |
| 247 | // T N T |
| 248 | // N F N |
| 249 | // N T T |
| 250 | // N N N |
| 251 | |
| 252 | const bool value1 = arg1->execute(tdbb, request); |
| 253 | |
| 254 | const ULONG flags = request->req_flags; |
| 255 | request->req_flags &= ~req_null; |
| 256 | |
| 257 | if (value1) |
| 258 | { |
| 259 | // First term is true, why the whole expression is true. |
| 260 | // NULL flag is already turned off a few lines above. |
| 261 | return true; |
| 262 | } |
| 263 | |
| 264 | const bool value2 = arg2->execute(tdbb, request); |
| 265 | |
| 266 | if (value1 || value2) |
| 267 | { |
| 268 | request->req_flags &= ~req_null; |
| 269 | return true; |
| 270 | } |
| 271 | |
| 272 | // restore saved NULL state |
| 273 | |
| 274 | if (flags & req_null) |
| 275 | request->req_flags |= req_null; |
| 276 | |
| 277 | return false; |
| 278 | } |
| 279 | |
| 280 | |
| 281 | //-------------------- |