Record table generation method and device, equipment and storage medium

By reading the data table definition file to generate the SPI implementation class and parsing the modification content, it solves the problem of low efficiency and high error rate of new data tables in the database, and achieves the effect of quickly generating a database modification record table.

CN118535573AActive Publication Date: 2024-08-23BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202410532243.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-29
Publication Date
2024-08-23
Estimated Expiration
2044-04-29

AI Technical Summary

Technical Problem

In the prior art, when adding a data table to the database, developers need to manually view and write SPI implementation classes, which results in low efficiency and error-prone, and makes it impossible to quickly generate a database modification record table.

Method used

By reading the data table definition file, the corresponding data table and SPI implementation classes are generated and stored in the database. When the data table is modified, the modified content is parsed through the SPI implementation class and synchronized to the database modification record table to avoid manual writing of SPI implementation. kind.

Benefits of technology

It achieves rapid generation of database modification record tables, improves the efficiency of data table access to the database, reduces the possibility of manual writing errors, and simplifies the display process of database modification records.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535573A
    Figure CN118535573A
Patent Text Reader

Abstract

The embodiment of the invention relates to the technical field of data processing, in particular to a record table generation method and device, equipment and a storage medium, and aims at rapidly generating a database modification record table. The method comprises the steps that an input file is read, and the file type of the input file is determined; under the condition that the file type of the input file is a data table definition file, a corresponding data table and an SPI implementation class are generated according to field information in the data table definition file, and the SPI implementation class is used for recording the corresponding relation between field content and field description of each field in the data table; storing the data table into a database; under the condition that the data in the data table is modified, analyzing an information change record corresponding to the data table through the SPI implementation class; and loading the modified content in the data table obtained by analysis into a database modification record table.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of data processing technology, and specifically, to a method, device, equipment and storage medium for generating a record table. Background Art

[0002] The server generally stores data tables that record various types of information in the database. The system requires that each important field in each data table needs a complete modification record. Currently, the modifications in each data table in the system are recorded through the database modification record table. When the modification records of the data table are displayed in the database modification record table, the fields in each data table are displayed through the SPI (Service Provider Interface, service discovery provider) mechanism.

[0003] In the prior art, when a new data table is added to a database, developers are required to check each field contained in the newly added data table and the corresponding meaning of the field, and then write the SPI implementation class corresponding to the data table according to the writing specification of the SPI implementation class. Only then can the modified content of the data table be displayed in the database modification record table when the data table is modified. This results in low efficiency in accessing new data tables in the database, is prone to errors, and makes it impossible to quickly generate a new database modification record table. Summary of the invention

[0004] The embodiments of the present application provide a record table generation method, apparatus, device and storage medium, which are intended to quickly generate a database modification record table.

[0005] A first aspect of an embodiment of the present application provides a method for generating a record table, the method comprising:

[0006] Read an input file and determine the file type of the input file, wherein the file type includes a data table definition file and a data table;

[0007] In the case where the file type of the input file is a data table definition file, generating a corresponding data table and an SPI implementation class according to the field information in the data table definition file, wherein the SPI implementation class is used to record the correspondence between the field content and the field description of each field in the data table;

[0008] Storing the data table in a database, and compiling the SPI implementation class into a common code;

[0009] When the data in the data table is modified, the information change record corresponding to the data table is parsed through the SPI implementation class;

[0010] The modified contents in the data table obtained by parsing are loaded into the database modification record table.

[0011] A second aspect of an embodiment of the present application provides a record table generating device, the device comprising:

[0012] A file type confirmation module, used for reading an input file and determining the file type of the input file, wherein the file type includes a data table definition file and a data table;

[0013] A first SPI implementation class acquisition module is used to generate a corresponding data table and an SPI implementation class according to field information in the data table definition file when the file type of the input file is a data table definition file, wherein the SPI implementation class is used to record the correspondence between the field content and the field description of each field in the data table;

