08-17-2017, 06:26 PM
Instead of creating a near-duplicate method, I'd probably just modify the original slightly:
This way you don't have to modify any code you've already written.
You probably won't have to worry about it being overwritten unless mudmin actually changes the class. Nearly all version updates deal with implementation and not the classes, and I'd suspect that if he does change the DB class it would be to make a similar change.
Code:
if ($this->_query->execute()) {
Code:
$type = substr($sql, 0, 6);
Code:
if ($type == 'SELECT') {
Code:
$this->_results = $this->_query->fetchAll(PDO::FETCH_OBJ);
Code:
$this->_resultsArray = json_decode(json_encode($this->_results), true);
Code:
}
Code:
if ($type == 'INSERT') {
Code:
$this->_lastId = $this->_pdo->lastInsertId();
Code:
}
Code:
$this->_count = $this->_query->rowCount();
Code:
} else {
Code:
$this->_error = true;
Code:
}
This way you don't have to modify any code you've already written.
You probably won't have to worry about it being overwritten unless mudmin actually changes the class. Nearly all version updates deal with implementation and not the classes, and I'd suspect that if he does change the DB class it would be to make a similar change.