Where SQL statements are executed from a program, what is the best practice to store the statement text?
Most often it is in a read only string, in the source file it is executed in.
I think a better approach would be to have a separate text file containing all SQL statements, that are then read in to a dictionary object where the key is the purpose of that statement. Statements can then be executed by using their key, decoupling database implementation from the program and allowing reuse of statements between program objects.
Is this efficient? Is there a better way? Thank you!