[0014] A data table storage module, used for storing the data table in a database, and compiling the SPI implementation class into a common code;

[0015] A data parsing module, used for parsing the modification records corresponding to the data table through the SPI implementation class when the data in the data table is modified;

[0016] The data synchronization module is used to load the modified content in the data table obtained by parsing into the database modification record table.

[0017] A third aspect of an embodiment of the present application provides a readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps in the method described in the first aspect of the present application are implemented.

[0018] A fourth aspect of an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method described in the first aspect of the present application are implemented.

[0019] By adopting the record table generation method provided in the present application, the corresponding data table and SPI implementation class can be generated by reading the data table definition file. When a new data table is added to the database, the corresponding SPI implementation class can be obtained according to the read data table definition file. When the data table in the database is modified, the data table change record is parsed by the newly added SPI implementation class, and the parsing result is synchronized to the database modification record table. When a new data table is added, there is no need to manually check the fields and the field descriptions of each field to write the SPI implementation class, and the database modification record table is quickly generated. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only 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.

[0021] Figure 1 is a flow chart of a method for generating a record table proposed in an embodiment of the present application;

[0022] Figure 2 is a flow chart of a method for generating a record table proposed in an embodiment of the present application;

[0023] Figure 3 is a flow chart of a method for generating a record table proposed in an embodiment of the present application;

[0024] Figure 4 is a flow chart of a method for generating a record table proposed in an embodiment of the present application;

[0025] Figure 5 is a flow chart of a method for generating a record table proposed in an embodiment of the present application;

[0026] Figure 6 is a flow chart of a method for generating a record table proposed in an embodiment of the present application;

[0027] Figure 7 is a flow chart of a method for generating a record table proposed in an embodiment of the present application;

[0028] Figure 8 It is a flowchart of a method for generating a record table proposed in an embodiment of the present application;

[0029] Fig. 9 It is a schematic diagram of a record table generating device proposed in an embodiment of the present application. DETAILED DESCRIPTION

[0030] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions 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.

[0031] refer to Figure 1 , Figure 1 1 is a flow chart of a method for generating a record table according to an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:

[0032] S11: Read an input file and determine the file type of the input file, where the file type includes a data table definition file and a data table.

[0033] In this embodiment, the data table definition file (javabean file) includes codes for defining each item in the data table, defines the name of each item and explains the name of the item. The data table definition is essentially a program class, which implements the corresponding function by encapsulating a custom program. By writing a data table definition file, each item of the accessed data table is defined, and the function of generating a corresponding data table and SPI implementation class according to the input data table definition file can be realized. The data table is a table for recording business data.

[0034] In this embodiment, the database stores data of many different businesses, and each business data has a corresponding data table to record the data, and each data table records specific items. When the data in the database is modified, the specific data recorded under the item corresponding to the modified data in the data table will change, and the database modification record table will record the specific items modified in the data table, and display the changes of each field in each data table in a personalized way.

[0035] In this embodiment, when a new data table is accessed, the fields in the data table need to be personalized in the database modification record table. First, the input file is read to determine the file type of the input file. The type of the input file can be a data table definition file and a data table.

[0036] In this embodiment, reference Figure 2 , Figure 2 is a flow chart of a method for generating a record table proposed in an embodiment of the present application. Figure 2 The step S11 shown specifically includes:

[0037] S11-1: Obtain the file extension of the input file.

[0038] In this embodiment, the file name includes a basic file name and a file extension. The file extension is also called a suffix name, which can represent the type of the file.

[0039] In this embodiment, after the input file is received, the file name of the file is read to obtain the file extension of the file.

[0040] For example, the file extension of a data table definition file is isp, and the file extension of a data table is myi, myd, frm, ibd, isl, etc.

[0041] S11-2: Determine the file type of the input file according to the file extension.

[0042] In this embodiment, the file types include data table definition files and data tables.

