Method for storing data, related device and computer program product

By generating a syntax tree to determine the associated fields and store them in a separate page of the target database, the problems of data transfer consistency and effectiveness between databases are solved, and data reading performance is improved.

CN118916355APending Publication Date: 2024-11-08SHANGHAI BILIBILI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410958688.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

The prior art is difficult to ensure data consistency during the data transfer process between databases, resulting in a decline in the quality of transfer, and the traditional point-to-point communication method cannot effectively improve the efficiency of database usage.

Method used

By generating a syntax tree, determine the associated fields, and determine whether to store them in full into a separate page of the target database based on the total length of the associated fields, ensuring consistency of data transfer and read performance.

Benefits of technology

Ensure data consistency during the data transfer process, and significantly improve the read performance of the transcribed data and fields, avoiding the problems of data inconsistency and storage overflow.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118916355A_ABST
    Figure CN118916355A_ABST
Patent Text Reader

Abstract

The invention provides a data storage method, a related device and a computer program product. The method comprises the following steps: generating a syntax tree based on fields stored in a to-be-transferred database; in response to a set of associated fields determined from the fields based on the syntax tree, the total length of the set of associated fields is obtained, and all associated fields included in the set of associated fields serve the same function item; and in response to the condition that the total length of the group of associated fields is smaller than or equal to the length threshold value, completely storing the group of associated fields into a first independent page of the target database. Therefore, on the basis of guaranteeing the consistency of the transferred data in the process of transferring the data and the fields to other databases, the reading performance of the transferred data and the transferred fields can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and device for storing data, an electronic device, a computer-readable medium, and a computer program product. Background Art

[0002] With the development of society, computer technology is developing day by day. In the process of using computer technology to provide services, it is often chosen to use the form of a database to store data, code, etc., so that the data and code can be directly obtained by calling the database later. In this way, it is expected to achieve the purpose of quickly calling services and functions, or to provide underlying support for services and functions.

[0003] In this context, database configuration forms and architectures vary based on different needs. For example, for scenarios where autonomous controllability is required, you may prefer to configure an open source autonomous and controllable database rather than a private database owned by some service providers. Therefore, on the actual business side, it is often necessary to update and adjust the database actually used based on the scenario and needs.

[0004] Usually, database updates and switches are done by transferring data between databases to achieve the purpose of changing and adjusting the database actually used. Therefore, how to ensure the quality of data transfer between databases and improve the efficiency of database use is worthy of attention and urgent need. Summary of the invention

[0005] Multiple aspects of the present application provide a method, device, electronic device, computer-readable storage medium and computer program product for storing data, which can ensure the consistency of transcribed data during the process of transferring data and fields to other databases, and take advantage of the transfer opportunity to adjust the data storage form and method in the data to be transferred, thereby improving the reading performance of the transcribed data and fields.

[0006] In one aspect of the present application, a method for storing data is provided, comprising: generating a syntax tree based on fields stored in a database to be transferred; in response to determining a group of associated fields from the fields based on the syntax tree, obtaining a total length of the group of associated fields, wherein each associated field included in the group of associated fields serves the same function item; in response to the total length of the group of associated fields being less than or equal to a length threshold, storing the group of associated fields in its entirety in a first separate page of a target database.

[0007] Another aspect of the present application provides a device for storing data, including: a syntax tree generation module, configured to generate a syntax tree based on fields stored in a database to be transferred; an associated field determination module, configured to obtain a total length of a group of associated fields in response to determining a group of associated fields from the fields based on the syntax tree, wherein each associated field included in the group of associated fields serves the same function item; and a first field storage module, configured to store a group of associated fields in their entirety into a first separate page of a target database in response to the total length of the group of associated fields being less than or equal to a length threshold.

[0008] Another aspect of the present application provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for storing data provided above.

[0009] In another aspect of the present application, a computer-readable storage medium is provided, on which computer program instructions are stored. The computer program instructions can be executed by a processor to implement the method for storing data provided above.

[0010] In another aspect of the present application, a computer program product includes a computer program having computer program instructions stored thereon. When the computer program is executed by a processor, the method for storing data as provided above can be implemented.

