Where to store SQL commands for execution

后端 未结 12 1497
后悔当初
后悔当初 2021-02-05 16:00

We face code quality issues because of inline mysql queries. Having self-written mysql queries really clutters the code and also increases code base etc.

Our code is clu

12条回答
  •  面向向阳花
    2021-02-05 16:48

    Create store procedures for all queries, and replace the var sql = "SELECT..." for calling the procedures like var sql = "CALL usp_get_packages".

    This is the best for performance and no dependency breaks on the application. Depending on the number of queries may be a huge task, but for every aspect (maintainability, performance, dependencies, etc) is the best solution.

提交回复
热议问题