/** * @param string $table * @param BindParam $params * @return bool|PDOResponse */ public function delete($table, $params) { $sql = 'DELETE FROM ' . $table; if ($params) { $paramArray = $params->getParamArray(); $condition = $params->getConditionStr(); if ($condition != "") { $sql .= " WHERE {$condition}"; return $this->pdo->prepAndExec($sql, $paramArray); } } return false; }
public function setUp() { $config = new PDOConfig(array('database' => 'test', 'pass' => '')); $pdo = new PDOExtended($config); $pdo->exec("TRUNCATE TABLE TBL_TEST"); $sql = "INSERT INTO TBL_TEST(ID,FIELD1,FIELD2,FIELD3)VALUES(1,'f1_1','f1_2','f1_3');"; $pdo->exec($sql); $sql = "INSERT INTO TBL_TEST(ID,FIELD1,FIELD2,FIELD3)VALUES(2,'f2_1','f2_2','f2_3');"; $pdo->exec($sql); $sql = "INSERT INTO TBL_TEST(ID,FIELD1,FIELD2,FIELD3)VALUES(3,'f3_1','f3_2','f3_3');"; $pdo->exec($sql); $sql = "INSERT INTO TBL_TEST(ID,FIELD1,FIELD2,FIELD3)VALUES(4,'f4_1','f4_2','f4_3');"; $pdo->exec($sql); }