Topic awaiting preservation: Coding to handle various databases (Page 1 of 1) |
|
---|---|
Bipolar (III) Inmate From: Australia |
posted 07-24-2005 03:13
I'm doing a project at the moment (actually in vb.net) and want to do some research in this area. The principles are the same for any coding, php etc. |
Maniac (V) Inmate From: under the bed |
posted 07-24-2005 17:42
Commonly referred to as database abstraction - |
Maniac (V) Inmate From: Sthlm, Sweden |
posted 07-24-2005 19:01
Basic princple, separate the code that's specific for each db, connection and so on from the rest of the non-specific code. |
Bipolar (III) Inmate From: Australia |
posted 07-25-2005 01:41
I guess thats what I was thinking, the problem lies where some databases support some features where others dont. For examble using LIMIT in your queries which I do quite often these days for mysql. How would you normally handle that? Have something in the specific DB layer that removes it from the query string? |
Maniac (V) Inmate From: under the bed |
posted 07-25-2005 03:16
I would think the other way around - the actual query string that gets fed to the DB should be created by that abstraction layer based on the criteria passed to it from the interface. |
Bipolar (III) Inmate From: Australia |
posted 07-25-2005 07:13
Yeh I see what you mean, I guess the database functions in the abstraction could use LIMIT within them depending on the query... Mmm at this stage i will probably only use postgreSQL straight up but I like to leave it changable in the future. Will have to see what I can come up with. |
Paranoid (IV) Mad Scientist with Finglongers From: Germany |
posted 07-25-2005 09:24
There's only one problem in Computer Science that can't be solved by another layer of indirection - I'll leave you to figure it out... |
Bipolar (III) Inmate From: Australia |
posted 07-25-2005 09:37
Ohhhh =/ |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 07-25-2005 18:29
Yeah I've had to work with abstraction layers designed to remove the SQL from the equation. |
Bipolar (III) Inmate From: Australia |
posted 07-26-2005 01:23
I can imagine for normal stuff it would be pretty simple, but if you want to do joins and subqueries it could be a prick depending how different the databases are. |