[0011] In the solution provided by the embodiment of the present application, a syntax tree is generated based on the fields stored in the database to be transferred; in response to determining a group of associated fields from the fields based on the syntax tree, the total length of the group of associated fields is obtained, wherein each associated field included in the group of associated fields serves the same function item; in response to the total length of the group of associated fields being less than or equal to the length threshold, the group of associated fields is completely stored in the first separate page of the target database. In this way, the reading performance of the transferred data and fields can be improved on the basis of ensuring the consistency of the transferred data in the process of transferring the data and fields to other databases. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0013] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0014] Figure 1 A schematic diagram of a data storage process provided by an embodiment of the present application;

[0015] Figure 2 A schematic diagram of a data storage process in an application scenario provided by another embodiment of the present application;

[0016] Figure 3 A schematic diagram of a process for generating a syntax tree provided in an embodiment of the present application;

[0017] Figure 4 A schematic diagram of the structure of a device for storing data provided in one embodiment of the present application;

[0018] Figure 5 The present invention is a schematic diagram of the structure of an electronic device suitable for implementing the solution in the embodiment of the present application.

[0019] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION

[0020] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0021] In a typical configuration of the present application, the terminal and the equipment of the service network each include one or more processors (CPU), input / output interface, network interface and memory.

[0022] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0023] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer program instructions, data structures, modules of programs or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0024] As discussed above, how to ensure the quality of data transcription between databases and improve the efficiency of database use is worthy of attention and an urgent need.

[0025] In some solutions, when performing the transcription, it is chosen to directly establish communication between the two databases, and then directly based on the "point-to-point" communication, to sequentially and continuously transmit the data in the original database to achieve data transcription.

[0026] However, in this way, if the storage forms (e.g., storage tables, storage pages) of the two databases are different, or the data sizes allowed to be stored in different storage specifications (e.g., storage tables, storage pages) are different, the transfer quality will obviously decline, or it will be difficult to ensure the transfer quality, and data inconsistency will occur. Moreover, this "point-to-point" transfer form only "retains" the data storage form and method in the database to be transferred, so it may also "inherit" the "unreasonable" storage form and content that may potentially exist in the database to be transferred.

[0027] In this regard, an embodiment of the present application provides a method for storing data, which generates a syntax tree based on the fields stored in the database to be transferred; in response to determining a group of associated fields from the fields based on the syntax tree, the total length of the group of associated fields is obtained, wherein each associated field included in the group of associated fields serves the same function item; in response to the total length of the group of associated fields being less than or equal to a length threshold, the group of associated fields is completely stored in the first separate page of the target database. In this way, the reading performance of the transcribed data and fields can be improved on the basis of ensuring the consistency of the transcribed data during the process of transferring the data and fields to other databases.

[0028] In actual scenarios, the execution subject of the method can be a user device, or a device formed by integrating a user device and a network device through a network, or an application running on the above device. The user device includes but is not limited to various terminal devices such as computers, mobile phones, tablet computers, smart watches, and bracelets. The network device includes but is not limited to network hosts, single network servers, multiple network server sets, or cloud computing-based computer sets. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing (Cloud Computing), where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computer sets.

[0029] When the execution subject is software, it can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules, or as a single software or software module, and no specific limitation is made here.

[0030] Figure 1 A data storage process 100 provided in an embodiment of the present application is shown. The process 100 includes at least the following processing steps:

[0031] (Step) S101, generating a syntax tree based on the fields stored in the database to be transferred.

[0032] In an embodiment of the present application, the execution subject may generate a syntax tree based on the fields stored in the database to be transferred after determining the database to be transferred (i.e., the database providing the data to be stored). For example, the execution subject may extract all the fields (or codes, data, etc.) stored therein from the database to be transferred, and then generate a syntax tree based on the analysis results of all these fields. For example, the execution subject may determine whether there is an association relationship between fields through the calling relationship, data sharing relationship, etc. between the fields and other fields.

[0033] The syntax tree can be generated based on the association between codes, or whether there is logic. For example, fields can be used as nodes in the syntax tree, and the connection between nodes can be determined by the connection and association between nodes to generate "branches" (or "connecting lines") between nodes. In other words, there are "branches", or two nodes connected by "branches" can be determined to have an association and logical relationship.

[0034] For example, for field A, if it needs to call field B to implement its own content, the execution subject can determine that there is an association between field A and field B. In other words, field C depends on the processing result of field D to be used and achieve its purpose, so there is also an association between field C and field D. Correspondingly, in the syntax tree, there will be a "branch" between field A and field B (the corresponding nodes of each).

