The name of the data table is changed (there is a regular number of the same prefix), the system must modify the SQL statement?
The SQL of the original system is as follows:
SELECT * from ' table ';
Today after the online, only to know:
For other reasons (not mentioned here).
All data tables must be renamed, to unify all the data tables, plus a prefix, is to add a "nbx_table"
What should I do?
First, do you want to change the system again? It's too much trouble, is it?
Second, how can you prevent it from happening next time?
Third, some CMS this write has what benefit:
$this->flinfos = $this->dsql->getone ("select * from ' #@__freelist ' WHERE aid= ' $fid '");
Share to:
------Solution--------------------
Some open source projects (CMS, BLOG, Wiki, framework ...) The reason for adding a prefix to the data table is:
Prevent conflicts with other application systems!
The rented space cannot create the database on its own, and when you place two or more items in the space, the table name is very prone to conflict.
------Solution--------------------
First, do you want to change the system again? It's too much trouble, is it?
This depends on how you access the database, such as Hibernate and mybatis do not need to modify the source code, directly to modify the mapping file can be.
If you are using JDBC in the source code to write dead SQL statement, this no way, can only pit the pit times to modify the source of SQL statements.
Second, how can you prevent it from happening next time?
use database persistence frameworks such as MyBatis and hibernate as much as possible.
Third, what is the benefit of some CMS writing: "Select * from ' #@__freelist ' WHERE aid= ' $fid '"
look at this SQL, inside #@__freelist and so on there is a flag, this is actually the last generation of SQL statements to be replaced with the specified variables in the configuration file, just can solve your problem.