Home > database >  If pb development database structure upgrade, such as increasing fields, update pb should be how to
If pb development database structure upgrade, such as increasing fields, update pb should be how to

Time:09-16

Pb development program, if the original is three fields, has been released after found the need to add three fields (datetime, address, phone), how to guarantee safe and convenient, is in an update pb development or do a batch program?)

CodePudding user response:

Can be made a update pb, test database field, if not automatically add,

CodePudding user response:

With an example of this?

CodePudding user response:

My implementation is a table in the database Settings so

The version number, download address, whether can use the

Program operation is to check yourself whether is available version
Not available version will prompt the user whether to download update

CodePudding user response:

Write the script for the database changes, and implemented them in PB

For SQL server
String ls_sql
The add ls_sql="alter table XXX yyy varchar (20)"
The execute immediate: ls_sql using sqlca;
.

Just this a few words, of course, there are a lot of logical judgment of things to do, see yourself. SQL server 2000 several system tables, check whatever you
Sysdatabases sysobjects...
SQL 2005 above system table, the table name is changed have to look at ourselves

CodePudding user response:

Upgrades script with the version number, download the upgrade script file on the server, update the program to execute SQL script, performed to remove this script
 
Go
If not the exists (select 1 from syscolumns where id=object_id (' TB) and name='columnname')
The alter table TB add columnname int
Go

CodePudding user response:

Is all irrelevant answer,
The somebody else to ask is the database of new fields, application for any convenient method can automatically upgrade data window,
My answer is: even if it does, it is not necessary, and increasing the field database, then used to input data window manually add went, other data window is not necessarily a must, according to whether need to show,

CodePudding user response:

1. A SQL folder under the installation directory, all upgrades yyyymmdd_ statement agreed statement. The name of the SQL, upgrades the statement every time according to the specification to write, write SQL statements, to write in a way that is safe, if there is data in the table, will first transfers the data in the table to table in the table as tmp_table (also check the middle table whether there is, of course), rebuild the table structure, and then inserted into the back, of course the increase of small fields, is not very important, it is ok to use the alter table directly, stored procedures to perform all no problem,
2. Add a table in the database, such as system_update (id, sql_name,... ), mainly used to record has upgraded the statement
3. Develop an update. Exe program independently, the purpose of the app is primarily after startup, check your SQL folder in the file name and system_update table SQL comparison has been upgraded, if did not upgrade, just in the update. Exe upgrade in the list of the main interface, if has been carried out, and will not display the update. There are three buttons, exe a even upgrade immediately, a skip, a closed, upgrade button is to upgrade the upgrade list statement read out, executed in the database,
4. At system startup, check system_update and SQL files in the folder, and if there is update statement, then the run command to start the update. Exe, close the program, start the update. Exe, the user performed by the run command, start the main program, with respect to OK

CodePudding user response:

Remember to update statement sorting is according to the time sequence of execution

CodePudding user response:

After the upgrade, the upgrade of statements are written to the system_update table

CodePudding user response:

Syntax is saved to the database, the data the window dynamically generated when data is retrieved, the new fields, the new syntax to replace the data window can be

CodePudding user response:

references to the tenth floor zc070511 response:
window grammar saved to the database, the data dynamically generated when data is retrieved, the new fields, the new syntax to replace the data window can be

This kind of practice for the form of the title bar is can't change or add some font style in Chinese?
  • Related