[0043] In this embodiment, after obtaining the file extension of the input file, the file type of the file is judged based on the file extension of the file. When the file extension is the extension corresponding to a data table definition file, the file type of the file is determined to be a data table definition file. When the file extension is the extension corresponding to a data table file, the file type of the file is determined to be a data table.

[0044] For example, when the file extension of the input file is isp, the file type of the file is determined to be a data table definition file; when the file extension of the input file is any one of myi, myd, frm, ibd, and isl, the file type of the file is determined to be a data table.

[0045] S12: When the file type of the input file is a data table definition file, a corresponding data table and an SPI implementation class are generated according to the field information in the data table definition file, and the SPI implementation class is used to record the correspondence between the field content and the field description of each field in the data table.

[0046] In this embodiment, the field information includes the fields of each item of the data table that needs to be accessed in the database and the corresponding description. The SPI (Service Provider Interface) implementation class is a specific implementation class dynamically loaded based on the SPI mechanism, and dynamically loads the correspondence between each field in the data table and the field description.

[0047] In this embodiment, when it is determined that the file type of the input file is a data table definition file, a corresponding table creation statement is generated based on the field information of each field in the data table included in the data table definition file, and then the table creation statement is executed to establish the corresponding data table. At the same time, a corresponding SPI implementation class is generated based on the field information of the fields included in the data table definition file.

[0048] In this embodiment, reference Figure 3 , Figure 3 is a flow chart of a method for generating a record table according to an embodiment of the present application. Figure 3 As shown, step S12 specifically includes:

[0049] S12-1: Generate the table creation statement according to the field information and preset table creation statement generation rules.

[0050] In this embodiment, the field information includes the field content of each field and the corresponding field description. According to each field and the corresponding field description, a corresponding table creation statement can be generated. The table creation statement is a program statement used to create a data table. The corresponding data table can be created by executing the table creation statement. The table creation statement generation rule is a rule for generating a corresponding data table according to the field information of the data table contained in the data table definition file, which is also called a table creation statement generation template. The rule is pre-defined and is directly called when the data table definition file is received.

[0051] In this embodiment, after obtaining the data table definition file, the statements in the file are parsed to obtain the field information contained therein, and then the field content and the corresponding field description of each field of the data table to be established are determined, and the table creation statement is generated according to the field content and the corresponding field description of each field. At the same time, according to the field content and the corresponding description of each field, a corresponding SPI implementation class is generated, and the corresponding relationship between the field content and the field description of each field is recorded in the SPI implementation class, which can be dynamically loaded into the database modification record table through the SPI mechanism.

[0052] In this embodiment, after obtaining the field information in the data table definition file, the preset table creation statement generation rule is called, and the corresponding table creation statement is generated according to the preset table creation statement generation rule, that is, the program corresponding to the pre-written table creation statement generation rule is called, and the program is run to generate the corresponding table creation statement according to the field information. The table name and each field of the data table to be created are standardized in the table creation statement, and a new table can be created by running the table creation statement.

[0053] For example, the table creation statement generation rules are written according to the writing rules of the SQL (Structured Query Language) language. The written statements are SQL statements, which are the default statements of the database system. For example, when a new "operation information table" is added, the generated table creation statements include "create a new table, table name: operation information table, field 1:..., field 2:..., etc.".

[0054] S12-2: Generate the SPI implementation class according to the field information and the preset SPI implementation class generation rule.

[0055] In this embodiment, the generation rules of the SPI implementation class are pre-written, the common part of the SPI implementation class is written as a fixed template, and the remaining part can be filled with corresponding data table information. When generating the SPI implementation class, the field information of the data table that needs to generate the SPI implementation class is entered into the template to obtain the corresponding SPI implementation class.

[0056] In this embodiment, after obtaining the field information, each field and its corresponding field description are input into a fixed template. After the input is completed, the statement that fills in the field information is run to generate the corresponding SPI implementation class. The SPI implementation class records the correspondence between each field in the data table and the field description, and is loaded through the SPI mechanism when needed.

