Creating an abstraction layer
Posted on 2004-04-19
I need to create my own custom abstraction layer for different databases my application will be using. (Note: This question is not about databases)
I will call a function like this to create my object, passing the database type in it's creation
type TDatabaseType = (dbMySQL,dbOracle,dbMSSQL, dbWhatever);
Database := TMyAbstration.create(dbMySQL);
depending on the value passed on create, I will need to call functions in the corresponding database unit (That I am also creating). All of the functions in the units will be identical.
How can I make it so that depending on what is passed on create, it will call the functions out of the corresponding units?