How is it an **abstraction** layer if you're calling `mysql_fetch_assoc` in the model?
From `EmployeeDAL.php`. This part is abstract:
$result = $this->conn->executeQuery($qry);
But the next line is **very** specific:
while ($row = mysql_fetch_assoc($result))
`$result` should have been abstract as well.
My DAL/DBAL does that: https://github.com/rudiedirkx/db_generic It separates dev logic entirely from databse engine logic. `db_generic->fetch()`, `db_generic->select()` etc return a `db_generic_result` object which (is iterable and) contains methods like `nextObject()`.
Just saying. The models are good. But it's not abstract.
Shibly - 2012-02-12 09:27:53 - In reply to message 1 from rudie dirkx
Thank you for using my script. Yes you are right. But I've only used mysql related function here to manipulate the database. The class is "MysqlConnection.php" . and I make an instance of this class in "DBConnection.php" . The "DBConnection.php" has a static method which calls the instance class. As you know that you can not directly call an abstract class. BUT you can call a static method inside it :) . The way I implemented the mysql abstraction in "MysqlConnection.php" , you can create your own database specific class like "mysqlite.php" and instantiate it inside the "MysqlConnection.php" by using it's static method. Thank you a lot .
Shibly - 2012-02-12 20:12:28 - In reply to message 5 from halguien
Actually the main concern of this script is how to make a database abstraction layer :) and keep the database specific query separate. Well I guess I've missed some validation rules. Will check that later. Thank you for your reply :)