[0057] For example, in the self-media table, an item is determined as video permission based on the field information. For this item, field 1 represents enabled, and field 0 represents unenabled, thereby generating SPI implementation classes "1-enabled" and "0-unenabled".

[0058] S12-3: Execute the table creation statement to generate the data table corresponding to the data table definition file.

[0059] In this embodiment, after the table creation statement is generated, the table creation statement is executed to generate a data table corresponding to the data table definition file.

[0060] For example, when the data table added to the database is a "self-media table", the corresponding data table definition file specifies the field content of each column in the data table and the field description corresponding to the field content. Through the field content and the corresponding field description, the corresponding SPI implementation class is generated according to the preset writing rules. For example, a column is "Authentication Source", which includes four fields 0, 1, 2, and 3. The field description of 0 is "Historical Data Synchronization", the field description of 1 is "Pcweb Registration", the field description of 2 is "Mobile Registration", and the field description of 3 is "Operator". After obtaining the field content and the corresponding field description of each column of the self-media table, generate the corresponding table creation statement, and then execute the table creation statement to generate the data table corresponding to the data table definition file.

[0061] S13: storing the data table in a database.

[0062] In this embodiment, after the data table is generated according to the input file, the generated data table is stored in the database.

[0063] In this embodiment, when a new data table is accessed in the database, the data table definition file corresponding to the data table is input to generate the corresponding table creation statement, and the data table can be obtained by executing the table creation statement. The obtained data table is stored in the database to complete the access of the data table.

[0064] In this embodiment, after the data table is stored in the database, the generated SPI implementation class is placed in a synchronization code package. After placing it in the synchronization code package, the synchronization code package is compiled into the general code of the database. Only then can the modified content of the data table be synchronized to the database modification record table through the SPI mechanism when the data table is modified.

[0065] For example, the database is a MySQL database, which is a relational database that can store data in different data tables. When needed, the desired data can be viewed by calling the data table.

[0066] In this embodiment, the database modification record table is used to record the modification status of each field in each data table in the database, including the modification time of each field, the content before the modification and the content after the modification.

[0067] In this embodiment, after obtaining the SPI implementation class corresponding to the data table definition, the code of the SPI implementation class is copied to a general code package, and then the general code package is compiled into the general code of the database for use by database users.

[0068] In this embodiment, reference Figure 4 , Figure 4 is a flow chart of a method for generating a record table proposed in an embodiment of the present application. Figure 4 As shown, after the SPI implementation class is loaded into the database, the method further includes:

[0069] S21: Put the SPI implementation class into a synchronization code package.

[0070] In this embodiment, the synchronization code package is a code program package that synchronizes data into a database. By running the synchronization code package, the data that needs to be stored in the database can be synchronized into the database.

[0071] In this embodiment, while the data table is stored in the database, the generated SPI implementation class is copied into the synchronization code package.

[0072] S22: Compile the synchronization code package including the SPI implementation class into the common code corresponding to the database.

[0073] In this embodiment, the universal code is the universal code of the database project running on the computer.

[0074] In this embodiment, the synchronization code package is compiled into the general code corresponding to the database. First, the synchronization code package is added to the general code, and then the general code is recompiled. After the compilation is completed, the synchronization code package is compiled into the general code.

[0075] In this embodiment, after the synchronization code package is compiled into the general code, the project that depends on the general code is repackaged, and the project corresponding to the newly connected data table can be put online for use by the project user.

[0076] S23: Loading the modified content in the data table obtained by parsing into the database modification record table, including:

[0077] The modified contents in the data table are synchronized to the database modification record table through the SPI mechanism.

[0078] In this embodiment, the code corresponding to the SPI implementation class is placed in a synchronization code package, and then the synchronization code package is compiled into the general code corresponding to the database. When the data in the data table in the database changes, the code corresponding to the SPI implementation class is run to parse the modified content of the data table, and then the modified content in the parsed data table is synchronized to the database modification record table.

