Summary of the invention
Technical matters to be solved by this invention is to provide a kind of system and method that is applied to the upgrading of fulfillment database in background management system in the embedded communication system, it can realize intellectuality and automatic updating, do not need the people to participate in, can discern source version and purpose version automatically, the database of realization background management system is smooth upgrade with software release upgrade.
For solving the problems of the technologies described above, the technical solution adopted in the present invention is: the system that a kind of fulfillment database upgrading in background management system is provided, it comprises version recognition subsystem, edition upgrading subsystem and description/knowledge system, the description/knowledge in wherein said version recognition subsystem generation and existing each edition data storehouse of maintenance software; Described edition upgrading subsystem utilizes described description/knowledge that database is upgraded; Described description/knowledge system is made up of some description document, it is the input of edition upgrading subsystem, the output of version recognition subsystem, described description document comprise upgrading SQL script file between DDF, database version description document, database version identification file, database table description document and database version.
Described description document also comprises pre-service SQL script file and aftertreatment SQL script file.
For solving above-mentioned another technical matters, the technical solution adopted in the present invention is: a kind of method of fulfillment database upgrading in background management system is provided, and it may further comprise the steps: the description/knowledge in generation of version recognition subsystem and existing each edition data storehouse of maintenance software; The edition upgrading subsystem utilizes foregoing description/knowledge that database is upgraded, and described version recognition subsystem produces and the description/knowledge in existing each edition data storehouse of maintenance software may further comprise the steps:
A) the version recognition subsystem reads the database information that all need upgrade data from DDF;
B) the version recognition subsystem generates the database version description document;
C) the version recognition subsystem generates database version identification file;
E) the version recognition subsystem generates upgrading SQL script file between database version;
F) the version recognition subsystem generates the database table description document;
Described edition upgrading subsystem utilizes foregoing description/knowledge that database is upgraded and may further comprise the steps:
H) the edition upgrading subsystem reads the database information that all need upgrade data from DDF;
I) the edition upgrading subsystem is from the database version description document, all version informations of reading database;
J) the edition upgrading subsystem is discerned file according to database version, and reading database version feature information is according to the source version and the purpose version of version feature information Recognition database;
L) the edition upgrading subsystem is carried out the upgrading SQL script file between version, adjusts the list structure and the data in edition data storehouse, source;
M) the edition upgrading subsystem reads the importing data mode of all tables from the database table description document, according to importing data mode, the data of each table is imported purpose edition data storehouse by edition data storehouse, source.
Description/the knowledge in described version recognition subsystem generation and existing each edition data storehouse of maintenance software is further comprising the steps of:
G) whether the upgrading relation constitutes directed acyclic graph between the version in the version recognition subsystem inspection database version description document, if constitute directed acyclic graph, then compares difference in version, and the output detailed report if do not constitute, then finishes version identification.
Described step c) and e) between also comprise step d), be whether table in the version recognition subsystem judgment data storehouse exists constraint, if there is constraint, then the version recognition subsystem generates the pre-service SQL script file and the aftertreatment SQL script file of database version, if there is not the then direct execution in step e of constraint).
Further improvement in the technical proposal is: it is further comprising the steps of that described edition upgrading subsystem utilizes foregoing description/knowledge that database is upgraded: k) the edition upgrading subsystem is from the database version description document, upgrading relation between the reading database version is analyzed the shortest upgrading path that obtains from the source version to the purpose version; Described l) step is specially: the edition upgrading subsystem is carried out the upgrading SQL script file between version along the shortest upgrading path from the source version to the purpose version, adjusts the list structure and the data in edition data storehouse, source.
Described step m) further comprise step n), if promptly should have constraint by table, then before importing data, carry out the pre-service SQL script file of this table, after importing data, carry out the aftertreatment SQL script file of this table.
Step k) the shortest upgrading path of described analysis from the source version to the purpose version adopts and asks the directed acyclic graph certain source point to the algorithm of all the other each summit shortest paths.
The invention has the beneficial effects as follows: because the present invention adopts version recognition subsystem, edition upgrading subsystem and description/knowledge system in conjunction with the database upgrade that is implemented in the background management system, therefore it can realize intellectuality and automatic updating, do not need the people to participate in, can discern source version and purpose version automatically, the database of realization background management system is smooth upgrade with software release upgrade, should have good expandability based on the database upgrade method system of describing that makes; In addition, the present invention can be integrated in the mounting disc of Backend Administration Module software, and the upgrading Installation Options is provided, upgrade data when Backend Administration Module software is installed, and the inspection work of most consistance correctness of database upgrade is finished by system, thereby reduces exploitation/maintainer's work; Moreover, because the shortest upgrading path of analysis of the present invention from the source version to the purpose version adopts is to ask the directed acyclic graph certain source point to the algorithm of all the other each summit shortest paths, therefore in the database upgrade process, can determine upgrading path and strategy from the source version to the purpose version, when the lowest version from background management system software was upgraded to highest version, it can be sought a upgrading path the shortest database is upgraded.
Embodiment
See also Fig. 1, the system of the present invention's fulfillment database upgrading in background management system comprises version recognition subsystem, edition upgrading subsystem and description/knowledge system, wherein description/the knowledge in generation of version recognition subsystem and existing each edition data storehouse of maintenance software; The edition upgrading subsystem utilizes foregoing description/knowledge that database is upgraded; Description/knowledge system is made up of some description document, it is the input of edition upgrading subsystem, the output of version recognition subsystem, description document comprises: upgrading SQL script file between DDF, database version description document, database version identification file, pre-service SQL script file, aftertreatment SQL script file, database table description document and database version.Wherein:
1) DDF
General introduction: describe the data of database that to upgrade in the escalation process.Whole edition upgrading system just uses this DDF.
2) database version description document
General introduction: all versions of descriptive data base and the relation of the upgrading between version.Each database that will upgrade has this database version description document.
3) database version identification file
General introduction: preserve the database information of this version, comprise all table information in the database,, be used to discern each version as list structure definition (essential, all tables), field implication (optional, host service table), field enumerated value implication (optional, host service table).Each version of database has this database version identification file.
4) pre-service SQL script file
General introduction: pre-service SQL script file is divided into: database pre-service SQL script file, table pre-service SQL script file.Each database of each version has a database pre-service SQL script file at most, and it is carried out before database imports data, and any special processing that need carry out before database imports data can be write the SQL script in this document.Each table of each database of each version has a table pre-service SQL script file at most, and it is carried out before importing these table data, and any special processing that need carry out before importing these table data can be write the SQL script in this document.
5) aftertreatment SQL script file
General introduction: aftertreatment SQL script file is divided into: database aftertreatment SQL script file, table aftertreatment SQL script file.Each database of each version has a database aftertreatment SQL script file at most, and it is carried out after database imports data, and any special processing that need carry out after database imports data can be write the SQL script in this document.Each table of each database of each version has a table aftertreatment SQL script file at most, and it is carried out after importing these table data, and any special processing that need carry out after these table data of importing can be write the SQL script in this document.
6) upgrading SQL script file between database version
General introduction: be used to write the upgrade script that the relative source of purpose version version changes.If the relative source of purpose version version has increased table, should write the script of establishment table.If the relative source of purpose version version has reduced table, should write the script of delete list.If between two versions, certain list structure (comprising Field Definition, the enumerated value definition) changes, and should write upgrade script for it, is responsible for adjustment form structure and data, makes it consistent with redaction.
7) database table description document
General introduction: describe in the escalation process importing data mode of all tables in the database.Each database that will upgrade has this database table description document.
Table in the database roughly is divided into: a, the default data is arranged, can not revise/delete the default data or increase new data; B, the default data is arranged, can not revise/delete the default data but may increase new data; C, the default data is arranged, may revise/delete the default data but can not increase new data; D, the default data is arranged, may revise/delete the default data or increase new data; E, do not have the default data, may increase new data.Correspondingly, the importing data mode is divided into: the 0 (default data that keeps redaction fully, be fit to type a), 1 (imports the data in the early version fully, be fit to type d and e), 2 (self-defined SQL script mode relatively flexibly, can be fit to type b and C and special circumstances that some may also not considered).
The method of the present invention's fulfillment database upgrading in background management system comprises that the version recognition subsystem produces and the step of the description/knowledge in existing each edition data storehouse of maintenance software and the step that the edition upgrading subsystem utilizes foregoing description/knowledge that database is upgraded.
See also Fig. 2, the version recognition subsystem of the present invention system of fulfillment database upgrading in background management system is output with description/knowledge system, correctness, the consistance being responsible for generating description document and checking description document.The version recognition subsystem produces and the description/knowledge in existing each edition data storehouse of maintenance software may further comprise the steps:
A) the version recognition subsystem reads the database information that all need upgrade data from DDF;
B) the version recognition subsystem generates the database version description document;
C) the version recognition subsystem generates database version identification file;
D) whether the table in the version recognition subsystem judgment data storehouse exists constraint, and as if there being constraint, then the version recognition subsystem generates the pre-service SQL script file and the aftertreatment SQL script file of database version, if there is not the then direct execution in step e of constraint);
E) the version recognition subsystem generates upgrading SQL script file between database version;
F) the version recognition subsystem generates the database table description document;
G) whether the upgrading relation constitutes directed acyclic graph between the version in the version recognition subsystem inspection database version description document, if constitute directed acyclic graph, then compares difference in version, and the output detailed report if do not constitute, then finishes version identification.
See also Fig. 3, the description document that the edition upgrading subsystem of the present invention system of fulfillment database upgrading in background management system utilizes the version recognition subsystem to generate is upgraded to database, and the edition upgrading subsystem utilizes foregoing description/knowledge that database is upgraded and may further comprise the steps:
H) the edition upgrading subsystem reads the database information that all need upgrade data from DDF;
I) the edition upgrading subsystem is from the database version description document, all version informations of reading database;
J) the edition upgrading subsystem is discerned file according to database version, and reading database version feature information is according to the source version and the purpose version of version feature information Recognition database;
K) the edition upgrading subsystem is from the database version description document, and the upgrading relation between the reading database version is analyzed the shortest upgrading path that obtains from the source version to the purpose version;
L) the edition upgrading subsystem is carried out the upgrading SQL script file between version along the shortest upgrading path from the source version to the purpose version, adjusts the list structure and the data in edition data storehouse, source;
M) the edition upgrading subsystem is from the database table description document, read the importing data mode of all tables, according to importing data mode, the data of each table are imported purpose edition data storehouse by edition data storehouse, source, if should have constraint by table, then before importing data, carry out the pre-service SQL script file of this table, after importing data, carry out the aftertreatment SQL script file of this table.
Step k wherein) the shortest upgrading path of described analysis from the source version to the purpose version adopts and asks the directed acyclic graph certain source point to the algorithm of all the other each summit shortest paths.Seeing also Fig. 4, is directed acyclic graph of the present invention, and wherein V1, V2, V3, V4, V5, V6 constitute the version of existing software.Vi (i=1,2,3, the 4...) vertex set in the formation directed acyclic graph.Representing can be upgraded to another version from a version with oriented arc connection between the summit, according to the description in the technical scheme, promptly is to have the upgrading relation between two versions.For example, be upgraded to V6 from version V1 following several upgrading pathes arranged:
1)V1?V2?V3?V4?V5?V6
2)V1?V2?V3?V5?V6
3)V1?V2?V3?V6
4)V1?V3?V4?V5?V6
5)V1?V3?V5?V6
6)V1?V3?V6
Can analyze shortest path according to above-mentioned directed acyclic graph shortest path first is V1 V3 V6, is the shortest path that database version V1 is upgraded to V6.