A data processing method, device and computer readable storage medium
By receiving and converting smart contract information in smart contracts and establishing a mapping relationship between objects and data tables, the problem of low efficiency in key-value pair storage of data is solved, data calling efficiency is improved and resource usage is reduced.
Patent Information
- Application Number
- CN202010106533.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-02-20
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2040-02-20
AI Technical Summary
In smart contracts, when data is stored in the form of key-value pairs, the data calling efficiency is low, especially when the amount of data is large, it will occupy too many system resources, resulting in a waste of resources.
By receiving smart contract information, the description information of the object is converted into a list of object attribute information, and a data table is created based on the data table name and attribute information list, thereby establishing a mapping relationship between the object and the data table, and realizing the conversion of the data structure.
It improves data calling efficiency, reduces system resource usage, and simplifies the data operation process.
Smart Images

Figure CN111339189B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer networks, and in particular to a data processing method, device and computer-readable storage medium. Background Art
[0002] In smart contracts, code is written in an object-oriented way. The data in each object is recorded in the form of key-value pairs (attribute: attribute value). If data is stored directly in the form of key-value pairs, when the data of an object needs to be found or used, the system needs to traverse the data of all objects until the data of the object is found. It can be seen that directly storing data in the form of key-value pairs has the problem of inconvenient data call. Especially when the amount of data is large, storing data in the form of key-value pairs will occupy too many system resources when calling data, resulting in resource waste. Summary of the invention
[0003] The present application discloses a data processing method, device and computer-readable storage medium, which can convert and store the data structure of objects in a smart contract.
[0004] In a first aspect, the present application provides a data processing method, the method comprising:
[0005] Receive smart contract information, where the smart contract information is used to instruct creation of a first data table, and the smart contract information includes a name of the first data table and description information of an object corresponding to the first data table;
[0006] Converting the description information of the object into an object attribute information list, wherein each attribute information in the object attribute information list includes a field name, a field value and a field type;
[0007] The first data table is created according to the name of the first data table and the object attribute information list.
[0008] In a second aspect, the present application provides a data processing device, the data processing device comprising:
[0009] a receiving unit, configured to receive smart contract information, wherein the smart contract information is used to instruct the creation of a first data table, and the smart contract information includes a name of the first data table and description information of an object corresponding to the first data table;
[0010] A processing unit is used to convert the description information of the object into an object attribute information list, each attribute information in the object attribute information list includes a field name, a field value and a field type, and create the first data table according to the name of the first data table and the object attribute information list.
[0011] In a third aspect, the present application provides a data processing device comprising a processor, a memory and a communication interface, wherein the processor, the memory and the communication interface are interconnected, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method described in the first aspect above.
[0012] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more instructions, wherein the one or more instructions are suitable for being loaded by a processor and executing the method described in the first aspect above.
[0013] In this application, a node in a blockchain network receives smart contract information, which includes the name of a first data table and description information of an object corresponding to the first data table, converts the description information of the object into an object attribute information list, and creates the first data table according to the name of the first data table and the object attribute information list. It can be seen that after receiving the smart contract, a mapping relationship between the object and the data table is established through the object attribute information list, and the conversion of the object data structure is realized. This makes it more convenient to call the object data later when it is needed. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] 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 will be briefly introduced below. 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 work.
[0015] Figure 1 A scenario architecture diagram of a blockchain network provided for an embodiment of the present application;
[0016] Figure 2 A flowchart of a data processing method provided in an embodiment of the present application;
[0017] Figure 3 A flowchart of another data processing method provided in an embodiment of the present application;
[0018] Figure 4 A flowchart of another data processing method provided in an embodiment of the present application;
[0019] Figure 5 A flowchart of another data processing method provided in an embodiment of the present application;
[0020] Figure 6 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application;
[0021] Figure 7 A schematic diagram of the structure of another data processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0022] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0023] The embodiments of the present application relate to blockchain and blockchain network, wherein blockchain is a distributed ledger that combines data blocks in a sequential manner in chronological order to form a chain data structure, and cryptographically ensures that the data cannot be tampered with or forged. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods, each of which contains information about a batch of network transactions, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, the platform product service layer, and the application service layer.
[0024] The underlying blockchain platform can include processing modules such as user management, basic services, and smart contracts. Among them, the user management module is responsible for the identity information management of all blockchain participants, including maintaining the generation of public and private keys (account management), key management, and the maintenance of the corresponding relationship between the user's real identity and the blockchain address (authority management), etc., and under authorization, supervises and audits the transaction of certain real identities and provides risk control rule configuration (risk control audit); the basic service module is deployed on all blockchain node devices to verify the validity of business requests, and records valid requests to storage after consensus is reached. For a new business request, the basic service first adapts the interface to parse and authenticate (interface adaptation), and then encrypts the business information through the consensus algorithm (consensus management), and transmits it to the shared ledger completely and consistently after encryption (network communication), and records and stores it; the smart contract module is responsible for the registration and issuance of contracts, as well as contract triggering and contract execution. Developers can define the contract logic in a certain programming language and publish it to the blockchain (contract registration). According to the logic of the contract terms, call the key or other events to trigger execution and complete the contract logic.
[0025] The blockchain network is a distributed application architecture that distributes tasks and workloads among peers. It is a form of networking or network formed by the peer-to-peer computing model at the application layer. Generally, a blockchain network includes multiple computers connected to each other, which are also called node devices of the blockchain network. In the blockchain network environment, these multiple computers connected to each other are in an equal position, and each computer has the same function, without the distinction between master and slave. A computer can be used as a server to set shared resources for other computers in the network to use; it can also be used as a workstation. The entire network generally does not rely on dedicated centralized servers, nor does it have dedicated workstations. Each computer in the network can act as a requester of network services, and respond to requests from other computers to provide resources, services and content.
[0026] Figure 1 A scenario architecture diagram of a blockchain network provided in an embodiment of the present application. Figure 1 As shown, the blockchain network includes a first node 101 and a second node 102. Figure 1 The number of nodes in the blockchain network shown is for example only. For example, there may be multiple first nodes 101 and second nodes 102. There may also be a third node, a fourth node, etc. in the blockchain network. This application does not limit the number of nodes.
[0027] The first node 101 is a node corresponding to the user, and the user can be an individual, a company, an institution, etc. The first node 101 can be a node in the blockchain network or a terminal device that establishes a communication connection with a node in the blockchain network. The second node 102 is a node in the blockchain network. The first node 101 and the second node 102 can be a client or a server, which is not limited in the embodiment of the present application. Among them, the client can be any of the following: a terminal, an independent application, an application programming interface (Application Programming Interface, API) or a software development kit (Software Development Kit, SDK). Among them, the terminal can include but is not limited to: smart phones (such as Android phones, iOS phones, etc.), tablet computers, portable personal computers, mobile Internet devices (Mobile Internet Devices, MID) and other devices, which are not limited in the embodiment of the present invention. The type of node device can include but is not limited to a full node, a Simplified Payment Verification (SPV) node, or other node types in a blockchain network.
[0028] exist Figure 1In the blockchain network shown, the user sends smart contract information to the second node 102 in the blockchain network through the first node 101. The smart contract information is used to indicate the creation of data table 1. The smart contract information includes the table name of data table 1 and the description information of the object corresponding to data table 1 (the description information of the object is a code segment describing the object information, specifically used to indicate the attributes of the object and the corresponding type and value). For example, the table name of data table 1 is student information table, and the object corresponding to data table 1 is Xiao Ming. The description information of Xiao Ming is, name: Xiao Ming; height: 175cm; age: 17 years old. After receiving the smart contract information, the second node 102 converts the description information of the object in the smart contract into an object attribute information list (each row in the object attribute information list corresponds to an attribute (field) of the object, and the attribute content recorded in each row includes the field name, field value and field type). For example, the name attribute of Xiao Ming is converted into a row in the object attribute information list, field name: name, field value: Xiao Ming, field type: string type. Then create the first data table according to the name of the first data table and the object attribute information list.
[0029] Through the above data processing method, the second node 102 converts the data structure of the received object in the smart contract through the object attribute information list (that is, converts the key-value pair in the description information of the object into a data table) and stores it in the data table. It can be seen that through the embodiment of the present application, when the data of the object in the smart contract is subsequently used, the second node 102 can directly operate on the data table, making the object data call more convenient.
[0030] The following is a detailed introduction to a data processing method provided by this application.
[0031] See also Figure 2 , Figure 2 A flowchart of a data processing method provided in an embodiment of the present application. Figure 2 As shown, the data processing method includes but is not limited to the following steps 201 to 203:
[0032] 201. The second node receives the smart contract information sent by the first node.
[0033] Among them, the first node is the node corresponding to the user, and the second node is the node in the blockchain network. The smart contract information includes the name of the first data table and the description information of the object corresponding to the first data table. For example, the object corresponding to the food table can be bread, milk and other foods, and the object corresponding to the student information table is Xiao Ming, Xiao Zhang and Xiao Hong and other students. The description information of the object is a code segment that describes the object information, which is specifically used to indicate the attributes (fields) of the object and the corresponding types and values. The description information of the object includes one or more attribute information of the object, the value of each attribute information (i.e., field value), and the data type of the value of each attribute information (i.e., field type). For example, the description information of bread is: ingredients (attribute 1): wheat (value of attribute 1); weight (attribute 2): 150g (value of attribute 2). The data type (field type) corresponding to the attribute (field) is recorded in the corresponding class (such as bread corresponding to the food class). The specific indication method in the class is: ingredients: text type; weight: character type.
[0034] In one embodiment, before sending the smart contract information, the first node uses a hash function to generate a first message digest from the smart contract information, and then encrypts the first message digest using the private key of the first node to obtain a first digital signature, and sends the first digital signature together with the smart contract information to the second node. After receiving the smart contract information and the first digital signature, the second node uses a hash function to generate a second message digest from the smart contract information, and then uses the public key of the first node to decrypt the first digital signature to obtain the first message digest. And confirm whether the first message digest is consistent with the second message digest. If the first message digest is inconsistent with the second message, it means that the smart contract information is not sent by the first node, and the second node discards the smart contract information. If the first message digest is consistent with the second message, it means that the smart contract information is reliable, and continue to execute step 202.
[0035] 202. The second node converts the description information of the object into an object attribute information list.
[0036] The object attribute information list includes each attribute information of the object, and each attribute information includes the field name, field value and field type of the corresponding attribute. For ease of understanding, List 1 is an exemplary object attribute information list provided in an embodiment of the present application:
[0037] List 1
[0038]
[0039] It should be noted that the structure of List 1 is only used as an example and does not constitute an actual limitation on the structure of the object attribute information list in this application. For example, the number of attribute information may also be one, two or more than three.
[0040] In one embodiment, the second node reads the description information of the object and generates a list of object attribute information through the association between each field name and field value and field name and field type. For example, the description information of bread is: ingredients: text type, weight: character type, ingredients: wheat, weight: 150g. The list of bread attribute information converted according to the description information of bread is shown in Table 2:
[0041] List 2
[0042]
[0043] It can be understood that the data in each attribute information is interrelated, that is, in attribute information 1, ingredients, wheat and text type are interrelated.
[0044] 203. The second node creates a first data table according to the name of the first data table and the object attribute information list.
[0045] Among them, the first data table is used to record the data of objects belonging to the same class, and each row of data corresponds to the data of an object. In one embodiment, the second node creates the first data table according to the name of the first data table. The field name of each attribute information in the object attribute information list is obtained, and the field name of each attribute information in the object attribute information list is determined as the field name of each column in the first row of the first data table. Then, based on the association between the field name and the field value in each attribute information in the attribute information list corresponding to at least one object, the field value in each attribute information in the attribute information list corresponding to at least one object is added to the first data table. It should be noted that the field type exists in the first data table in the form of limiting the field type of each field value (such as limiting the field type of the weight field value in the first data table to character type).
[0046] For example, in the smart contract information, the name of data table 1 is student information table, and the objects corresponding to data table 1 include object 1 and object 2. The description information of object 1 is: name: Xiaoming, gender: male, age: 17; the description information of object 2 is: name: Xiaohong, gender: female, age 16; the type information is: name: text type, gender: text type, age: character type. Then the second node generates the attribute information list of object 1 according to the description information of object 1, as shown in List 3; and generates the attribute information list of object 2 according to the description information of object 2, as shown in List 4:
[0047] List 3
[0048]
[0049] List 4
[0050]
[0051] The second node creates a student information table according to the name of data table 1, and determines the field names of each attribute in the attribute information list of object 1 or object 2 as the field names of each column in the first row of the student information table, as shown in Table 5:
[0052] Table 5
[0053] Name gender age
[0054] Then, according to the association between the field names and field values in the attribute information lists of object 1 and object 2, the field values in the attribute information lists of object 1 and object 2 are added to the student information table. The obtained student information table is shown in Table 6:
[0055] Table 6
[0056] Name gender age Xiao Ming male 17 Little Red female 16
[0057] Through the above data processing method, the second node converts the data structure of the received object in the smart contract through the object attribute information list (that is, converts the key-value pair into a data table) and stores it in the first data table. It can be seen that through the embodiment of the present application, when the data of the object in the smart contract is subsequently used, the second node can directly operate on the first data table, making the object data call more convenient.
[0058] See also Figure 3 , Figure 3 A flowchart of another data processing method provided in an embodiment of the present application. Figure 3 As shown, the data processing method includes but is not limited to the following steps 301 to 304:
[0059] 301. The second node receives an adding request sent by the first node.
[0060] The add request includes the description information of the added object and the name of the data table corresponding to the added object. In one embodiment, when the first node sends the add request to the second node, it also carries the digital signature information of the first node. After receiving the add request and the digital signature information, the second node verifies the add request through the digital signature information. For specific implementation methods, please refer to Figure 2 The specific implementation method of step 201 will not be repeated here.
[0061] Optionally, the second node confirms whether the first node has the authority to add the object through a preset authority table. If the first node does not have the authority to add the object, the adding request is discarded; if the first node has the authority to add the object, step 302 is continued.
[0062] 302. The second node converts the description information of the added object into a list of attribute information of the added object.
[0063] Figure 3 The specific implementation of step 302 can be found in Figure 2 The specific implementation method of step 202 will not be repeated here.
[0064] 303. The second node checks whether the field name of each attribute in the added object attribute information list is the same as the field name in the data table corresponding to the added object.
[0065] In one embodiment, the second node checks whether the field names of the attributes in the added object attribute information list are the same as the field names in the data table corresponding to the added object. If the field names of the attributes in the added object attribute information list are the same as the field names in the data table corresponding to the added object, then continue to execute step 304. If there is a target field name in the added object attribute information list that is different from the field name in the data table corresponding to the added object, then add the target field name in the data table corresponding to the added object, and then continue to execute step 304.
[0066] For example, assuming that the added object attribute information list includes field name 1, field name 2 and field name 3, and the data table corresponding to the added object only includes field name 1 and field name 2, the second node adds field name 3 to the data table corresponding to the added object.
[0067] Optionally, if the data table corresponding to the added object contains a field name in the added object attribute information list, the field value corresponding to the field name in the added object data table is empty. For example, assuming that the added object attribute information list includes field name 1 and field name 3, and the data table corresponding to the added object includes field name 1, field name 2, and field name 3. Then the second node marks the field value corresponding to field name 2 in the data row where the added object is located in the data table corresponding to the added object as empty.
[0068] 304. The second node adds the field value of each attribute in the added object attribute information list to the data table corresponding to the added object according to the association relationship between the field name and the field value of each attribute in the added object attribute information list.
[0069] Figure 3 The specific implementation of step 304 can be found in Figure 2 The specific implementation method of step 203 is not repeated here.
[0070] Through the above data processing method, the data of the object in the smart contract can be added to the existing data table. It can be seen that through the embodiment of the present application, when the data of the object in the smart contract is subsequently used, the second node can directly operate the data table, making the object data call more convenient.
[0071] See also Figure 4 , Figure 4 A flowchart of another data processing method provided in an embodiment of the present application. Figure 4 As shown, the data processing method includes but is not limited to the following steps 401 to 404:
[0072] 401. The second node searches and confirms whether there is a second data table having the same primary key as the first data table.
[0073] Among them, the primary key refers to the primary keyword, which is one or more fields (attributes) in the data table. The value of the field can uniquely determine the data information of an object in the data table. In one embodiment, if there is a second data table with the same primary key as the first data table, the second node establishes an association relationship between the first data table and the second data table based on the primary key. For example, data table 1 is a student information table, including fields: name, student number, class; data table 2 is a grade information table, including fields: name, student number, grade. Then data table 1 and data table 2 can establish an association relationship through the student number.
[0074] 402. The second node receives a deletion instruction.
[0075] The delete instruction includes the primary key of the deleted object. Figure 3 The specific implementation method of step 301 will not be repeated here.
[0076] 403. The second section searches for the field values associated with the deleted object in each data table based on the primary key of the deleted object.
[0077] In one implementation, the second node searches and determines the data of the deleted object (ie, the field value associated with the deleted object in each data table) in each data table according to the primary key of the deleted object.
[0078] 404. The second node deletes the field value associated with the deleted object in each data table.
[0079] The solution of the embodiment of the present application is explained below through a complete example: it is assumed that the second node already stores data table 1 as shown in Table 7 and data table 2 as shown in Table 8.
[0080] Table 7
[0081] Name Student ID class Little Red 20213 5.1 Xiao Zhang 43131 5.2 Xiao Ming 41352 5.1
[0082] Table 8
[0083] Name Student ID score Little Red 20213 98 Xiao Zhang 43131 95 Xiao Ming 41352 97
[0084] As can be seen from Table 7 and Table 8, the student ID is the same primary key of Data Table 1 and Data Table 2. Therefore, the second node can establish an association relationship between Data Table 1 and Data Table 2 based on the student ID. Assuming that Xiao Ming transfers to another school and needs to delete Xiao Ming's information, the first node sends a deletion instruction to the second node, and the deletion instruction includes Xiao Ming's student ID. After the second node verifies the identity information and deletion instruction of the first node, it searches and determines that the field values associated with Xiao Ming in Data Table 1 are: "Xiao Ming", "41352" and "5.1" according to Xiao Ming's student ID; the field values associated with Xiao Ming in Data Table 2 are "Xiao Ming", "41352", "5.1". Then delete the field values associated with Xiao Ming in Data Table 1 and Data Table 2.
[0085] Through the above data processing method, the association relationship between each data table can be established through the primary key of the object. It can be seen that through the embodiment of the present application, when the data of the object needs to be operated, the data table is operated through the primary key of the object, making the object data call more convenient.
[0086] See also Figure 5 , Figure 5 A flowchart of another data processing method provided in an embodiment of the present application. Figure 5 As shown, the data processing method includes but is not limited to the following steps 501 to 504:
[0087] 501. The second node receives a modification request.
[0088] The modification request includes modification information of the modified object and the name of the data table corresponding to the modified object. Figure 3 The specific implementation method of step 301 will not be repeated here.
[0089] 502. The second node determines, according to the modification information, a field value corresponding to the modification information of the modification object in the data table corresponding to the modification object.
[0090] The modification information includes the primary key of the modified object, the field name to be modified and the corresponding field value. In one embodiment, the second node determines the data table corresponding to the modified object according to the name of the data table corresponding to the modified object. The data of the modified object in the data table corresponding to the modified object is determined according to the primary key of the modified object. The field value to be modified is determined according to the field name to be modified.
[0091] 503. Determine whether the field value corresponding to the modification information of the modification object is allowed to be modified.
[0092] In one embodiment, if the field value corresponding to the modification information of the modified object is not allowed to be modified, the modification request is discarded, and a first prompt message is sent to the first node, the first prompt message is used to prompt the first node that the field value indicated to be modified in the modification request is not allowed to be modified. If the field value corresponding to the modification information of the modified object is allowed to be modified, step 504 is continued.
[0093] Optionally, the second node checks whether the field type of the field value in the modification information is the same as the field type associated with the corresponding field name in the data table. If the field type of the field value in the modification information is the same as the field type associated with the corresponding field name in the data table, continue to execute step 504; if the field type of the field value in the modification information is not the same as the field type associated with the corresponding field name in the data table, the second node discards the modification request and sends a second prompt message to the first node, the second prompt message is used to prompt the first node that the field type of the field value indicated to be modified in the modification request is incorrect.
[0094] 504. Replace the field value corresponding to the modification information of the modified object with the modification information.
[0095] For example, suppose that in the modification request, the modification object is Xiao Ming, the primary key is Xiao Ming's student ID "12345", the field name to be modified is "class", and the corresponding field value to be modified is "5.2". The data table corresponding to the modification object is the "student data table" stored in the second node, and the student data table is shown in Table 9:
[0096] Table 9
[0097] Name Student ID class Xiao Ming 12345 5.1 Little Red 23818 5.2
[0098] The second node determines the student data table shown in Table 9 according to the name of the data table corresponding to the modified object: "student data table", determines the data of the modified object Xiao Ming according to the student ID "12345", and determines the field value "5.1" to be modified according to the field name "class". The second node determines whether "5.1" is allowed to be modified according to the preset permissions. If "5.1" is allowed to be modified, "5.1" is changed to the field value "5.2" that needs to be modified.
[0099] Through the above data processing method, the data of the object in the existing data table can be modified through the modification information of the object.
[0100] The method of the embodiment of the present application is described in detail above. In order to facilitate better implementation of the above scheme of the embodiment of the present application, the device of the embodiment of the present application is provided below accordingly.
[0101] See also Figure 6 , Figure 6It is a structural diagram of a data processing device provided in an embodiment of the present application. The data processing device can be mounted on the second node in the above method embodiment. Figure 6 The data processing device shown can be used to perform the above Figure 2 , Figure 3 , Figure 4 and Figure 5 Part or all of the functions of the method embodiment described. The detailed description of each unit is as follows:
[0102] An acquisition unit 601 is used to receive smart contract information, where the smart contract information is used to indicate the creation of a first data table, and the smart contract information includes a name of the first data table and description information of an object corresponding to the first data table;
[0103] Processing unit 602 is used to convert the description information of the object into an object attribute information list, each attribute information in the object attribute information list includes a field name, a field value and a field type, and create the first data table according to the name of the first data table and the object attribute information list.
[0104] In one implementation, the processing unit 602 is further configured to create the first data table according to the name of the first data table and the object attribute information list, specifically to:
[0105] Create the first data table according to the name of the first data table;
[0106] Obtain the field name of each attribute information in the object attribute information list;
[0107] Determine the field name of each attribute information as the field name in the first data table;
[0108] According to the association between the field name and the field value in each attribute information in the object attribute information list, the field value in each attribute information in the object attribute information list is added to the first data table.
[0109] In one implementation, the processing unit 602 is further configured to:
[0110] Receive an adding request through the acquiring unit 601, the adding request including description information of the added object and the name of the data table corresponding to the added object;
[0111] Converting the description information of the added object into a list of added object attribute information, wherein each attribute information in the list of added object attribute information includes a field name, a field value and a field type;
[0112] According to the association between the field name and the field value of each attribute in the added object attribute information list, the field value of each attribute in the added object attribute information list is added to the data table corresponding to the added object.
[0113] In one embodiment, before adding the field value of each attribute in the added object attribute information list to the data table corresponding to the added object according to the association relationship between the field name and the field value of each attribute in the added object attribute information list, the processing unit 602 is further used to:
[0114] Check whether the field name of each attribute in the added object attribute information list is the same as the field name in the data table corresponding to the added object;
[0115] If there is a target field name in the added object attribute information list that is different from the field name in the data table corresponding to the added object, the target field name is added to the data table corresponding to the added object.
[0116] In one implementation, after creating the first data table according to the name of the first data table and the object attribute information list, the processing unit 602 is further configured to:
[0117] Find and confirm whether there is a second data table with the same primary key as the first data table;
[0118] If there is a second data table having the same primary key as the first data table, an association relationship between the first data table and the second data table is established according to the same primary key.
[0119] In one implementation, the processing unit 602 is further configured to:
[0120] Receiving a deletion instruction through the acquisition unit 601, wherein the deletion instruction includes a primary key of the deleted object;
[0121] Searching for field values associated with the deleted object in each data table according to the primary key of the deleted object;
[0122] Delete the field values associated with the deletion object in each data table.
[0123] In one implementation, the processing unit 602 is further configured to:
[0124] Receiving a modification request through the acquisition unit 601, the modification request including modification information of the modification object and the name of the data table corresponding to the modification object;
[0125] Determine, according to the modification information, a field value corresponding to the modification information of the modification object in the data table corresponding to the modification object;
[0126] Determine whether the field value corresponding to the modification information of the modification object is allowed to be modified;
[0127] If the field value corresponding to the modification information of the modification object is allowed to be modified, the field value corresponding to the modification information of the modification object is replaced with the modification information.
[0128] According to one embodiment of the present application, Figure 2 , Figure 3 , Figure 4 and Figure 5 Some of the steps involved in the data processing method shown can be represented by Figure 6 The data processing device shown in the figure is executed by each unit. For example, Figure 2 The step 201 shown in FIG. 1 may be performed by Figure 6 The acquisition unit 601 shown in FIG. 6 is executed, and step 202 and step 203 can be performed by Figure 6 Processing unit 602 is shown executing. Figure 3 The step 301 shown in FIG. 1 can be performed by Figure 6 The acquisition unit 601 shown in FIG. 1 is executed, and steps 302 to 304 can be performed by Figure 6 Processing unit 602 is shown executing. Figure 4 Step 402 shown in FIG. 4 may be performed by Figure 6 The acquisition unit 601 shown in FIG. 6 is executed, and step 401, step 403 and step 404 can be performed by Figure 6 Processing unit 602 is shown executing. Figure 6 The various units in the data processing device shown can be respectively or all combined into one or several other units to constitute, or some of the units (some) can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the function of a unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of the present application, the data processing device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0129] According to another embodiment of the present application, the program can be executed by running on a general computing device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM) and other processing elements and storage elements. Figure 2 , Figure 3 , Figure 4 and Figure 5 A computer program (including program code) for each step involved in the corresponding method shown in Figure 6The data processing device shown in and the data processing method of the embodiment of the present application are implemented. The computer program can be recorded on, for example, a computer readable recording medium, and loaded into the above-mentioned computing device through the computer readable recording medium and run therein.
[0130] Based on the same inventive concept, the principles and beneficial effects of solving the problems by the data processing device provided in the embodiment of the present application are similar to the principles and beneficial effects of solving the problems by the data processing device in the method embodiment of the present application. Please refer to the principles and beneficial effects of the implementation of the method. For the sake of concise description, they will not be repeated here.
[0131] See also Figure 7 , Figure 7 It is a structural diagram of another data processing device provided in an embodiment of the present application, and the data processing device includes at least a processor 701, a communication interface 702 and a memory 703. Among them, the processor 701, the communication interface 702 and the memory 703 can be connected through a bus or other means, and the embodiment of the present application takes the bus connection as an example. Among them, the processor 701 (or the central processing unit (CPU)) is the computing core and control core of the terminal, which can parse various instructions in the terminal and process various data of the terminal. For example: the CPU can be used to parse the power on and off instructions sent by the user to the terminal, and control the terminal to perform power on and off operations; for example: the CPU can transmit various types of interactive data between the internal structures of the terminal, and so on. The communication interface 702 can optionally include a standard wired interface, a wireless interface (such as WI-FI, a mobile communication interface, etc.), which can be used to send and receive data under the control of the processor 701; the communication interface 702 can also be used for the transmission and interaction of internal data of the terminal. The memory 703 (Memory) is a memory device in the terminal for storing programs and data. It is understandable that the memory 703 here may include the built-in memory of the terminal, and of course may also include the extended memory supported by the terminal. The memory 703 provides a storage space, which stores the operating system of the terminal, including but not limited to: Android system, iOS system, Windows Phone system, etc., which is not limited in this application.
[0132] In the embodiment of the present application, the processor 701 performs the following operations by running the executable program code in the memory 703:
[0133] Receive smart contract information through the communication interface 702, where the smart contract information is used to instruct the creation of a first data table, and the smart contract information includes a name of the first data table and description information of an object corresponding to the first data table;
[0134] Converting the description information of the object into an object attribute information list, wherein each attribute information in the object attribute information list includes a field name, a field value and a field type;
[0135] The first data table is created according to the name of the first data table and the object attribute information list.
[0136] As an optional implementation manner, the specific implementation manner of the processor 701 creating the first data table according to the name of the first data table and the object attribute information list is:
[0137] Create the first data table according to the name of the first data table;
[0138] Obtain the field name of each attribute information in the object attribute information list;
[0139] Determine the field name of each attribute information as the field name in the first data table;
[0140] According to the association between the field name and the field value in each attribute information in the object attribute information list, the field value in each attribute information in the object attribute information list is added to the first data table.
[0141] As an optional implementation, the processor 701 further performs the following operations by running the executable program code in the memory 703:
[0142] Receive an adding request through the communication interface 702, the adding request including description information of the added object and the name of the data table corresponding to the added object;
[0143] Converting the description information of the added object into a list of added object attribute information, wherein each attribute information in the list of added object attribute information includes a field name, a field value and a field type;
[0144] According to the association between the field name and the field value of each attribute in the added object attribute information list, the field value of each attribute in the added object attribute information list is added to the data table corresponding to the added object.
[0145] As an optional implementation, before adding the field value of each attribute in the added object attribute information list to the data table corresponding to the added object according to the association relationship between the field name and the field value of each attribute in the added object attribute information list, the processor 701 further performs the following operations by running the memory 703:
[0146] Check whether the field name of each attribute in the added object attribute information list is the same as the field name in the data table corresponding to the added object;
[0147] If there is a target field name in the added object attribute information list that is different from the field name in the data table corresponding to the added object, the target field name is added to the data table corresponding to the added object.
[0148] As an optional implementation manner, after creating the first data table according to the name of the first data table and the object attribute information list, the processor 701 further performs the following operations by running the memory 703:
[0149] Find and confirm whether there is a second data table with the same primary key as the first data table;
[0150] If there is a second data table having the same primary key as the first data table, an association relationship between the first data table and the second data table is established according to the same primary key.
[0151] As an optional implementation manner, the processor 701 further performs the following operations by running the memory 703:
[0152] Receiving a deletion instruction via the communication interface 702, the deletion instruction including a primary key of the deleted object;
[0153] Searching for field values associated with the deleted object in each data table according to the primary key of the deleted object;
[0154] Delete the field values associated with the deletion object in each data table.
[0155] As an optional implementation manner, the processor 701 further performs the following operations by running the memory 703:
[0156] Receiving a modification request through the communication interface 702, the modification request including modification information of the modification object and the name of the data table corresponding to the modification object;
[0157] Determine, according to the modification information, a field value corresponding to the modification information of the modification object in the data table corresponding to the modification object;
[0158] Determine whether the field value corresponding to the modification information of the modification object is allowed to be modified;
[0159] If the field value corresponding to the modification information of the modification object is allowed to be modified, the field value corresponding to the modification information of the modification object is replaced with the modification information.
[0160] Based on the same inventive concept, the principles and beneficial effects of solving the problems by the data processing device provided in the embodiment of the present application are similar to the principles and beneficial effects of solving the problems by the data processing device in the method embodiment of the present application. Please refer to the principles and beneficial effects of the implementation of the method. For the sake of concise description, they will not be repeated here.
[0161] An embodiment of the present application also provides a computer-readable storage medium, in which one or more instructions are stored, and the one or more instructions are suitable for being loaded by a processor and executing the data processing method described in the above method embodiment.
[0162] An embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the data processing method described in the above method embodiment.
[0163] It should be noted that, for the above-mentioned various method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0164] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.
[0165] The modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.
[0166] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the readable storage medium can include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0167] What is disclosed above is only a preferred embodiment of the present application, and it certainly cannot be used to limit the scope of rights of the present application. Ordinary technicians in this field can understand that all or part of the processes of the above embodiment and equivalent changes made according to the claims of the present application are still within the scope of the invention.
Claims
1. A data processing method, characterized in that: The method comprises: Receive smart contract information, where the smart contract information is used to instruct the creation of a first data table, and the smart contract information includes a name of the first data table and description information of an object corresponding to the first data table; the description information of the object is used to indicate an attribute of the object, a corresponding type, and a value; Converting the description information of the object into an object attribute information list, wherein each attribute information in the object attribute information list includes a field name, a field value and a field type; The first data table is created according to the name of the first data table and the object attribute information list, and the key-value pairs in the data structure of the object in the received smart contract are converted into a data table.
2. The method according to claim 1, characterized in that The step of creating the first data table according to the name of the first data table and the object attribute information list includes: Create the first data table according to the name of the first data table; Obtain the field name of each attribute information in the object attribute information list; Determine the field name of each attribute information as the field name in the first data table; According to the association between the field name and the field value in each attribute information in the object attribute information list, the field value in each attribute information in the object attribute information list is added to the first data table.
3. The method according to claim 1, characterized in that The method further comprises: Receive an adding request, the adding request including description information of an added object and a name of a data table corresponding to the added object; Converting the description information of the added object into a list of added object attribute information, wherein each attribute information in the list of added object attribute information includes a field name, a field value and a field type; According to the association between the field name and the field value of each attribute in the added object attribute information list, the field value of each attribute in the added object attribute information list is added to the data table corresponding to the added object.
4. The method according to claim 3, characterized in that Before adding the field value of each attribute in the added object attribute information list to the data table corresponding to the added object according to the association relationship between the field name and the field value of each attribute in the added object attribute information list, the method further includes: Check whether the field name of each attribute in the added object attribute information list is the same as the field name in the data table corresponding to the added object; If there is a target field name in the added object attribute information list that is different from the field name in the data table corresponding to the added object, the target field name is added to the data table corresponding to the added object.
5. The method according to claim 1, characterized in that After creating the first data table according to the name of the first data table and the object attribute information list, the method further includes: Find and confirm whether there is a second data table with the same primary key as the first data table; If there is a second data table having the same primary key as the first data table, an association relationship between the first data table and the second data table is established according to the same primary key.
6. The method according to claim 5, characterized in that The method further comprises: receiving a delete instruction, wherein the delete instruction includes a primary key of a deleted object; Searching for field values associated with the deleted object in each data table according to the primary key of the deleted object; Delete the field values associated with the deletion object in each data table.
7. The method according to claim 1, characterized in that The method further comprises: receiving a modification request, wherein the modification request includes modification information of a modification object and a name of a data table corresponding to the modification object; Determine, according to the modification information, a field value corresponding to the modification information of the modification object in the data table corresponding to the modification object; Determine whether the field value corresponding to the modification information of the modification object is allowed to be modified; If the field value corresponding to the modification information of the modification object is allowed to be modified, the field value corresponding to the modification information of the modification object is replaced with the modification information.
8. A data processing device, characterized in that: include: A receiving unit, configured to receive smart contract information, wherein the smart contract information is used to indicate creation of a first data table, and the smart contract information includes a name of the first data table and description information of an object corresponding to the first data table; the description information of the object is used to indicate an attribute of the object, a corresponding type, and a value; A processing unit is used to convert the description information of the object into an object attribute information list, each attribute information in the object attribute information list includes a field name, a field value and a field type, create the first data table according to the name of the first data table and the object attribute information list, and convert the key-value pairs in the data structure of the object in the received smart contract into a data table.
9. A data processing device, characterized in that: It comprises a processor, a memory and a communication interface, wherein the processor, the memory and the communication interface are interconnected, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the data processing method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more instructions, and the one or more instructions are suitable for being loaded by a processor and executing the data processing method according to any one of claims 1 to 7.
