2

I am writing an application to access database service. The application shall design to works with any RDBMS in the market ideally. For example, MySQL, MS SQL Server, Firebird, SQLite, MS Access or more. It shall not ties to a particular RDBMS.

However, a string type SQL may work for some RDBMS but fail for others. A slight variant to the SQL shall be made to make it for particular RDBMS. This ranging from syntax grammar, data type, join syntax and DML (Data Manipulation Language, CREATE TABLE, CREATE INDEX and etc.).

It is not an easy job to provide different version of SQL for different RDBMS in an application.

Is there some sort of ready solution to that generate SQL query that can suit different RDBMS? Perhaps some library/classes that can render a SQL text at runtime depends on RDBMS connection.

stdob--
  • 28,222
  • 5
  • 58
  • 73
Chau Chee Yang
  • 18,422
  • 16
  • 68
  • 132
  • 3
    The objective of support is quite different dialects can be solved using `ORM` or `SQL query builder`. For example, `sequelize.js` or `knex.js`. – stdob-- Mar 04 '16 at 01:58
  • Simple abstract the database layer (ie interfaces) and make an implementation for each db type you want to support. – whosrdaddy Mar 05 '16 at 07:47

1 Answers1

0

I think you need to use ORM in your app, take a look at waterline library, it's an adapter-based ORM for Node.js.

https://github.com/balderdashy/waterline