Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Support for multiple SQL implementations

Name: Anonymous 2008-06-08 13:57

so if you're writing a piece of software which you want to be able to handle communication with databases on multiple sql implementations, what method would you use?

i've been thinking about two so far and not sure which one to pick, or if there are more, basically to either write ansi sql code or whatever, not use any implementation specific special features so my sql queries work with a sql function wrapper and always execute properly

the method i'm leaning more towards right now is to keep ALL sql queries stored in a file, configuration, and have different queries and database schemes for the implementations i'd like to support

i like the second method even though it's more work, because i only want support for the biggest ones, like mysql, postgres and maybe mssql, and i don't even know that much about mssql so i could prolly reuse some of the mysql queries by setting it as a default, or postgres, so if a query doesn't exist in the mssql set, it uses the corresponding mysql query

Name: Anonymous 2008-06-09 14:07

>>20
What about getting the last auto-generated value of a primary key? SELECT MAX(id) FROM table is somewhat less efficient than SELECT LAST_INSERT_ID FROM table or SELECT @@IDENTITY FROM table, not to mention the table creation syntax (especially key creation), structure queries and metadata access are radically different between databases.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List