[0035] In some scenarios, a field that has an association relationship with at least one other field can also be understood as a field that has a connection and relationship with at least one other field in terms of processing logic, processing structure, etc. Accordingly, for the convenience of description, a field that has such a logical connection with at least one other field can also be described as an associated field.

[0036] Correspondingly, nodes that do not have the above-mentioned association relationship or logical relationship with other fields can be recorded "independently" in the syntax tree, that is, there is no "branch" with any node.

[0037] For easier understanding, you can refer to Figure 2 . Figure 2 A process 200 of storing data in a specific application scenario provided by another embodiment of the present application is shown.

[0038] In the process 200, the database 210 may be used as the database to be transferred. In the process 200, the database 210 may include and provide at least fields 215-1, 215-2, 215-3, 215-4, 215-5 and 215-6.

[0039] Further, the execution subject may generate a syntax tree 220 based on fields 215-1, 215-2, 215-3, 215-4, 215-5, and 215-6. For example, in the syntax tree 220, fields 215-1, 215-2, and 215-3 may be exemplified as corresponding to the same function item, or in other words, there is an association relationship between fields 215-1, 215-2, and 215-3. For another example, in the syntax tree 220, fields 215-4 and 215-5 may also be exemplified as corresponding to the same function item.

[0040] S102: Detect whether a group of related fields can be determined from the fields based on the syntax tree.

[0041] In an embodiment of the present application, after generating a syntax tree based on the above step S101, the execution entity may detect whether a group of associated fields can be determined from the fields based on the syntax tree, that is, detect whether there is a "branch" in the syntax tree.

[0042] If it exists, the execution subject can determine (a group of) field association fields based on the (association) fields corresponding to these nodes after determining at least two (association) nodes connected in sequence by branches. Accordingly, a group of association fields can be used to implement a functional logic, that is, each association field included in a group of association fields serves the same functional item.

[0043] Furthermore, if the execution subject can determine a group of associated fields, S103 may be continued.

[0044] You can continue to refer to Figure 2 In the process 200 , the execution body may detect whether a group of associated fields can be determined from the fields 215 - 1 , 215 - 2 , 215 - 3 , 215 - 4 , 215 - 5 , and 215 - 6 based on the syntax tree 220 ?

[0045] For example, in process 200, the execution entity may determine a set of associated fields 225-1 (eg, a set of associated fields consisting of fields 215-1, 215-2, and 215-3), and another set of associated fields (eg, another set of associated fields consisting of fields 215-4 and 215-5).

[0046] S103, obtaining the total length of a group of associated fields.

[0047] In an embodiment of the present application, when the execution subject is able to determine a group of associated fields, it can obtain the length of the group of associated fields, that is, the sum of the lengths of the respective associated fields included in the group of associated fields.

[0048] Continue to refer Figure 2 In process 200, the execution entity may determine the total length of fields 215-1, 215-2, and 215-3, and the total length of fields 215-4 and 215-5, respectively.

[0049] S104: Detect whether the total length of a group of associated fields is less than or equal to a length threshold.

[0050] In an embodiment of the present application, when the total length is determined based on the above step S103, the execution subject can select whether the determined total length is less than or equal to the length threshold. In some embodiments, the length threshold can be determined based on the length of the field that is pre-configured and is to be transferred as a whole. For example, the length threshold can be determined based on the length of the field unit that is expected and allowed to be stored separately in advance. For example, a method of selecting X length as the length threshold can be selected to indicate that the execution subject allows a group of associated fields with a total length less than or equal to X length to be stored completely and as a whole (for example, stored in the same single page of the database).

[0051] In some embodiments, the length threshold can be determined based on the upper limit of the page field length of the target database of the subsequently transferred and received field. Thus, when it is expected to completely store the associated field corresponding to a function item or function logic, the storage capacity requirement of the database of the receiving field is taken into account to avoid storage overflow and data loss caused by directly storing data that does not meet the upper limit of the database page length.

[0052] Continue to refer Figure 2 In process 200, the execution subject can determine the total length of fields 215-1, 215-2, 215-3, and the total length of fields 215-4 and 215-5, and then compare the two total lengths with the length threshold. For ease of understanding, the lengths of fields 215-1, 215-2, 215-3, 215-4, and 215-5 are all equal (for ease of understanding, the "equal length" is described as the standard length), and the length threshold is 10 of the "standard length". Exemplarily, the value "10" can be determined based on the longest total length of fields allowed to be stored in each individual page of the target database 230, which is exemplified as the transfer destination.

