How do you manage SQL Queries

后端 未结 10 1690
深忆病人
深忆病人 2020-12-13 05:59

At the moment my code (PHP) has too many SQL queries in it. eg...

// not a real example, but you get the idea...
$results = $db->GetResults(\"SELECT * FRO         


        
10条回答
  •  一整个雨季
    2020-12-13 06:22

    I'd move all the SQL to a separate Perl module (.pm) Many queries could reuse the same functions, with slightly different parameters.

    A common mistake for developers is to dive into ORM libraries, parametrized queries and stored procedures. We then work for months in a row to make the code "better", but it's only "better" in a development kind of way. You're not making any new features!

    Use complexity in your code only to address customer needs.

提交回复
热议问题