PHP Classes

Dynamically generated SQL

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  Dynamically generated SQL  
Subject:Dynamically generated SQL
Summary:CRUD Performance and Dynamically Generated SQL
Messages:2
Author:Anthony Amolochitis
Date:2015-09-18 13:56:21
Update:2015-09-18 15:53:36
 

  1. Dynamically generated SQL   Reply   Report abuse  
Picture of Anthony Amolochitis Anthony Amolochitis - 2015-09-18 15:53:36
I notice that many people submit PHP classes that dynamically generate SQL. I even wrote a class that generates SQL, but the code is not dynamic, it is static. Code is generated by a predefined database with tables in it already. My reasoning is that if you already "know" the database, and it's tables' structures, then you should not waste looping cycles trying to create/recreate the same SQL repeatedly. Typically, your database and tables structure should already be known. I understand a field, table may be added, but the class that represents them can easily be changed in one location... At the site of the class that represents it.

So, my reason for posting this is to get some opinions, and facts, on the following questions.

Why we should dynamically generate SQL on a table that is static?

Isn't is inefficient to continuously run a loop on a SQL statement for a table that does not change?

When should we dynamically generate SQL?

There is 1 reply in this thread, which is not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.