[0053] After comparison, it is found that the total length of fields 215-1, 215-2 and 215-3, and the total length of fields 215-4 and 215-5 can all meet the requirement of the length threshold (ie, are actually smaller than the length threshold).

[0054] Furthermore, if the execution subject determines that the total length of a group of associated fields is less than or equal to the length threshold, it may choose to continue to execute S105.

[0055] S105, storing a set of associated fields completely into a first separate page of the target database.

[0056] In an embodiment of the present application, the execution subject may store a set of associated fields determined based on the above step S102 in a separate page (described as the first separate page here for ease of description) of the target database. A separate page may be the smallest addressable unit in a computer storage system. For example, a separate page may be a "separate, independent" page (Page) in a memory or a "separate, independent" sector (Sector) on a disk. The specific form of a separate page usually depends on the specific storage device used and the corresponding system design. For example, in a computer memory (RAM), a separate page may usually be a continuous block of address space. In a disk storage system, a separate page may be a sector, that is, a minimum readable and writable unit. In some embodiments, the execution subject may usually select a separate page that is not stored with other data to perform complete storage of a set of associated fields.

[0057] In some embodiments, for the purpose of improving the utilization rate of a separate page, the execution subject may also select a separate page that has already stored other data but whose remaining space can still meet the complete and overall storage purpose of the first associated field. Accordingly, in such a manner, the remaining space is at least greater than the length threshold, so as to avoid the execution subject mistakenly storing a group of associated fields into the first separate page with insufficient remaining space when executing the storage decision, thereby causing data overflow.

[0058] You can continue to refer to Figure 2 , for example, the target database 230 may provide separate pages 231 and 233. Then, the execution entity stores a set of associated fields consisting of fields 215-1, 215-2, and 215-3 in separate page 231, and updates separate page 231 to 231'. Similarly, the execution entity may also store another set of associated fields consisting of fields 215-4 and 215-5 in separate page 233, and update separate page 233 to 233'.

[0059] In some embodiments, if the execution entity detects in the above step S104 that the total length of a group of associated fields is greater than the length threshold, that is, the total length of a group of associated fields cannot meet the requirements of "complete" storage, the execution entity can choose a distributed, separate storage method to complete the storage operation of a group of associated fields to avoid data loss.

[0060] Specifically, the above process 100 may further include S106, which can be executed when it is determined in S104 that the total length of a group of associated fields is greater than a length threshold.

[0061] S106, storing the associated fields of a group of associated fields whose lengths are equal to the length threshold into a first separate page.

[0062] Specifically, when the overall length of a group of associated fields overflows and does not meet the length threshold requirement, the execution subject may split the group of associated fields, and then store the portion of the group of associated fields that meets the length threshold requirement (i.e., the portion of the group of associated fields whose length is equal to the length threshold) into the first separate page. Generally, the execution subject may choose to continuously select the portion of the group of associated fields whose length is equal to the length threshold from the beginning (or logical starting point) of the group of associated fields.

[0063] In some embodiments, if the extracted length is equal to the length threshold portion, the position of the split will cause a certain associated field in a group of associated fields (usually the associated field at the end of the extracted portion) to be missing or incomplete, and the execution subject may also choose to use the previous associated field of the "certain associated field" as the end of the portion stored in the first separate page. It should be understood that in this way, the length of the portion of a group of associated fields actually stored in the first separate page by the final execution subject may actually be lower than the length threshold. In this way, it is possible to avoid improper splitting of a group of associated fields in the above-mentioned "certain associated field" portion due to insufficient length allowed by compression, and avoid field errors and losses caused by improper splitting.

[0064] S107, storing the portion of a group of associated fields that is not stored in the first separate page in a second separate page.

[0065] Specifically, after completing the storage for the first separate page, the execution subject may choose to store the portion of the group-associated field that is not stored in the first separate page in another separate page different from the first separate page (described as a second separate page for ease of understanding). It should be understood that the second separate page may also select a separate page that has other fields stored but has a surplus space that meets the requirements or a separate page that does not store other fields, as in the case of the first separate page, and will not be described in detail here.

[0066] Therefore, a group of associated fields whose lengths do not meet the length threshold requirement are stored in a distributed storage manner to avoid data loss.

[0067] In some embodiments, the space provided by the second single page may still not be able to meet the needs of a set of associated fields. In this case, the execution entity may similarly continue to look for more second single pages to store the parts of the fields that the current second single page cannot store. This will not be repeated here.

