Database class addtions
This commit is contained in:
parent
20bf6d7d19
commit
245a2f78f3
@ -72,6 +72,40 @@ class DB_PDO extends PDO {
|
||||
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Retreives the data from a select query
|
||||
*
|
||||
* @param PDOStatement $statement
|
||||
* @return array
|
||||
*/
|
||||
function get_query_data($statement)
|
||||
{
|
||||
// Execute the query
|
||||
$statement->execute();
|
||||
|
||||
// Return the data array fetched
|
||||
return $statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns number of rows affected by an INSERT, UPDATE, DELETE type query
|
||||
*
|
||||
* @param PDOStatement $statement
|
||||
* @return int
|
||||
*/
|
||||
function get_rows_changed($statement)
|
||||
{
|
||||
// Execute the query
|
||||
$statement->execute();
|
||||
|
||||
// Return number of rows affected
|
||||
return $statement->rowCount();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// End of db_pdo.php
|
Loading…
Reference in New Issue
Block a user