[0079] For example, when the data table that needs to be accessed is a "self-media table", a data table definition file corresponding to the self-media table is provided, the self-media table and the corresponding SPI implementation class are generated according to the data table definition file, and the SPI implementation class is added to the synchronization code package. After the synchronization code package is compiled into the general code, the database can call this part of the code at any time. When the self-media table is modified, the database modification record table can determine which fields in the self-media table have been modified based on the SPI implementation class corresponding to the self-media table, and then load the modified content into the database modification record table.

[0080] S14: When the data in the data table is modified, the information change record corresponding to the data table is parsed through the SPI implementation class.

[0081] In this embodiment, the information change record is the time and content of the information change in the data table recorded by the database when the data in the data table changes.

[0082] In this embodiment, when the data in the newly accessed data table is modified, the database records the modification time and the modification content. Specifically, the field content of each data item in the data table before the modification and the field content after the modification are recorded. The SPI implementation class records the correspondence between each field in the data table and the field description. After a field in the data table is modified, the SPI implementation class corresponding to the data table is called, and the information change record of the data table is parsed according to the pre-stored correspondence between the field and the field description to determine which field and which value have been modified.

[0083] For example, the accessed data table is the "self-media table". The field in the second row of the second column is changed from 0 to 1, and the corresponding information change record is "Modification time: 2023-7-22-12:00, content before modification 0, content after modification 1". The SPI implementation class in the self-media table stores that the field in the second row of the second column in the self-media table is the video permission field. The description corresponding to field 0 is no permission, and the description corresponding to field 1 is permission. The information change record is parsed according to the stored content to determine that the video permission field has been modified from no permission to permission.

[0084] S15: Load the modified content in the data table obtained through analysis into the database modification record table.

[0085] In this embodiment, after obtaining the parsing result, the parsing result is loaded into the database modification record table through the SPI mechanism, thereby generating the latest database modification record table.

[0086] In this embodiment, when a new data table is accessed in the database, a data table definition file is provided, and the corresponding table creation statement and SPI implementation class are generated according to the pre-set table creation statement generation rules and SPI implementation class generation rules, so that the data table can be quickly accessed in the database. The generation scheme of the SPI implementation class corresponding to the data table is standardized, and only the data table definition file is needed to generate the corresponding SPI implementation class according to the field information in the data table definition file. This method is applicable to each data table, and there is no need to manually write the corresponding SPI implementation class each time a new data table is accessed. Each field is personalized in the database modification record table, and the relationship between the field content and the field description of each field is dynamically loaded into the database modification record table based on the SPI mechanism, so that when the data table changes information, the information change record can be quickly parsed, and then the corresponding database modification record table is generated, so that the new data table can be quickly accessed in the database.

[0087] In another embodiment of the present application, reference Figure 5 , Figure 5 is a flow chart of a method for generating a record table according to an embodiment of the present application. Figure 5 As shown, before step S13, it also includes:

[0088] S31: When the file type of the input file is a data table, generating a corresponding data table definition file and the SPI implementation class according to the table information of the data table.

[0089] In this embodiment, the table information includes the field content of each column in the data table and the field description corresponding to each field, the name of the data table, the size of the data table and other data table related information.

[0090] In this embodiment, when accessing a data table, the business party can directly provide the data table that needs to be accessed and input the data table into the database. When it is detected that the type of the input file is a data table, the table information of the data table is read from the database, and then the field content and corresponding field description of each field in the data table are obtained. According to the table information of the data table and the preset data table definition file generation rules, the corresponding data table definition file is generated, and according to the preset SPI implementation class generation rules, the corresponding SPI implementation class is generated.

[0091] For example, directly enter "self-media table" in the database. When it is detected that the input file is a data table, connect to the Mysql database, obtain the table information of the data table, determine the field content and field description of the fields corresponding to each column in the data table, and then call the preset data table definition file generation rule to generate the data table definition file corresponding to the data table, and call the preset SPI generation rule to generate the SPI implementation class corresponding to the data table.