[0068] Then, the method for storing data provided by the present application generates a syntax tree based on the fields stored in the database to be transferred; in response to determining a group of associated fields from the fields based on the syntax tree, the total length of the group of associated fields is obtained, wherein each associated field included in the group of associated fields serves the same function item; in response to the total length of the group of associated fields being less than or equal to the length threshold, the group of associated fields is completely stored in the first separate page of the target database. In this way, the reading performance of the transcribed data and fields can be improved on the basis of ensuring the consistency of the transcribed data in the process of transferring the data and fields to other databases.

[0069] In some embodiments, the execution subject may also determine at least two groups of associated fields from the fields based on the syntax tree. For example, the database to be transferred may store at least two or more fields corresponding to different functional items. In such a case, the execution subject can perform the transfer operation of each group of associated fields in parallel (i.e., the operation of storing the fields in the first separate page, or the combination of the first separate page and the second separate page) to improve the processing efficiency of the transfer operation.

[0070] However, in such a manner, the same field may be used at the same time for two different groups of associated fields. For example, a certain field may belong to both the first group of associated fields and the second group of associated fields, or in other words, the functional items implemented by the first group of associated fields and the second group of associated fields may require a certain field at the same time. That is, the first group of associated fields and the second group of associated fields intersect on a certain field. For ease of understanding, the field corresponding to the "intersecting" relationship portion can be described as an "intersecting field". In the case where there are intersecting fields that can be simultaneously attributed to the first group of associated fields and the second group of associated fields in at least two groups of associated fields, the execution subject can respond to this and first attribute it to a group of associated fields that is transferred to the target database earlier.

[0071] For example, if the first group of associated fields and the second group of associated fields are executed in parallel and simultaneously to the target database, if there is an intersecting field U field, the execution subject can determine the transfer timing of the first group of associated fields and the second group of associated fields for the U field respectively. For example, when the U field is transferred in the first group of associated fields at the X1th second after the estimated start of transfer, and when the U field is transferred in the second group of associated fields at the X2th second after the estimated start of transfer (where X2 is greater than X1), the execution subject can determine that for the U field, the transfer timing of the first group of associated fields is earlier than that of the second group of associated fields.

[0072] Accordingly, when it is determined that the first group of associated fields stores the cross-fields into the target database earlier than the second group of associated fields, the execution subject may preferentially assign the cross-fields to the first group of associated fields. Then, the execution subject may further copy the cross-fields to obtain the copy result of the cross-fields. Then, the execution subject assigns the copy result of the cross-fields to the second group of associated fields for transfer of the second group of associated fields.

[0073] Therefore, in this way, for the cross-field, it is possible to copy it so that each required group of associated fields can store the cross-field completely and independently. When each group of associated fields is called, it can directly use the cross-field based on the "complete" storage result, without the need to perform additional call operations on the fields stored in other groups. In addition, this method can also ensure that the group of associated fields that are transferred first and transferred first can store the cross-field first, so as to reduce the efficiency impact on the overall transfer of each group caused by waiting for the "copy result".

[0074] In some embodiments, when generating a syntax tree, the execution entity may also specifically adjust and reduce the number of fields used in generating the syntax tree by "distinguishing fields that potentially have associated relationships" to improve the generation efficiency and quality of the syntax tree.

[0075] For this, please refer to Figure 3 , Figure 3 The process 300 of generating a syntax tree provided by an embodiment of the present application is shown. For example, the process 300 can be used as a replacement or alternative implementation of step S101 shown in the above process 100. The process 300 includes at least the following processing steps:

[0076] S301, detecting the file name of the initial field file included in the database to be transferred.

[0077] Specifically, the execution entity may detect the file names of the initial field files included in the database to be transferred, so as to filter out files that generally record fields for implementing “functional items”.

[0078] In some embodiments, the execution entity may further narrow the scope of the initial field files by filtering the file types. For example, the execution entity may select files with the suffix "java" in the project source code to select the initial field files.

[0079] S302: Generate a syntax tree based on the fields stored in the target initial field file whose file names include preset characters.

[0080] Specifically, based on the above S301, the execution entity can select a target initial field file based on the preset characters included in the file name. For example, for a database scenario, the preset characters can be mapper characters that exist in the corresponding "mapping" file. Accordingly, the execution entity can further generate a syntax tree based on the fields stored in these target initial field files. Thus, by focusing on fields that are more likely to be used to implement functions and have associated relationships through the "file function" method, the scope of the fields for generating the syntax tree can be narrowed to improve the efficiency and quality of syntax tree generation.

