Jump to content
Kuuzu Forum
Sign in to follow this  
ArtcoInc

DAL (Database Abstraction Layer)

Recommended Posts

@frankl

Have you given any thought to using a DAL when creating this, so the project could move to a different database as the project/product/customer grows? Planning ahead, as it were. Just a couple of thoughts on the subject ...

https://stackoverflow.com/questions/384623/how-do-you-write-your-applications-to-be-database-independent

https://stackoverflow.com/questions/204025/database-design-for-database-agnostic-applications

https://www.drupal.org/node/1395

M

Edited by ArtcoInc

Share this post


Link to post
Share on other sites

(not that I know anything about this, but ...)

If I understand things correctly, in osC v2.3.x , all of the tep_db_ database functions are defined in /includes/functions/database.php. *IF* all of the database calls throughout all of the code were database agnostic, we could code up a different /includes/functions/database.php file for each of the supported databases. Then, during installation, we could ask the store owner which database they wanted to use, and then copy the applicable /includes/functions/database.php file for that database.

Just a thought ...

M

Share this post


Link to post
Share on other sites

ORM is completely db engine agnostic, another step beyond query builder. Magento uses it, Saleforce uses it and , yes, just like you said, the installer just have to configure which engine and the credential. ORM will take care of the rest.

The real benefit at the end is schema configuration management.

  • Like 2

Share this post


Link to post
Share on other sites

Basic SQL is the same across all database engines, but the devil is in the details (e.g., MySQL LIMIT is something else in other databases). A DAL can either be given an "extra" array of things like limits, and tack on the appropriate form of "LIMIT" to the query, or it can accept, say, MySQL as its base language and go in and edit the query (on the fly) to change "LIMIT" for non-MySQL databases. The idea is to get queries and actions (e.g., altering a table) specified in a consistent manner that can be made to work across any database on the market. This would include the Big Boys like Oracle and IBM, should your shop get that big. A DAL could also handle things like importing/exporting .sql files with different forms of comments and different syntax for various operations.

I haven't looked at ORM, but I would assume that it's doing something along those lines.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×