CN107368513B - Method and device for updating client database - Google Patents

Method and device for updating client database Download PDF

Info

Publication number
CN107368513B
CN107368513B CN201710277490.3A CN201710277490A CN107368513B CN 107368513 B CN107368513 B CN 107368513B CN 201710277490 A CN201710277490 A CN 201710277490A CN 107368513 B CN107368513 B CN 107368513B
Authority
CN
China
Prior art keywords
data table
signature information
old version
updated
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710277490.3A
Other languages
Chinese (zh)
Other versions
CN107368513A (en
Inventor
谢斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201710277490.3A priority Critical patent/CN107368513B/en
Publication of CN107368513A publication Critical patent/CN107368513A/en
Application granted granted Critical
Publication of CN107368513B publication Critical patent/CN107368513B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/219Managing data history or versioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2358Change logging, detection, and notification

Abstract

The invention discloses a method and a device for updating a client database, relates to the technical field of Internet, and aims to solve the problems that user data is lost and updating is wrong when the client database is updated. The method of the invention comprises the following steps: comparing the first signature information of each data table in the upgrade package with the second signature information corresponding to the identifier of the data table in the management table to determine whether the stored data table of the old version needs to be updated; the management table is used for recording the mapping relation between the identification of the data table and the signature information, and the signature information is obtained by calculation according to the table structure information of the data table; if the data table of the old version needs to be updated, creating a data table of a new version, and replacing the data table of the old version with the data table of the new version; and if the data table of the old version does not need to be updated, not performing replacement operation on the data table of the old version. The method is mainly applied to the updating process of the relational database.

Description

Method and device for updating client database
Technical Field
The invention relates to the technical field of internet, in particular to a method and a device for updating a client database.
Background
The client terminal which is generally used for the local structural database relates to the problems of local database creation and database upgrading. The database upgrade includes changes to the table structure of a data table, such as deleting certain fields in a data table, or adding certain fields in a data table, etc.
Usually, a created database can be directly carried in an installation package of the client, and the database is directly copied to a target directory of the client during installation. And a complete and updated database is attached to the upgrade package of the client side during upgrading. In the upgrading process, the client side enables the database in the upgrading package to cover the original database in the target directory. The problem with this approach is that the update process is an overlay of the entire database, and for those packets whose table structure has not changed, the overlay will also be performed, resulting in the loss of user data recorded in this part of the data table.
In another method, the upgrade package carries a script code of the upgrade database, and whether the local database needs to be updated is determined by executing the script code. This approach is an improvement over the above approach in that database overwriting is not performed when the database does not need to be updated. However, this determination method is only to simply determine whether there is a field change to detect whether the database needs to be updated, and a determination error is likely to occur in the cross-version upgrade process. For example, in version 1.0, data table 1 in the database has A, B, C three fields, in version 1.1, field D needs to be added, and in version 1.2, field A needs to be deleted. Normally after undergoing two upgrades, the data table contains field B, C, D. But if the client upgrades directly to version 1.2 across version 1.1, then the upgraded data table 1 contains only field B, C, and an upgrade error occurs.
Disclosure of Invention
The invention provides a method and a device for updating a client database, which can solve the problems of user data loss and update errors in client database update.
To solve the above problem, in one aspect, the present invention provides a method for updating a client database, including:
comparing first signature information of each data table in the upgrade package with second signature information corresponding to the identifier of the data table in the management table, and determining whether the stored data table of the old version needs to be updated; the management table is used for recording the mapping relation between the identification of the data table and the signature information, the first signature information is obtained by calculation according to the table structure information of the data table recorded in the upgrade package, and the second signature information is obtained by calculation according to the table structure information of the data table in the currently installed old version database;
if the data table of the old version needs to be updated, creating a data table of a new version, and replacing the data table of the old version with the data table of the new version;
and if the data table of the old version does not need to be updated, not performing replacement operation on the data table of the old version.
In another aspect, the present invention further provides a device for updating a client database, including:
the determining unit is used for comparing first signature information of each data table in the upgrade package with second signature information corresponding to the identification of the data table in the management table to determine whether the stored old version of the data table needs to be updated; the management table is used for recording the mapping relation between the identification of the data table and the signature information, the first signature information is obtained by calculation according to the table structure information of the data table recorded in the upgrade package, and the second signature information is obtained by calculation according to the table structure information of the data table in the currently installed old version database;
the creating unit is used for creating the data table of the new version when the determining unit determines that the data table of the old version needs to be updated;
a replacing unit configured to replace the old version of the data table with the new version of the data table created by the creating unit;
the replacing unit is further used for not performing replacing operation on the old version data table when the determining unit determines that the old version data table does not need to be updated.
The method and the device for updating the client database can record the signature information of each data table through the management table, and the signature information is calculated according to the table structure information of the corresponding data table. When the database needs to be updated, whether the stored data table of the old version needs to be updated or not can be determined by comparing the first signature information of each data table in the upgrade package with the second signature information corresponding to the identifier of the data table in the management table; when it is determined that a certain old version of the data table needs to be updated, the new version of the data table created based on the new table structure information is directly replaced with the old version of the data table without paying attention to the table structure change history related to past version iteration, so that the table structure of the data table cannot be influenced even if the certain version of the data table is deleted for updating, and the method is suitable for the process of cross-version updating; when determining that the data table of an old version does not need to be updated, the data table is not operated, and the loss of user data in the part of the data table is avoided.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart illustrating a method for updating a client database according to an embodiment of the present invention;
FIG. 2 is a flow chart of another method for updating a client database provided by an embodiment of the invention;
FIG. 3 is a block diagram illustrating an apparatus for updating a database at a client according to an embodiment of the present invention;
fig. 4 is a block diagram illustrating another apparatus for updating a client database according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
To facilitate understanding of the present embodiment, a brief description of the client database is first provided. The client database is generally composed of a plurality of data tables, and one column of the data tables is called a field and is used for defining the attribute of the data in one dimension, such as 'name', 'school number', 'grade', 'gender', and the like; one row of the data table is called a record and is used for storing a piece of user data, and the user data comprises the dimension information of each field. Typically, when an upgrade is applied, the table structure of some or all of the data tables may be modified, such as deleting certain fields or adding certain fields. And modifying the table structure in the data table by updating the database. In practical application, the data table may be a data table related to a service (referred to as a service table for short), or may be a data table related to other aspects.
An embodiment of the present invention provides a method for updating a client database, as shown in fig. 1, the method includes:
101. and comparing the first signature information of each data table in the upgrade package with the second signature information corresponding to the identifier of the data table in the management table to determine whether the stored old version of the data table needs to be updated.
The upgrade package carries first signature information of each data table in the database, and the first signature information is obtained by calculation according to the table structure information of the data tables recorded in the upgrade package. The table structure defines information such as a name, a field, a type, a primary key, a foreign key, an index, etc. of a data table, for example, the table structure information records the name of the data table, and what fields, data tables, or data types of the fields are included. In this embodiment, signature calculation is performed on the table structure information according to a preset signature algorithm. The signature algorithm has the characteristic of one data one signature, namely the signature information of the same data is the same, and the signature information of different data is different. When the table structure information changes, for example, when fields are increased or decreased, the signature information for the new table structure information will change. By utilizing the characteristic, the embodiment of the invention can judge whether the upgrade package changes the table structure of the data table, thereby determining whether the data table of the old version needs to be updated.
It should be noted that the first signature information obtained from the upgrade package may be directly carried in the upgrade package after being calculated by the network side, or may be carried in the upgrade package and calculated by the client, which is not limited in this embodiment.
In order to facilitate the judgment of whether the table structure information of the data table is changed, a management table for recording the mapping relationship between the identifier of the data table and the signature information is established in the database in addition to the data table for storing data, and the corresponding second signature information can be searched in the management table through the identifier (such as the table name) of the data table.
The second signature information is essentially the same as the first signature information, and is obtained by calculating the table structure information through a signature algorithm, and the difference is that the second signature information is the signature information stored in the management table, and the signature information may be the first signature information obtained from the upgrade package at the last update. After each update of the data table, the latest first signature information needs to be updated into the management table.
After obtaining the upgrade package and the management table, the client may compare first signature information of each data table in the upgrade package with second signature information corresponding to the identifier of the data table in the management table; if the first signature information is the same as the second signature information, the table structure information of the data table is changed, so that the data table of the old version can be determined to need to be updated; if the first signature information is different from the second signature information, it indicates that the table structure information of the data table is not changed, so that it can be determined that the old version of the data table does not need to be updated.
It should be added that, in practical applications, a hash Algorithm may be used as the signature Algorithm, for example, MD5 (chinese name is fifth edition of Message Digest Algorithm, Message Digest Algorithm) Algorithm may be used for signature, and this embodiment does not specifically limit the specific signature Algorithm.
102. And if the old version of the data table is determined to need updating, creating a new version of the data table, and replacing the old version of the data table with the new version of the data table.
If the first signature information is different from the second signature information, the table structure of the data table in the new version is changed (including but not limited to field increase and decrease, field type change, change of the external key of the main key, modification of the index information and the like), so that the data table in the old version is determined to need to be updated. In this case, the client creates a new version data table according to the latest table structure information in the upgrade package, and replaces the old version data table stored in the target directory with the new version data table.
103. And if the data table of the old version does not need to be updated, not performing replacement operation on the data table of the old version.
If the first signature information is the same as the second signature information, the table structure of the data table in the new version is not changed, so that the data table of the old version is determined not to need to be updated, and further, the data table of the old version does not need to be replaced. Compared with the prior art, the data table which does not need to be updated is not repeatedly replaced, so that the user data (each record) recorded in the data table can be prevented from being lost due to the coverage of the data table.
The method for updating the client database provided by the embodiment of the invention can record the signature information of each data table through the management table, and the signature information is calculated according to the table structure information of the corresponding data table. When the database needs to be updated, whether the stored data table of the old version needs to be updated or not can be determined by comparing the first signature information of each data table in the upgrade package with the second signature information corresponding to the identifier of the data table in the management table; when it is determined that a certain old version of the data table needs to be updated, the new version of the data table created based on the new table structure information is directly replaced with the old version of the data table without paying attention to the table structure change history related to past version iteration, so that the table structure of the data table cannot be influenced even if the certain version of the data table is deleted for updating, and the method is suitable for the process of cross-version updating; when determining that the data table of an old version does not need to be updated, the data table is not operated, and the loss of user data in the part of the data table is avoided.
Further, as an extension to the method shown in fig. 1, an embodiment of the present invention further provides a method for updating a client database, as shown in fig. 2, where the method includes:
201. and after receiving the installation package, creating the management table.
When an application is first started after installation, the client creates a local database. The local database generally exists in a file form, and the created database file is the created database. Taking the SQLite relational database as an example, the Application program installation package carries an API (Application Programming Interface) for opening the database: the client calls the API to complete the creation of the database, either sqlite3_ open or sqlite3_ open _ v 2. Since the database is not created in the current directory, the database can be created by opening the database for the first time. The creation of the database can be accomplished by calling either of these two APIs. For sqlite3_ open, if the local database does not exist, then calling sqlite3_ open will default to creating the database; for SQLITE3_ OPEN _ v2, the transfer of the flags parameter in SQLITE3_ OPEN _ v2 into SQLITE _ OPEN _ READWRITE | SQLITE _ OPEN _ CREATE CREATEs the database by default.
The created database only contains some basic data tables of the database and does not contain data tables related to the application program.
After creating the database, the client creates a management table. As shown in table 1, the management table includes two fields, one field is a data table name, and the other field is signature information (hash value) corresponding to the data table. The name and hash value of the data table are not recorded in the newly created management table.
TABLE 1
Figure BDA0001278643210000061
Figure BDA0001278643210000071
The fields in the management table are relatively fixed and usually do not change, so the table structure of the management table is usually not changed after the management table is created for the first time.
202. And respectively creating each data table according to the table structure information of each data table in the installation package.
The installation package carries table structure information of a data table required to be established in the current version, the table structure information is recorded in a database character string of the installation package, and for an SQL relational database, the table structure information is recorded in the SQL character string. After the SQL character string is taken from the installation package, the client checks whether the corresponding table name exists in the management table (does not exist), then creates a corresponding data table in a mode of executing the SQL character string, and then carries out hash calculation on the SQL character string to obtain a corresponding hash value.
In practical applications, please refer to the prior art for an implementation manner of executing the SQL string to create the data table.
203. And adding the mapping relation between the identification and the signature information of each data table in the installation package into the management table.
And adding a data table name in the management table, and adding a hash value of the data table corresponding to the data table name to complete the establishment of the mapping relation. When a plurality of data tables need to be established, the mapping relation of each data table is added in sequence. In an example of this embodiment, the management table after the mapping relationship is established is shown in table 2:
TABLE 2
Data table names Hash value
TABLE A a
TABLE B b
Watch C c
After step 203 is executed, the establishment of the management table and the data table is completed, and when the application upgrade is subsequently required, steps 204 to 209 are executed.
204. And acquiring first signature information of each data table from the upgrade package, and searching second signature information corresponding to the identifier of the data table from the management table.
In this embodiment, the upgrade package carries table structure information of the data table, where the table structure information is recorded in a database string of the upgrade package, and for the SQL relational database, the table structure information is recorded in an SQL string. And the client performs signature operation on the table structure information carried in the upgrade package to obtain first signature information. For example, hash calculation is performed on the SQL string in the upgrade package to obtain a corresponding hash value. In practical application, the upgrade package can also directly carry the first signature information calculated by the network side server, and the client side can directly obtain the first signature information. The signature algorithm used by the server and the obtained signature information are the same as those of the client side and will not be described herein.
After the client acquires the table structure information of a certain data table from the upgrade package and acquires the first signature information of the data table, the client may first search for an identifier (e.g., a table name) of the data table from the table structure information, and then search for corresponding second signature information in the management table according to the identifier of the data table.
205. And if the second signature information is found, comparing the first signature information of each data table in the upgrade package with the second signature information corresponding to the identifier of the data table in the management table, and determining whether the stored data table of the old version needs to be updated.
The specific implementation manner of this step is the same as that of step 101, and is not described herein again.
206. And if the old version of the data table is determined to need updating, creating a new version of the data table, replacing the old version of the data table with the new version of the data table, and replacing the second signature information in the management table with the first signature information.
After the data table of the old version is determined to need to be updated, the data table of the old version needs to be replaced by the data table of the new version, so that the data table of the old version is updated, and in order to accurately judge whether the data table needs to be updated or not in the next database updating process, the first signature information needs to be used for replacing the second signature information in the management table, so that the management table is also updated in time.
It should be noted that, the two operations of updating the data table and updating the management table may be performed simultaneously, or the data table may be updated first and then the management table may be updated first, or the management table may be updated first and then the data table may be updated first, and the execution order of the two operations is not limited.
Illustratively, the hash value obtained by the client from the upgrade package is: tables A-a, B-B, C-cc. After the management table is compared, it is determined that the signature information of the table C is changed, and the table C needs to be updated.
The upgrade package carries table structure information of the data table C, which is recorded in the database string of the installation package. And after the SQL character string of the table C is taken from the installation package, the client side creates a corresponding data table in a mode of executing the SQL character string to obtain the table C with the updated table structure, and then replaces the table C stored in the original target directory with the updated table C to finish updating.
In practical applications, please refer to the prior art for an implementation manner of executing the SQL string to create the data table.
If the client replaces the hash value c in table 2 with cc, the management table after replacement is shown in table 3:
TABLE 3
Data table names Hash value
TABLE A a
TABLE B b
Watch C cc
207. And if the data table of the old version does not need to be updated, not performing replacement operation on the data table of the old version.
208. And if the second signature information is not found (namely the mapping relation between the identifier of the data table and the second signature information is not recorded in the management table), creating the data table according to the table structure information of the data table recorded in the upgrade package.
In another case of this embodiment, when a new data table is added to the upgrade package, the client cannot look up the identifier and the hash value of the table in the management table, in which case the data table needs to be added newly. Specifically, the method comprises the following steps:
assuming that a table D is newly added to the upgrade package, the client retrieves the SQL string of the table D from the upgrade package, creates a corresponding data table D by executing the SQL string, then stores the table D in the target directory, and then performs step 209.
209. And adding the mapping relation between the identification of the data table and the first signature information into the management table.
If based on table 3, the client adds a new record of data table D in the management table, and the management table after adding the record is shown in table 4:
TABLE 4
Figure BDA0001278643210000091
Figure BDA0001278643210000101
Further, when a certain data table in the management tables does not have corresponding table structure information in the upgrade package, it indicates that the upgraded version needs to be deleted. And after the client finishes traversing the records in the management table, deleting the records of the data tables and deleting the corresponding data tables in the target directory.
The method for updating the client database provided by the embodiment of the invention can acquire the first signature information of each data table from the upgrade package after the upgrade package is acquired, search the second signature information corresponding to the identifier of the data table from the management table, determine whether the data table of the old version needs to be updated or not by comparing the first signature information with the second signature information when the second signature information can be searched, and directly create the corresponding data table according to the table structure information of the data table recorded in the upgrade package when the second signature information cannot be searched, thereby ensuring that various types of data tables can be quickly and accurately established. In addition, when the original data table is updated and a brand-new data table is created, the management table is updated, so that accurate updating basis is provided for next updating of the database.
Further, as an implementation of the foregoing method, an embodiment of the present invention further provides a device for updating a client database, where the device is located on a client side, and as shown in fig. 3, the device includes:
a determining unit 31, configured to determine whether the saved old version of the data table needs to be updated by comparing the first signature information of each data table in the upgrade package with the second signature information corresponding to the identifier of the data table in the management table; the management table is used for recording the mapping relation between the identification of the data table and the signature information, the first signature information is obtained by calculation according to the table structure information of the data table recorded in the upgrade package, and the second signature information is obtained by calculation according to the table structure information of the data table in the currently installed old version database;
a creating unit 32, configured to create a new version of the data table when the determining unit 31 determines that the old version of the data table needs to be updated;
a replacing unit 33 for replacing the old version of the data table with the new version of the data table created by the creating unit 32;
the replacing unit 33 is further configured to not perform a replacing operation on the old version of the data table when the determining unit 31 determines that the old version of the data table does not need to be updated.
Further, the replacing unit 33 is further configured to replace the second signature information in the management table with the first signature information when the determining unit 31 determines that the old version of the data table needs to be updated.
Further, as shown in fig. 4, the determining unit 31 includes:
a comparing module 311, configured to compare the first signature information of each data table in the upgrade package with the second signature information corresponding to the identifier of the data table in the management table;
a determining module 312, configured to determine that the old version of the data table needs to be updated when the comparison result of the comparing module 311 is that the first signature information is the same as the second signature information;
the determining module 312 is configured to determine that the old version of the data table does not need to be updated when the comparison result of the comparing module 311 is that the first signature information is different from the second signature information.
Further, the creating unit 32 is further configured to create the data table according to the table structure information of the data table recorded in the upgrade package when the mapping relationship between the identifier of the data table and the second signature information is not recorded in the management table;
as shown in fig. 4, the apparatus further includes:
a first adding unit 34, configured to add a mapping relationship between the identifier of the data table and the first signature information to the management table.
Further, the creating unit 32 is further configured to create the management table after receiving the installation package before determining whether the saved old version of the data table needs to be updated by comparing the first signature information of each data table in the upgrade package with the second signature information corresponding to the identifier of the data table in the management table; respectively creating each data table according to the table structure information of each data table in the installation package;
as shown in fig. 4, the second adding unit 35 is configured to add the mapping relationship between the identifier and the signature information of each data table in the installation package to the management table.
The device for updating the client database provided by the embodiment of the invention can record the signature information of each data table through the management table, and the signature information is calculated according to the table structure information of the corresponding data table. When the database needs to be updated, whether the stored data table of the old version needs to be updated or not can be determined by comparing the first signature information of each data table in the upgrade package with the second signature information corresponding to the identifier of the data table in the management table; when it is determined that a certain old version of the data table needs to be updated, the new version of the data table created based on the new table structure information is directly replaced with the old version of the data table without paying attention to the table structure change history related to past version iteration, so that the table structure of the data table cannot be influenced even if the certain version of the data table is deleted for updating, and the method is suitable for the process of cross-version updating; when determining that the data table of an old version does not need to be updated, the data table is not operated, and the loss of user data in the part of the data table is avoided.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It will be appreciated that the relevant features of the method and apparatus described above are referred to one another. In addition, "first", "second", and the like in the above embodiments are for distinguishing the embodiments, and do not represent merits of the embodiments.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of the method and apparatus for client database updates according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (10)

1. A method of client-side database updating, the method comprising:
comparing first signature information of each data table in the upgrade package with second signature information corresponding to the identifier of the data table in the management table, and determining whether the stored data table of the old version needs to be updated; the management table is used for recording the mapping relation between the identification of the data table and the signature information, the first signature information is obtained by calculation according to the table structure information of the data table recorded in the upgrade package, and the second signature information is obtained by calculation according to the table structure information of the data table in the currently installed old version database;
if the data table of the old version needs to be updated, creating a data table of a new version, and replacing the data table of the old version with the data table of the new version;
and if the data table of the old version does not need to be updated, not performing replacement operation on the data table of the old version.
2. The method of claim 1, wherein if it is determined that the old version of the data table needs to be updated, the method further comprises:
replacing the second signature information in the management table with the first signature information.
3. The method of claim 1, wherein determining whether the saved old version of the data table needs to be updated by comparing the first signature information of each data table in the upgrade package with the second signature information corresponding to the identifier of the data table in the management table comprises:
comparing the first signature information of each data table in the upgrade package with the second signature information corresponding to the identifier of the data table in the management table;
if the first signature information is the same as the second signature information, determining that the data table of the old version needs to be updated;
if the first signature information is different from the second signature information, determining that the data table of the old version does not need to be updated.
4. The method according to claim 1, wherein if the management table does not record the mapping relationship between the identifier of the data table and the second signature information, the method further comprises:
creating the data table according to the table structure information of the data table recorded in the upgrade package;
and adding the mapping relation between the identification of the data table and the first signature information into the management table.
5. The method according to any one of claims 1 to 4, wherein before determining whether the saved old version of the data table needs to be updated by comparing the first signature information of each data table in the upgrade package with the second signature information corresponding to the identification of the data table in the management table, the method further comprises:
after receiving the installation package, creating the management table;
respectively creating each data table according to the table structure information of each data table in the installation package;
and adding the mapping relation between the identification and the signature information of each data table in the installation package into the management table.
6. An apparatus for client-side database update, the apparatus comprising:
the determining unit is used for comparing first signature information of each data table in the upgrade package with second signature information corresponding to the identification of the data table in the management table to determine whether the stored old version of the data table needs to be updated; the management table is used for recording the mapping relation between the identification of the data table and the signature information, the first signature information is obtained by calculation according to the table structure information of the data table recorded in the upgrade package, and the second signature information is obtained by calculation according to the table structure information of the data table in the currently installed old version database;
the creating unit is used for creating the data table of the new version when the determining unit determines that the data table of the old version needs to be updated;
a replacing unit configured to replace the old version of the data table with the new version of the data table created by the creating unit;
the replacing unit is further used for not performing replacing operation on the old version data table when the determining unit determines that the old version data table does not need to be updated.
7. The apparatus according to claim 6, wherein the replacing unit is further configured to replace the second signature information in the management table with the first signature information when the determining unit determines that the old version of the data table needs to be updated.
8. The apparatus of claim 6, wherein the determining unit comprises:
the comparison module is used for comparing the first signature information of each data table in the upgrade package with the second signature information corresponding to the identifier of the data table in the management table;
a determining module, configured to determine that the data table of the old version needs to be updated when a comparison result of the comparing module is that the first signature information is the same as the second signature information;
the determining module is configured to determine that the data table of the old version does not need to be updated when the comparison result of the comparing module is that the first signature information is different from the second signature information.
9. The apparatus according to claim 6, wherein the creating unit is further configured to create the data table according to the table structure information of the data table recorded in the upgrade package when the mapping relationship between the identifier of the data table and the second signature information is not recorded in the management table;
the device further comprises:
a first adding unit, configured to add a mapping relationship between an identifier of the data table and the first signature information to the management table.
10. The apparatus according to any one of claims 6 to 9, wherein the creating unit is further configured to create the management table after receiving the installation package before determining whether the saved old version of the data table needs to be updated by comparing the first signature information of each data table in the upgrade package with the second signature information corresponding to the identification of the data table in the management table; respectively creating each data table according to the table structure information of each data table in the installation package;
and the second adding unit is used for adding the mapping relation between the identifier and the signature information of each data table in the installation package into the management table.
CN201710277490.3A 2017-04-25 2017-04-25 Method and device for updating client database Active CN107368513B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710277490.3A CN107368513B (en) 2017-04-25 2017-04-25 Method and device for updating client database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710277490.3A CN107368513B (en) 2017-04-25 2017-04-25 Method and device for updating client database

Publications (2)

Publication Number Publication Date
CN107368513A CN107368513A (en) 2017-11-21
CN107368513B true CN107368513B (en) 2020-08-14

Family

ID=60304771

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710277490.3A Active CN107368513B (en) 2017-04-25 2017-04-25 Method and device for updating client database

Country Status (1)

Country Link
CN (1) CN107368513B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108804561B (en) * 2018-05-22 2021-10-15 北京科东电力控制系统有限责任公司 Data synchronization method and device
CN110858200B (en) * 2018-08-23 2023-06-23 阿里巴巴集团控股有限公司 Method, device and system for recording database information
CN109597819B (en) * 2018-12-07 2020-12-18 北京字节跳动网络技术有限公司 Method and apparatus for updating a database
CN109739835B (en) * 2018-12-29 2023-06-06 中国银联股份有限公司 Data version preservation method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102065413A (en) * 2010-11-17 2011-05-18 北京北方烽火科技有限公司 Database updating method and system, and base station self-starting method and system
CN102662995A (en) * 2012-03-15 2012-09-12 北京播思软件技术有限公司 Method for quickly positioning data updating of mobile phone applications
CN105871584A (en) * 2015-12-02 2016-08-17 乐视体育文化产业发展(北京)有限公司 Method, device and system for updating client configuration in key value pair database

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9576012B2 (en) * 2013-03-14 2017-02-21 Oracle International Corporation Hierarchical tablespace space management

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102065413A (en) * 2010-11-17 2011-05-18 北京北方烽火科技有限公司 Database updating method and system, and base station self-starting method and system
CN102662995A (en) * 2012-03-15 2012-09-12 北京播思软件技术有限公司 Method for quickly positioning data updating of mobile phone applications
CN105871584A (en) * 2015-12-02 2016-08-17 乐视体育文化产业发展(北京)有限公司 Method, device and system for updating client configuration in key value pair database

Also Published As

Publication number Publication date
CN107368513A (en) 2017-11-21

Similar Documents

Publication Publication Date Title
US8621433B2 (en) Managing version information for software components
US10621211B2 (en) Language tag management on international data storage
CN107368513B (en) Method and device for updating client database
US6363524B1 (en) System and method for assessing the need for installing software patches in a computer system
US10489591B2 (en) Detection system and method thereof
JP2011175422A (en) Determination program, method and device
US20200259895A1 (en) Maintenance of a persistent master identifier for clusters of user identifiers across a plurality of devices
CN106843947B (en) Method and device for processing code defects
CN104850565A (en) Metadata management method based on K-V storage system
CN110968478A (en) Log collection method, server and computer storage medium
CN111984264B (en) Static library generation method and device
CN110795447A (en) Data processing method, data processing system, electronic device, and medium
CN108959548B (en) Service request processing method and device
CN111221742A (en) Test case updating method and device, storage medium and server
CN111488483A (en) Method, device, terminal and non-transitory computer-readable storage medium for updating song library
CN114756333B (en) Mirror image processing method and device, electronic equipment and readable medium
CN115905307A (en) Data storage method and device, electronic equipment and storage medium
CN112817931B (en) Incremental version file generation method and device
CN114020813A (en) Data comparison method, device and equipment based on Hash algorithm and storage medium
CN109522014B (en) Algorithm processing method based on new product development, electronic device and readable storage medium
CN109582330B (en) Data model upgrading method, device, equipment and readable storage medium
CN112100479A (en) Application access method and device, electronic equipment and storage medium
US9870387B2 (en) Method, server and computer-readable recording media for setting transactions of multiple data objects
CN115185559A (en) Method and device for determining sequence of software versions
CN115190015A (en) Soft load system configuration method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20200918

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200918

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Patentee before: Alibaba Group Holding Ltd.

TR01 Transfer of patent right