[0092] In this embodiment, reference Figure 6 , Figure 6 is a flow chart of a method for generating a record table according to an embodiment of the present application. Figure 6 As shown, step S31 includes:

[0093] S31 - 1 : Read the data table to obtain the table information of the data table.

[0094] In this embodiment, when a new data table is connected to the database, the newly connected data table is read, the field content in each column in the data table and the field description corresponding to each field are read, the name of the data table, the size of the data table and other information are determined, and the table information of the data table is obtained.

[0095] For example, after accessing the data table, the data table is read to obtain the name of the data table as "self-media table", the field content in each column in the self-media table is obtained, and then the field description corresponding to each field is obtained.

[0096] S31 - 2: Determine the field content and field description of each field included in the data table according to the table information.

[0097] In this embodiment, after the table information is acquired, the field contents and field descriptions contained in the data table are determined.

[0098] For example, the field content of the first row of a column is "Video Permission", the field content of the second row is "0", and the field description corresponding to 0 is 0-permission not enabled, and the field content of the third row is "1", and the field description corresponding to 1 is 1-permission enabled.

[0099] S31 - 3: Generate the data table definition file and the SPI implementation class according to the field content and the field description.

[0100] In this embodiment, a data table definition file and an SPI implementation class corresponding to the data table are generated according to the field content and field description of the access data table. When generating the data table definition file, the field content of each field and the corresponding field description are written. When generating the SPI implementation class, the field content of each field and the corresponding relationship between the field description are written.

[0101] In this embodiment, reference Figure 7 , Figure 7 is a flow chart of a method for generating a record table according to an embodiment of the present application. Figure 7 The step S31-3 shown includes:

[0102] S31-3-1: Write the field content and the field description into a file according to a preset writing rule to obtain the data table definition file.

[0103] In this embodiment, the preset writing rule corresponds to a template program for generating a data table definition file. Field contents and field descriptions are filled into the template program, and the template program is run to obtain the corresponding data table definition file.

[0104] For example, when the received data table is a "self-media table", the acquired table information of the self-media table is used to form a data table definition file corresponding to the table in a Java file format.

[0105] S31-3-2: Write the correspondence between the field content and the field description according to the preset writing rules to obtain the SPI implementation class.

[0106] In this embodiment, the preset writing rule corresponds to a template program for generating an SPI implementation class, and the field content and the corresponding field description are filled into the template program to obtain the corresponding SPI implementation class.

[0107] In this embodiment, when the data table definition file is not found in the project user code, the data table definition file is synchronized to the project user code.

[0108] In this embodiment, the project user code is the code executed by the party using the database.

[0109] In this embodiment, when the data table definition file is not found in the project user code, the generated data table definition file is copied to the project user code, and then the project user code is recompiled to synchronize the data table definition file to the project user code. After having the data table definition file, the data table can be called by running the file.

[0110] In this embodiment, after recompiling the project code, the code of the dependent projects of the project is repackaged, that is, the code corresponding to the data table related to the data table is packaged and put into the same data package, and then the data package is put into the background of the online database for running.

[0111] In this embodiment, when the provided file is a data table, the corresponding data table definition file and SPI implementation class can be generated by identifying the table information in the data table. It is also possible to automatically generate the SPI implementation class of the data table when accessing the data table, without the need to manually write according to the writing rules of the SPI implementation class. This improves the speed of data table access and allows the data table information to be quickly entered into the database modification record table.

[0112] refer to Figure 8 , Figure 8 : is a flow chart of a method for generating a record table according to an embodiment of the present application. Figure 8 As shown, when a new data table is connected to the database, a data table definition file is used or a data table is provided directly. When a data table definition file is provided, a table creation statement is generated according to the data table definition file, and a corresponding SPI implementation class is generated according to the data table definition file. The generated statement is then executed to create the data table, and then the SPI implementation class is placed in the synchronization code package, and the synchronization code package is compiled into the general code. When the provided file is a data table, the table information of the table is read, and a data table definition file and an SPI implementation class are generated according to the read table information. When the project party code already has a data table definition file, the SPI implementation class is directly placed in the synchronization code package, and the synchronization code package is compiled into the general code. When the project party does not have a data table definition file, the data table definition file also needs to be placed in the user project.

