Sid
Sid

Reputation: 552

How to keep the SQL queries used in Website and APIs common

I am working on a web platform that uses MySQL as DB. I am also making a mobile app for the platform and using APIs to fetch data from DB. What is the mechanism to keep a single SQL queries set that can cater to web and Mobile App APIs without compromising their distinct requirements. If there is a fix to sql queries I have to do it twice and I want to avoid that as its error prone.

Upvotes: 1

Views: 109

Answers (1)

Rob Conklin
Rob Conklin

Reputation: 9456

Create the Data Access Layer as a library. Adhere to the open-closed principal to allow your objects to be extended as needed to handle the peculiarities of your requirements.

Upvotes: 1

Related Questions