first, The app update prompt background interface development-(2) database table design

Source: Internet
Author: User
<span id="Label3"></p><p><p>Create a new database table to store app update information</p></p><p><p>The data table Is:</p></p><p><p>CREATE TABLE App_update_message (</p></p><p><p>app_id VARCHAR2 (),--appid,01:android 02:ios</p></p><p><p>APP_CODE VARCHAR2 (50),--client Device ID string, such as: app.android.version.key</p></p><p><p>App_name VARCHAR2 (50),--client Device Name</p></p><p><p>Version_milepost number Default 0,--whether It is a mileage card version, The default is 0, or 1</p></p><p><p>Version_code VARCHAR2 (50),--version Number</p></p><p><p>Version_code_before VARCHAR2 (50),--previous Version number</p></p><p><p>Version_type number,---version type, 0 Select update, 1 force update</p></p><p><p>Version_big VARCHAR2 (50),--new Version Size</p></p><p><p>Download_url VARCHAR2 (50),--update Address</p></p><p><p>Update_title VARCHAR2 (50),--upgrade Information Brief</p></p><p><p>Update_message VARCHAR2 (4000),--upgrade Information details</p></p><p><p>Status number,--version status 1: latest version, 0: previous old version</p></p><p><p>Create_time Date,--version creation Time</p></p><p><p>Update_params VARCHAR2 (50),--add Extension</p></p><p><p>Constrint app_update_message PRIMARY Key (app_id,version_code)-the combination of app_id and Version_code as a combined primary key constraint, The combination cannot be repeated</p></p><p><p>);</p></p><p><p>COMMENT on table app_update_message is ' APP update prompt table ';</p></p><p><p>COMMENT on COLUMN app_update_message. APP_ID is ' Appid,01-android,02-ios ';</p></p><p><p>COMMENT on COLUMN app_update_message. APP_CODE is ' client device ID string ';</p></p><p><p>COMMENT on COLUMN app_update_message. App_name is ' client device name ';</p></p><p><p>COMMENT on COLUMN app_update_message. Version_milepost is ' 0-normal version, 1-milestone version ';</p></p><p><p>COMMENT on COLUMN app_update_message. Version_code is ' version number ';</p></p><p><p>COMMENT on COLUMN app_update_message. Version_code_before is ' last version number ';</p></p><p><p>COMMENT on COLUMN app_update_message. Version_type is ' version type, 0-select update, 1-force update ';</p></p><p><p>COMMENT on COLUMN app_update_message. Version_big is ' new version size ';</p></p><p><p>COMMENT on COLUMN app_update_message. Download_url is ' update address ';</p></p><p><p>COMMENT on COLUMN app_update_message. Update_title is ' Upgrade information brief ';</p></p><p><p>COMMENT on COLUMN app_update_message. Update_message is ' Upgrade information details ';</p></p><p><p>COMMENT on COLUMN app_update_message. Status is ' version state, 0-previous old version, 1-new version ';</p></p><p><p>COMMENT on COLUMN app_update_message. Create_time is ' version creation time ';</p></p><p><p>COMMENT on COLUMN app_update_message. Update_params is ' Add extension ';</p></p><p><p></p></p><p><p></p></p><p><p>Extended:</p></p><p><p>1, The app client receives the return value, according to the version state status, to determine whether to display the update prompt box</p></p><p><p>2, for some explanation of the length of the field:</p></p><p><p>The length of char is fixed, no characters are empty, VARCHAR2 is changed, such as: VARCHAR2 (20), 20 is the maximum value, less than 20 o'clock, according to the actual length of Storage.</p></p><p><p>VARCHAR2 saves variable-length characters in the Oracle database, and the size of the storage space in the database is based on the actual character length and does not appear as a char, which takes up less space.</p></p><p><p>Since VARCHAR2 is variable-length storage, then VARCHAR2 (ten), VARCHAR2 (1000) What is the difference, anyway, is variable length, storage space is the same, directly get 1000, lest later to be longer and change the field Definition. Why not directly with 1000, there are several reasons: the first field length is a database constraint, you can ensure that the data entered into the database meets the length requirements, the definition of reasonable field length can reduce the number of illegal data entry, and so on, specifically, You can search the Oracle database field length design to delve into this length of the problem, the overall conclusion is:</p></p><p><p>Can not be arbitrarily defined, not the bigger the better, to combine their own actual business, for the description of the details of the information, the length of unpredictable, can retain a larger length, to avoid the subsequent length adjustment, such as directly set to 4000.</p></p><p><p>3. Change the field length SQL Statement:</p></p><p><p>For example, adjust the app_id field length to 10</p></p><p><p>ALTER TABLE app_update_message MODIFY app_id VARCHAR2 (10);</p></p><p><p>4. VARAHCR2 Storage of Chinese characters in Oracle database</p></p><p><p>Depending on the character set of the database, the number of stored Chinese characters is different, if the use of GBK encoding, that one Chinese character will occupy 2 bytes, with the UTF8 encoding, then a Chinese character will occupy 3 Bytes. You need to take this into account when specifying the length of the field, and you can search Oracle's varchar2 how to store Chinese Characters.</p></p><p><p></p></p><p><p></p></p><p><p>Side Dishes Level limited, master do not spray, Welcome to Exchange ~ ~ ~</p></p><p><p></p></p><p><p>first, The app update prompt background interface development-(2) database table design</p></p></span>

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.