[0113] In the above embodiment of the present application, when a new data table is accessed to the database, in order to quickly generate a new database modification record table, when the provided file is a data table definition file, a corresponding data table and a corresponding SPI implementation class are generated. When the provided file is a data table, a corresponding data table definition file and an SPI implementation class are generated. Through the corresponding generation rules, the corresponding SPI implementation class is generated according to the fields and field descriptions contained in the provided file. When the database modification record table is modified in the data table, the field description corresponding to each field can be determined according to the generated SPI implementation class to parse the modification of the record table, and the modification of the data table is recorded in detail in the database modification record table. There is no need to manually write the SPI implementation class of each newly connected data table, which improves the efficiency of data table access to the database and the speed of generating the database modification record table.

[0114] Based on the same inventive concept, an embodiment of the present application provides a record table generating device. Fig. 9 , Fig. 9 FIG. 9 is a schematic diagram of a record table generating device 900 proposed in an embodiment of the present application. Fig. 9 As shown, the device comprises:

[0115] A file type confirmation module 901 is used to read an input file and determine the file type of the input file, where the file type includes a data table definition file and a data table;

[0116] A first SPI implementation class acquisition module 902 is used to generate a corresponding data table and an SPI implementation class according to field information in the data table definition file when the file type of the input file is a data table definition file, wherein the SPI implementation class is used to record the correspondence between the field content and the field description of each field in the data table;

[0117] A data table storage module 903 is used to store the data table in a database and compile the SPI implementation class into a general code;

[0118] A data parsing module 904 is used to parse the modification record corresponding to the data table through the SPI implementation class when the data in the data table is modified;

[0119] The data synchronization module 905 is used to load the modified content in the data table obtained through analysis into the database modification record table.

[0120] Optionally, the device further comprises:

[0121] The second SPI implementation class acquisition module is used to generate a corresponding data table definition file and the SPI implementation class according to the table information of the data table when the file type of the input file is a data table.

[0122] Optionally, the file type confirmation module includes:

[0123] A file extension acquisition submodule, used to acquire the file extension of the input file;

[0124] The file type confirmation submodule is used to determine the file type of the input file according to the file extension.

[0125] Optionally, the first SPI implementation class acquisition module includes:

[0126] A table creation statement generation submodule, used to generate the table creation statement according to the field information and a preset table creation statement generation rule;

[0127] A first SPI implementation class generating module, configured to generate the SPI implementation class according to the field information and a preset SPI implementation class generating rule;

[0128] The data table generation submodule is used to execute the table creation statement to generate the data table corresponding to the data table definition file.

[0129] Optionally, the second SPI implementation class acquisition module includes:

[0130] A table information acquisition submodule, used for reading the data table to obtain the table information of the data table;

[0131] A field information acquisition submodule, used to determine the field content and field description of each field contained in the data table according to the table information;

[0132] The second SPI implementation class acquisition submodule is used to generate the data table definition file and the SPI implementation class according to the field content and the field description.

[0133] Optionally, the second implementation class generation submodule includes:

[0134] A data table definition file acquisition submodule is used to write the field content and the field description into a file according to a preset writing rule to obtain the data table definition file;

[0135] The second SPI implementation class generating submodule is used to write the corresponding relationship between the field content and the field description according to a preset writing rule to obtain the SPI implementation class.

[0136] Optionally, the device further comprises:

[0137] An implementation class loading module, used to load the SPI implementation class into the database, includes:

[0138] A code packaging submodule, used to put the SPI implementation class into a synchronous code package;

[0139] A code compilation submodule, used to compile the synchronization code package containing the SPI implementation class into the general code corresponding to the database;