[0081] For example, in the above-mentioned "java" scenario, the execution entity can parse the target initial field file into an abstract syntax tree according to the java syntax, and use regular expressions to obtain the fields that include annotations of the selection, deletion, and update function items (that is, the fields in these parts usually operate on the database table).

[0082] In some embodiments, before executing the above S301, in order to avoid recognition errors caused by differences in uppercase and lowercase letters in the file name, the execution subject may also choose to perform a name rewriting operation on the file name of the initial field file included in the database to be transferred before S301. The name rewriting operation is used to rewrite the uppercase letters in the file name to lowercase letters.

[0083] For example, the above process 300 also includes S303, performing a name rewriting operation on the file name of the initial field file included in the database to be transferred.

[0084] Accordingly, after the name rewriting operation is completed, when the execution subject subsequently executes S301 and S302, the file name of the rewritten initial field file can be used as a substitute to perform file name detection and generate syntax tree operations. For example, for S301, the execution subject can further choose to perform the detection of the file name obtained after the name rewriting operation of the initial field file included in the database to be transferred. Thus, by introducing the name rewriting operation, recognition errors caused by name case errors can be avoided and recognition quality can be improved.

[0085] Based on any of the above embodiments, for the part other than a group of associated fields stored in the database to be transferred (i.e., the part of the fields to be transferred that is not a group of associated fields), the execution subject may choose to store the part other than a group of associated fields into the first separate page and / or the second separate page after completing the processing for each group of associated fields. The execution subject may choose to detect whether there is any remaining space in the separate page that has at least partially stored a group of associated fields. The separate page includes the first separate page and / or the second separate page.

[0086] Accordingly, when the execution entity determines that the target individual page in the first individual page and / or the second individual page includes surplus space, it can further choose to store the part of the field that is not a group of associated fields into the surplus space to complete the entire transfer of the fields stored in the database to be transferred.

[0087] It should be understood that, when the remaining space of the first separate page and the second separate page is exhausted (i.e., the separate page that has currently stored at least a part of a set of associated fields has been completely filled and can no longer provide remaining space), there are still fields that have not been transferred out and successfully stored in the target database. For these fields, the execution subject can continue to choose to use a new separate page that does not store a set of associated fields to perform the transfer. That is, when the execution subject determines that there is no available remaining space, the execution subject can choose to open a new "separate page" to perform the transfer to ensure the integrity of the transferred data.

[0088] It should be understood that when using a "newly opened separate page" to transfer non-group related fields, the execution entity can select fields that are less than or equal to the storage upper limit of the separate page to perform storage, similar to the storage for the first separate page discussed above, to avoid overflow, which will not be repeated here.

[0089] For example, we can continue to refer to Figure 2 In process 200, for field 215-6 that is not included in a group of associated fields, it may be selected to be stored in separate page 233' if there is spare space in separate page 233', for example. After the execution entity completes the storage operation for field 215-6, separate page 233' may be updated to separate page 233" accordingly.

[0090] It should be understood that the above process is only an example, and the execution entity may also store field 215-6 in separate page 213' in a similar manner as discussed in this article based on different requirements (for example, under the strategy of giving priority to filling separate pages with smaller remaining space, given that the current remaining space of separate page 231' is smaller than that of separate page 233', the execution entity may choose to store field 215-6 in separate page 231', and the description will not be repeated here.

[0091] In some embodiments, when the execution subject stores the part of the field that is not a group of associated fields into the margin space (of the target single page), the execution subject may also choose to store the part of the field that is not a group of associated fields into the margin space continuously based on the creation time of the field in the database to be transferred from early to late. Thus, the fields created earlier in the database to be transferred can be transferred earlier, so as to reflect the correspondence and consistency between the database to be transferred and the target database in terms of storage timing and sequence.

[0092] The present application also provides a device for storing data. The structure of the device is as follows: Figure 4 The device 400 shown. The device 400 includes: a syntax tree generation module 410, configured to generate a syntax tree based on the fields stored in the database to be transferred; an associated field determination module 420, configured to obtain the total length of a group of associated fields in response to determining a group of associated fields from the fields based on the syntax tree, wherein each associated field included in the group of associated fields serves the same function item; a first field storage module 430, configured to store a group of associated fields completely into a first separate page of the target database in response to the total length of the group of associated fields being less than or equal to a length threshold.

