is the name of the field written in the table or in the file? Solutions

Source: Internet
Author: User
is the name of the field written in the table or in the file?
In the development of database program, we will encounter many problems, one of which is that the English name of the field and the Chinese name control.

For example, the database in the username, to be mapped into a "user name", this "user name" in the user new, user editing, query users, to the user authorization and so on everywhere to use, so if we can write him somewhere, you can use scaffolding to read the name directly, showing the title.
Now, the question is, where is this control file written?

Written in the table, the advantage is that reducing the file IO, the table structure is better than loose files.
Written in a file, the advantage is that it reduces the number of database reads. The disadvantage is not good to write, easy to write wrong. Especially when working with multidimensional arrays. There is also the design if you change these structures.

I took a look at some of the frameworks, mostly written in a file, saved in an array form, which of course has to consider that our web designer may not have permission to move the database structure, but most programmers in the country can easily move to the database structure.

Everybody vote, if you are in the design, where would you choose to put it?

------Solution--------------------
Field Chinese name?! Why don't you just use the i18n method?
------Solution--------------------
It is recommended that you write directly in the notes of the table and the fields so that you can get them in information_schema. ' COLUMNS '.
You can read it every time, or write a piece of code each time you change the design of the table, the comments are exported to the file at once.
------Solution--------------------
Recommended memory table, need to check it
or a table link or a direct check

Table operation is much faster when the user is many
When users are young, file operations are faster


------Solution--------------------
Referring to the MVC framework,
Write to the class file.

Object-oriented database access
------Solution--------------------
We usually write a file.
------Solution--------------------
discuss
Field Chinese name?! Why don't you just use the i18n method?

------Solution--------------------
Write in the comments!
------Solution--------------------
We generally also in the class file ~ ~ ~ also have in the table comment
Recommend the former
------Solution--------------------
Generally written in table/field notes
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.