[0140] The data synchronization module is used to load the modified content in the data table obtained by parsing into the database modification record table, including:

[0141] The data synchronization submodule is used to synchronize the modified content in the data table to the database modification record table through the SPI mechanism.

[0142] Based on the same inventive concept, another embodiment of the present application provides a readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps in the method for generating a record table as described in any of the above embodiments of the present application are implemented.

[0143] Based on the same inventive concept, another embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executed, implements the steps in the method for generating a record table described in any of the above embodiments of the present application.

[0144] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0145] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0146] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the embodiments of the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0147] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0148] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0149] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable terminal device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0150] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0151] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0152] The above is a detailed introduction to the record table generation method, device, equipment and storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for generating a record table, characterized in that: The method comprises: Read an input file and determine the file type of the input file; In the case where the file type of the input file is a data table definition file, generating a corresponding data table and an SPI implementation class according to the field information in the data table definition file, wherein the SPI implementation class is used to record the correspondence between the field content and the field description of each field in the data table; Storing the data table in a database; When the data in the data table is modified, the information change record corresponding to the data table is parsed through the SPI implementation class; The modified contents in the data table obtained by parsing are loaded into the database modification record table.

2. The method according to claim 1, characterized in that Before storing the data table in the database, the method further includes: When the file type of the input file is a data table, a corresponding data table definition file and the SPI implementation class are generated according to the table information of the data table.

3. The method according to claim 1, characterized in that Determining the file type of the input file includes: Get the file extension of the input file; The file type of the input file is determined according to the file extension.

4. The method according to claim 1, characterized in that: The step of generating a corresponding data table and an SPI implementation class according to the field information in the data table definition file includes: Generate the table creation statement according to the field information and the preset table creation statement generation rule; Generate the SPI implementation class according to the field information and the preset generation rule of the SPI implementation class; Execute the table creation statement to generate the data table corresponding to the data table definition file.

5. The method according to claim 2, characterized in that: The step of generating a corresponding data table definition file and the SPI implementation class according to the table information of the data table includes: Reading the data table to obtain the table information of the data table; Determine the field content and field description of each field contained in the data table according to the table information; The data table definition file and the SPI implementation class are generated according to the field content and the field description.

6. The method according to claim 5, characterized in that The step of generating the data table definition file and the SPI implementation class according to the field content and the field description includes: Writing the field content and the field description into a file according to a preset writing rule to obtain the data table definition file; The correspondence between the field content and the field description is written according to a preset writing rule to obtain the SPI implementation class.

7. The method according to claim 1, characterized in that After loading the SPI implementation class into the database, the method further includes: Put the SPI implementation class into the synchronization code package; Compile the synchronization code package containing the SPI implementation class into the common code corresponding to the database; Loading the modified content in the data table obtained by parsing into the database modification record table includes: The modified contents in the data table are synchronized to the database modification record table through the SPI mechanism.

8. A record table generating device, characterized in that: The device comprises: A file type confirmation module, used to read an input file and determine the file type of the input file; A first SPI implementation class generating module is used to generate a corresponding data table and an SPI implementation class according to field information in the data table definition file when the file type of the input file is a data table definition file, wherein the SPI implementation class is used to record the correspondence between the field content and the field description of each field in the data table; A data storage module, used for storing the data table in a database; A data parsing module, used for parsing the modification records corresponding to the data table through the SPI implementation class when the data in the data table is modified; The data synchronization module is used to load the modified content in the data table obtained by parsing into the database modification record table.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the method according to any one of claims 1 to 7 are implemented.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Method for dynamically replacing field in classes

    CN102736905A

  • Method, apparatus and storage medium for mapping class and database

    CN109299332A

  • Method and system for loading high-timeliness data into data lake

    CN111367984A

  • Data storage method and device, electronic equipment and medium

    CN114610808A

  • Data modification method and device, computer equipment and storage medium

    CN115357598A