[0093] In some embodiments, the device 400 also includes: a second field storage module, configured to store the associated fields in a group of associated fields whose length is equal to the length threshold into a first separate page in response to the total length of a group of associated fields being greater than a length threshold; and a third field storage module, configured to store the portion of a group of associated fields that is not stored in the first separate page into a second separate page.

[0094] In some embodiments, the length threshold is determined based on an upper limit on the page field length of the target database.

[0095] In some embodiments, at least two groups of associated fields are determined from the fields based on the syntax tree, and the device 400 also includes: a cross-field attribution module, configured to attribute the cross-field to the first group of associated fields in response to the existence of a cross-field that is simultaneously attributed to the first group of associated fields and the second group of associated fields in at least two groups of associated fields, wherein the first group of associated fields stores the cross-field into the target database earlier than the second group of associated fields; a cross-field copy module, configured to copy the cross-field to obtain a copy result of the cross-field; and a copy result attribution module, configured to attribute the copy result to the second group of associated fields.

[0096] In some embodiments, the syntax tree generation module 410 includes: a text name detection submodule, configured to detect the file name of the initial field file included in the database to be transferred; a syntax tree generation submodule, configured to generate a syntax tree based on the fields stored in the target initial field file including preset characters in the file name.

[0097] In some embodiments, the device 400 also includes: a name rewriting module, which is configured to perform a name rewriting operation on the file name of the initial field file included in the database to be transferred, wherein the name rewriting operation is used to rewrite the capital letter part in the file name to lowercase; and a text name detection submodule, which is further configured to detect the file name obtained after the name rewriting operation of the initial field file included in the database to be transferred.

[0098] In some embodiments, the device 400 also includes: a margin space detection module, configured to detect whether there is any margin space in the first separate page that has stored a group of associated fields; a non-associated field storage module, configured to store the portion of the field that is not a group of associated fields into the margin space in response to the target separate page including margin space.

[0099] In some embodiments, the non-associated field storage module is further configured to, in response to the target single page including a surplus space, continuously store the portion of the field that is not a group of associated fields into the surplus space based on the field creation time in the database to be transferred from early to late.

[0100] Based on the same inventive concept, an electronic device, a readable storage medium and a computer program product are also provided in the embodiments of the present application. The method corresponding to the electronic device may be the method for storing data in the aforementioned embodiment, and its principle of solving the problem is similar to that of the method. The electronic device provided in the embodiments of the present application includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the methods and / or technical solutions of the aforementioned multiple embodiments of the present application.

[0101] The electronic device may be a user device, or a device formed by integrating a user device and a network device through a network, or an application running on the above device. The user device includes but is not limited to various terminal devices such as computers, mobile phones, tablet computers, smart watches, and bracelets. The network device includes but is not limited to network hosts, single network servers, multiple network server sets, or cloud computing-based computer sets, which can be used to implement some processing functions when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing, where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computer sets.

[0102] Figure 5The structure of an electronic device suitable for implementing the method and / or technical solution in the embodiment of the present application is shown, and the electronic device 500 includes a central processing unit (CPU, Central Processing Unit) 501, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM, Read Only Memory) 502 or the program loaded from the storage part 508 to the random access memory (RAM, Random Access Memory) 503. In RAM 503, various programs and data required for system operation are also stored. CPU 501, ROM 502 and RAM 503 are connected to each other through bus 505. Input / output (I / O, Input / Output) interface 504 is also connected to bus 505.

[0103] The following components are connected to the I / O interface 504: an input section 506 including a keyboard, a mouse, a touch screen, a microphone, an infrared sensor, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), an LED display, an OLED display, etc., and a speaker, etc.; a storage section 508 including one or more computer-readable media such as a hard disk, an optical disk, a magnetic disk, a semiconductor memory, etc.; and a communication section 509 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet.

[0104] In particular, the methods and / or embodiments in the embodiments of the present application may be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. When the computer program is executed by the central processing unit (CPU) 501, the above functions defined in the method of the present application are executed.

[0105] Another embodiment of the present application further provides a computer-readable storage medium and a computer program product, on which computer program instructions are stored. The computer program instructions can be executed by a processor to implement the methods and / or technical solutions of any one or more embodiments of the present application.

