| @@ 365-377 (lines=13) @@ | ||
| 362 | * @param string $cond Condition, can be where, having etc, raw sql string, not null. |
|
| 363 | * @return int -1 error/0 not found/N > 0 number of rows |
|
| 364 | */ |
|
| 365 | public function DelRow ($tbl, $cond) { |
|
| 366 | $cond = trim($cond); |
|
| 367 | if (empty($cond)) |
|
| 368 | return -1; |
|
| 369 | $this->PExecute($this->GenSql(array( |
|
| 370 | 'DELETE' => $tbl, |
|
| 371 | )) . ' ' . $cond); |
|
| 372 | if (0 != $this->ErrorNo()) |
|
| 373 | // Execute error |
|
| 374 | return -1; |
|
| 375 | else |
|
| 376 | return $this->Affected_Rows(); |
|
| 377 | } // end of func DelRow |
|
| 378 | ||
| 379 | ||
| 380 | /** |
|
| @@ 442-465 (lines=24) @@ | ||
| 439 | * @param string $condition Not empty, can be raw sql where, having etc |
|
| 440 | * @return int |
|
| 441 | */ |
|
| 442 | public function deleteRow($table, $condition) |
|
| 443 | { |
|
| 444 | $condition = trim($condition); |
|
| 445 | if (empty($condition)) { |
|
| 446 | return -1; |
|
| 447 | } |
|
| 448 | ||
| 449 | $this->executePrepare( |
|
| 450 | $this->getSqlGenerator()->get(['DELETE' => $table]) |
|
| 451 | . ' ' . $condition |
|
| 452 | ); |
|
| 453 | ||
| 454 | if (0 != $this->conn->ErrorNo()) { |
|
| 455 | // @codeCoverageIgnoreStart |
|
| 456 | // Error is rollbacked, no errorno return |
|
| 457 | ||
| 458 | // Execute error |
|
| 459 | return -1; |
|
| 460 | ||
| 461 | // @codeCoverageIgnoreEnd |
|
| 462 | } else { |
|
| 463 | return $this->conn->Affected_Rows(); |
|
| 464 | } |
|
| 465 | } |
|
| 466 | ||
| 467 | ||
| 468 | /** |
|