开发者

Effective way to check table name when db schema change?

开发者 https://www.devze.com 2023-03-11 12:36 出处:网络
I have think this question few month for my .NET project (winform & webform) or PHP project. I use Visual Studio 2010 Pro for .NET project and PDT for PHP Project.

I have think this question few month for my .NET project (winform & webform) or PHP project.

I use Visual Studio 2010 Pro for .NET project and PDT for PHP Project.

Maybe the best way is convert the project to ORM (L2S,EF, PHP ActiveRecord etc) instead of classic SQL statement, however, SQL 开发者_开发技巧still quite worth to use, at less every new comer know that on my work place.

I Had to search in google to find any exist plugin or software to do a reflection, but it seem not existing.

So how do you find out which files have to make change when the database schema is change (table name, varchar length, datatype etc) ?

Or just search & replace?


Search and Replace is one possibility.

Another would be to store the table name in constant values and work thim them, instead of putting the table name as plain text into the SQL file.

A third solution, and maybe the best is to use MyBatis (former Ibatis) which stores the SQLs in an external XML file where you can update it at one places, instead of sprankling the SQL code in various files.

http://www.mybatis.org/


Why just don't save the current schema somewhere and compare it with
http://dev.mysql.com/doc/refman/5.0/en/describe.html

DESCRIBE table;

?

0

精彩评论

暂无评论...
验证码 换一张
取 消