[0106] Specifically, the present embodiment can adopt any combination of one or more computer-readable media. Computer-readable media can be computer-readable signal media or computer-readable storage media. Computer-readable storage media can be, for example, systems, devices or devices including but not limited to electricity, magnetism, light, electromagnetic, infrared, or semiconductors, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this document, computer-readable storage media can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0107] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than a computer readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0108] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0109] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0110] The flow chart or block diagram in the accompanying drawings shows the possible architecture, function and operation of the equipment, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated system for hardware that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0111] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0112] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules and units is only a logical function division. There may be other division methods in actual implementation. For example, with units as an example, multiple units or page components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0113] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0114] In addition, each functional module or unit in each embodiment of the present application may be integrated into one processing module or unit, or each module or unit may exist physically separately, or two or more units may be integrated into one module or unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules or units.

[0115] The above-mentioned integrated modules and units implemented in the form of software function modules and units can be stored in a computer-readable storage medium. The above-mentioned software function modules and units are stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform some steps of the methods of each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.

[0116] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

[0117] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in a device claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

Claims

1. A method of storing data, It is characterized in that include: Generate a syntax tree based on the fields stored in the database to be transferred; In response to determining a group of associated fields from the field based on the syntax tree, obtaining a total length of the group of associated fields, wherein each associated field included in the group of associated fields serves a same function item; In response to the total length of the group of associated fields being less than or equal to a length threshold, the group of associated fields is completely stored in a first separate page of the target database.

2. The method according to claim 1, It is characterized in that Also includes: In response to a total length of the group of associated fields being greater than the length threshold, storing a portion of the associated fields of the group of associated fields whose length is equal to the length threshold into the first separate page; The portion of the set of associated fields that is not stored in the first separate page is stored in a second separate page.

3. The method according to claim 1, It is characterized in that The length threshold is determined based on an upper limit of a page field length of the target database.

4. The method according to claim 1, determining at least two groups of associated fields from the fields based on the syntax tree, It is characterized in that Also includes: In response to the presence of a crossover field that is simultaneously attributed to a first group of associated fields and a second group of associated fields in the at least two groups of associated fields, attributing the crossover field to the first group of associated fields; Copying the intersection field to obtain a copy result of the intersection field; The copied results are attributed to the second set of associated fields.

5. The method according to claim 1, It is characterized in that The generating a syntax tree based on the fields stored in the database to be transferred includes: Detecting the file name of the initial field file included in the database to be transferred; The syntax tree is generated based on the fields stored in the target initial field file whose file name includes preset characters.

6. The method according to claim 5, It is characterized in that Also includes: Performing a name rewriting operation on the file name of the initial field file included in the database to be transferred, wherein the name rewriting operation is used to rewrite the capital letter part of the file name into lowercase; and The detecting of the file name of the initial field file included in the database to be transferred includes: The file name obtained after the name rewriting operation is performed on the initial field file included in the database to be transferred.

7. The method according to claim 1 or 2, It is characterized in that Also includes: Detecting whether there is any remaining space in the individual pages that have at least partially stored the group of associated fields, wherein the individual pages include the first individual page and / or the second individual page; In response to the target single page including the margin space, a portion of the field that is not the group of associated fields is stored in the margin space.

8. The method according to claim 7, It is characterized in that In response to the target single page including the margin space, storing the portion of the field that is not the group of associated fields into the margin space comprises: In response to the target single page including the margin space, based on the creation time of the fields in the database to be transferred from earliest to latest, the parts of the fields that are not the group of associated fields are continuously stored in the margin space.

9. A device for storing data, include: A syntax tree generation module is configured to generate a syntax tree based on the fields stored in the database to be transferred; an associated field determination module, configured to, in response to determining a group of associated fields from the field based on the syntax tree, obtain a total length of the group of associated fields, wherein each associated field included in the group of associated fields serves the same function item; The first field storage module is configured to store the group of associated fields completely into a first separate page of the target database in response to the total length of the group of associated fields being less than or equal to a length threshold.

10. An electronic device, wherein the electronic device include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.

11. A computer readable medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the method according to any one of claims 1 to 8.

12. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Method for publishing tree -type structure database as distributed XML database

    CN101216824A

  • Storage method and system for service data, computer equipment and storage medium

    CN110990403A

  • Data processing method and device, retrieval method and device, equipment and storage medium

    CN116521816A

  • Method and device for processing index data structure

    CN116561246A

  • Blockchain-based hierarchical data storage

    US20200183898A1