A data verification method, device, computer equipment and storage medium
By analyzing and verifying the data type array and data encoding information provided by the server on the client, the problem that the client cannot verify the data stored on the server is solved, and fine-grained verification of the server data is achieved.
Patent Information
- Application Number
- CN202211519384.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-30
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2042-11-30
AI Technical Summary
In blockchain technology, the client cannot effectively verify whether the data stored in the trusted relational database of the server is correct, resulting in the client being unable to meet the data verification needs.
By obtaining data type array and data encoding information from the server, the client can parse and verify the data stored on the server. The specific steps include: determining the data type according to the data type array, decoding the original data corresponding to the target sequence number according to the data encoding information, and finally comparing the decoded data with the target data to determine the verification result.
It realizes fine-grained verification of the server-side data stored by the client, and improves the flexibility and accuracy of data verification.
Smart Images

Figure CN115794964B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a data verification method, apparatus, computer equipment and storage medium. Background Art
[0002] In blockchain technology, the trusted relational database in the server is used to store client data from the client in the form of a data table. Each piece of client data corresponds to a column of data in the data table. Each column of data stored in the trusted relational database not only has the characteristics of being tamper-proof, but also has excellent characteristics such as decentralization and encryption.
[0003] However, when the server stores the acquired client data, the client is unaware of it. Therefore, the client is also unaware of whether the column data finally stored in the trusted relational database by the server is correct. If the user has a need to verify the column data stored on the server at the client, the client will not be able to meet the need. Therefore, how to efficiently verify the column data in the server's trusted relational database at the client has become an urgent problem to be solved. Summary of the invention
[0004] The embodiments of the present disclosure at least provide a data verification method, apparatus, computer device and storage medium.
[0005] In a first aspect, an embodiment of the present disclosure provides a data verification method, including:
[0006] In response to a verification operation on target data with a target sequence number, a data type array and data encoding information corresponding to a relational database are obtained from a server; the data type array is used to maintain the data type used when the original data is stored in the relational database according to a storage time sequence, and the data encoding information includes sub-encoding information of each piece of the original data;
[0007] According to the arrangement order of the type indication value indicating the data type in the data type array, the sub-coding information of each piece of original data corresponding to the starting sequence number to the target sequence number is sequentially determined from the data coding information;
[0008] The target sub-coding information of the original data corresponding to the target serial number is decoded to obtain the original data to be verified, and the verification result is determined according to the original data to be verified and the target data.
[0009] In a possible implementation, the step of sequentially determining, from the data encoding information, sub-coding information of each piece of original data corresponding to the starting sequence number to the target sequence number according to the arrangement order of the type indication value indicating the data type in the data type array includes:
[0010] According to the sorting order bits of the type indicator values and the target sequence number, determine a first type indicator value whose sorting order bit matches the target sequence number and each second type indicator value whose sorting order bit is smaller than the target sequence number;
[0011] According to the sorting order bits of the second type indicator values, determining, from the data encoding information, sub-coding information of each piece of original data corresponding to the starting sequence number to the intermediate sequence number; the intermediate sequence number is adjacent to the target sequence number and is smaller than the target sequence number;
[0012] Determine, according to the sub-coding information of the original data corresponding to the intermediate sequence number, a starting calculation position of the original data corresponding to the target sequence number in the data coding information;
[0013] According to the first type indication value and the starting calculation position, the target sub-coding information of the original data corresponding to the target sequence number is determined from the data coding information.
[0014] In a possible implementation manner, determining, from the data encoding information according to the first type indicator value and the starting calculation position, the target sub-coding information of the original data corresponding to the target sequence number includes:
[0015] Determine, according to the first type indication value, a target data type of the original data corresponding to the target sequence number and a type setting rule for the target data type; the type setting rule is used to indicate whether the data having the target data type can be set to a null value;
[0016] In the case where the type setting rule indicates that the target data type cannot be set to a null value, determining an end point position from the starting calculation position according to the target data type and the data encoding information;
[0017] The target sub-coding information is determined according to the data encoding information between the end position and the starting calculation position.
[0018] In a possible implementation manner, after determining the type setting rule, the method further includes:
[0019] In a case where the type setting rule indicates that the target data type can be set to a null value, determining an intermediate calculation position from the data encoding information according to the starting calculation position and a first preset character length corresponding to the null value;
[0020] Determining the end point position according to the intermediate calculation position, the target data type and the data encoding information;
[0021] The target sub-coding information is determined according to the data coding information between the end position and the starting calculation position.
[0022] In a possible implementation manner, the first type indicator value is an integer;
[0023] Determining a type setting rule for the target data type according to the first type indication value includes:
[0024] In a case where the first type indication value is an odd number, determining that the type setting rule of the target data type is a first setting rule indicating that the target data type can be set to a null value;
[0025] In a case where the first type indication value is an even number, it is determined that the type setting rule of the target data type is a second setting rule indicating that the target data type cannot be set to a null value.
[0026] In a possible implementation manner, determining the end position from the starting calculation position according to the target data type and the data encoding information includes:
[0027] In the case where the target data type is a variable character length type, selecting intermediate sub-coding information having a second preset character length from the starting calculation position according to the data encoding information;
[0028] The end point position is determined from the data encoding information according to the target character length indicated by the intermediate sub-encoding information and the intermediate sub-encoding information.
[0029] In a possible implementation manner, determining the end position from the starting calculation position according to the target data type and the data encoding information includes:
[0030] In the case where the target data type is any character type among multiple preset character types, determining a target character length corresponding to the character type; the character lengths corresponding to the multiple preset character types are all immutable;
[0031] The end position is determined according to the data encoding information, the starting calculation position and the target character length.
[0032] In a second aspect, the present disclosure also provides a data verification device, including:
[0033] an acquisition module, configured to, in response to a verification operation on target data with a target sequence number, acquire from a server a data type array and data encoding information corresponding to a relational database; the data type array is used to maintain the data type used when the original data is stored in the relational database according to a storage time sequence, and the data encoding information includes sub-encoding information of each piece of the original data;
[0034] A first determining module is used to determine, from the data encoding information, the sub-coding information of each piece of original data corresponding to the starting sequence number to the target sequence number according to the arrangement order of the type indication value indicating the data type in the data type array;
[0035] The second determination module is used to decode the target sub-coding information of the original data corresponding to the target serial number to obtain the original data to be verified, and determine the verification result according to the original data to be verified and the target data.
[0036] In a third aspect, an optional implementation of the present disclosure further provides a computer device, a processor, and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory, and when the machine-readable instructions are executed by the processor, the machine-readable instructions perform the steps of the above-mentioned first aspect, or any possible implementation of the first aspect.
[0037] In a fourth aspect, an optional implementation of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps of the above-mentioned first aspect, or any possible implementation of the first aspect are executed.
[0038] For a description of the effects of the above-mentioned data verification apparatus, computer device, and computer-readable storage medium, please refer to the description of the above-mentioned data verification method, which will not be repeated here.
[0039] The data verification method, device, computer equipment and storage medium provided by the embodiment of the present disclosure, since the type indicator value in the data type array is used to indicate the data type used when the original data is stored in the relational database, the data type used by the server to store each piece of original data can be accurately parsed according to the type indicator value in the acquired data type array. Furthermore, according to the determined data type of each original data, the data length corresponding to each original data can be determined in sequence; then based on the determined data length and data encoding information, the sub-coding information corresponding to each piece of original data corresponding to the starting sequence number to the target sequence number can be sequentially determined in the data encoding information, so that the target sub-coding information of the original data corresponding to the target sequence number can be obtained. By decoding the target sub-coding information, the corresponding original data to be verified before encoding can be accurately obtained. Finally, by comparing the original data to be verified with the target data, the fine-grained verification of the original data to be verified stored by the server and matching any target sequence number can be achieved. That is, based on the embodiments of the present disclosure, the data types corresponding to each piece of original data are first serialized by the server to obtain a data type array, and then the data type array is parsed by the client, and the data encoding information is processed based on the parsing result. The original data to be verified stored on the server can be deserialized on the client, and fine-grained verification of the original data stored on the server can be efficiently achieved based on the deserialization result.
[0040] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0042] Figure 1 A flow chart of a data verification method provided by an embodiment of the present disclosure is shown;
[0043] Figure 2 A schematic diagram of a data verification device provided by an embodiment of the present disclosure is shown;
[0044] Figure 3 A schematic diagram of the structure of a computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the present disclosure claimed for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0046] In addition, the terms "first", "second", etc. in the description and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein.
[0047] The "multiple or several" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0048] According to research, common trusted relational database products include Oracle Blockchain Table, Quantum Ledger Database (QLDB), and Ledger Database (LedgerDB). However, for Oracle Blockchain Table and QLDB, when verifying data in a trusted relational database, the verification operation is completed by the server itself, without involving the client. As for LedgerDB, although it provides a method for data verification on the client, it is impossible to implement fine-grained data verification because there is no structured data in LedgerDB.
[0049] Based on the above research, the present disclosure provides a data verification scheme. Since the type indicator value in the data type array is used to indicate the data type used when the original data is stored in the relational database, the data type used by the server to store each piece of original data can be accurately parsed according to the type indicator value in the acquired data type array. Furthermore, according to the determined data type of each piece of original data, the data length corresponding to each piece of original data can be determined in sequence; then based on the determined data length and data encoding information, the sub-coding information corresponding to each piece of original data corresponding to the starting sequence number to the target sequence number can be sequentially determined in the data encoding information, so that the target sub-coding information of the original data corresponding to the target sequence number can be obtained. By decoding the target sub-coding information, the corresponding original data to be verified before encoding can be accurately obtained. Finally, by comparing the original data to be verified with the target data, the fine-grained verification of the original data to be verified that matches any target sequence number stored on the server can be achieved. That is, based on the embodiments of the present disclosure, the data types corresponding to each piece of original data are first serialized by the server to obtain a data type array, and then the data type array is parsed by the client, and the data encoding information is processed based on the parsing result. The original data to be verified stored on the server can be deserialized on the client, and fine-grained verification of the original data stored on the server can be efficiently achieved based on the deserialization result.
[0050] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.
[0051] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0052] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0053] To facilitate understanding of this embodiment, a data verification method disclosed in an embodiment of the present disclosure is first introduced in detail. The executor of the data verification method provided in the embodiment of the present disclosure is generally a terminal device or other processing device with certain computing capabilities, wherein the terminal device may be a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a personal digital assistant device (Personal Digital Assistant, PDA), a handheld device, a computer device, etc.; in some possible implementation methods, the data verification method may be implemented by a processor calling computer-readable instructions stored in a memory.
[0054] The data verification method provided by the embodiment of the present disclosure is described below by taking the execution subject as data verification as an example.
[0055] like Figure 1 As shown, it is a flowchart of a data verification method provided by an embodiment of the present disclosure, which may include the following steps:
[0056] S101: In response to a verification operation on target data with a target sequence number, a data type array and data encoding information corresponding to a relational database are obtained from a server; the data type array is used to maintain the data type used when the original data is stored in the relational database according to a storage sequence, and the data encoding information includes sub-coding information of each piece of original data.
[0057] Here, the target data may be data stored by the client, which is data obtained after the client encodes the stored data according to its own encoding rules. The data to be stored may be any type of data, such as transaction data, account book data, etc. Each data to be stored may also be sent by the client to the server, and the server takes each data to be stored as the original data, encodes the original data according to its own encoding rules, obtains the encoding information of each original data, and stores the encoding information of the original data in the form of a data table in the relational database. One original data corresponds to one column data in the data table, i.e., column data. Each original data has a storage time sequence when stored, i.e., a storage sequence is formed. Different original data may use different data types when stored, and the data type used by each original data when stored may be identified by the type indicator value corresponding to the original data. That is, the data type array may include type indicator values corresponding to each original data, and each type indicator value is used to be stored in the data type array according to the storage sequence of the corresponding original data.
[0058] It should be noted that the encoding rules of the client and the server are different, and the data to be stored in the embodiment of the present disclosure may be data applied in blockchain technology.
[0059] For example, the definition of a data table can be as follows:
[0060] col1 nullable INT(data type 497),
[0061] col2 VARCHAR(20)(data type 448),
[0062] col3 CHAR(8)(data type 452).
[0063] The data table includes three columns, namely col1, col2 and col3. The data type of col1 is an integer (INT) type that can be set to a null value (nullable), and its type indicator value (data type) is 497; the data type of col2 is a variable-length character type (VARCHAR), the character length needs to be obtained dynamically, and the type indicator value (data type) is 448; the data type of col3 is a character type (CHAR) with an immutable length, the character length is 8, and the type indicator value (datatype) is 452. The original data corresponding to col1 is 1, the original data corresponding to col2 is hello, and the original data corresponding to col3 is ledger. The encoding method of the server can be EBCDIC CCSID 37 encoding method. After encoding using this method, the encoding information of col1 can be 0x0080000001, the encoding information of col2 can be 0x0005c885939396, and the encoding information of col3 can be 0xd385848785994040. The encoding information of the data composed of col1, col2 and col3 can be 0x00800000010005c885939396d385848785994040. The type indicator value of a raw data can be determined by the server according to the data type used when storing the raw data, wherein storing the raw data in the relational database is to store the encoding information of the raw data.
[0064] A relational database, also known as a trusted relational database, is a database used in blockchain technology. The original data stored in the trusted relational database can be used to calculate the digest information of the nodes in the Merkle Tree.
[0065] Each target data stored on the client can have a transaction number generated in sequence, where the transaction number is also the journal sequence number (JSN or RSN for short). Since the target data is generated after encoding the data to be stored, the JSN of the target data is also the JSN of the data to be stored corresponding to the target data. Similarly, since each data to be stored corresponds to an original data on the server, the JSN of each data to be stored is also the JSN of the original data corresponding to the data to be stored.
[0066] The data type array is an array generated by the server according to the type indicator values corresponding to each column data in the data table after receiving the data verification request from the client, which may include the type indicator values corresponding to each original data, each type indicator value has a sorting order bit in the data type array, and the sorting order bit is related to the storage timing. For example, the data type array generated according to the type indicator values corresponding to col1, col2 and col3 can be [497, 448, 452]. The sorting order bit of the type indicator value in the data type array is determined according to the position of the original data corresponding to the type indicator value in the data table. Exemplarily, since the position of col1 in the data table is before the position of col2 in the data table, and the position of col2 in the data table is before the position of col3 in the data table, the sorting order bit of the type indicator value corresponding to col1 is greater than the sorting order bit of the type indicator value corresponding to col2, which is greater than the sorting order bit of the type indicator value corresponding to col3, that is, in the data type array [497, 448, 452], 497 is located at the first sorting order bit, 448 is located at the second sorting order bit, and 452 is located at the third sorting order bit.
[0067] After generating the encoding information of each piece of original data, the server can combine the encoding information of each piece of original data for storage. For example, in the above example, the encoding information of col1, col2 and col3 can be combined into 0x00800000010005c885939396d385848785994040. The combined encoding information is the data encoding information, and the encoding information corresponding to each piece of original data is the sub-encoding information in the data encoding information.
[0068] The verification operation on the target data having the target serial number may trigger a client verification operation on the target serial number for the user, such as an operation of clicking the target serial number.
[0069] In specific implementation, when the user triggers client verification for any target sequence number (i.e., target jsn), the client can determine that there is a verification requirement for the target data with the target jsn, and then can send a data verification request to the server. After that, the server can traverse each data table in the trusted relational database in turn, generate a data type array according to the type indicator value in the data table, and obtain data encoding information including sub-coding information of each piece of original data. Then, the server can feed back the data type array and data encoding information to the client. It should be noted that the number of data tables in the trusted relational database can be one or more, and the embodiments of the present disclosure do not specifically limit it. For example, the number of data tables can be determined based on the actual amount of data that needs to be stored.
[0070] S102: According to the arrangement order of the type indication value indicating the data type in the data type array, sub-coding information of each piece of original data corresponding to the starting sequence number to the target sequence number is sequentially determined from the data coding information.
[0071] Here, the sub-coding information of the original data corresponding to the target sequence number is the coding information that matches the target sequence number determined by the client from the data coding information, and can also be called the target sub-coding information. The arrangement order of the type indicator value corresponding to the target sub-coding information in the data type array can specifically be the value of the target sequence number. Exemplarily, when the target sequence number is 3, the arrangement order of the type indicator value corresponding to the target sub-coding information in the data type array can be the third position. A structured query language (SQL) type interpreter can be pre-set in the client, and the interpreter is used to determine the character length indicated by the type indicator value according to the type indicator value, and determine the sub-coding information according to the indicated character length.
[0072] The starting sequence number may be the jsn of the original data stored first. In the data type array, the starting sequence number is the jsn of the original data corresponding to the type indicator value with the first sorting order bit. For example, the starting sequence number may be 1.
[0073] In specific implementation, taking the sorting order bit that matches the target sequence number as the target order bit, and the target order bit being 10 as an example, the character length corresponding to the encoding information of each original data can be determined in turn according to the sorting order bit of each type indicator value in the data type array using the SQL type interpreter, and then using the determined character lengths to determine the sub-encoding information of each original data corresponding to 1 to 10 from the data encoding information in turn.
[0074] Taking the determination of the target sub-coding information corresponding to col3 as an example, the target sequence bit corresponding to col3 is 3. In specific implementation, the sub-coding information corresponding to col1 and col2 can be determined in sequence from the data coding information 0x00800000010005c885939396d385848785994040 according to the first type indicator value 497 and the second type indicator value 448. Then, the character length of col3 can be determined according to the type indicator value corresponding to col3, and then the target sub-coding information corresponding to col3 can be determined according to the end position of the sub-coding information corresponding to col2 and the character length.
[0075] In one embodiment, S102 may be implemented according to the following steps:
[0076] S102-1: According to the sorting order bits of each type indicator value in the data type array and the target sequence number, determine the first type indicator value whose sorting order bit matches the target sequence number and each second type indicator value whose sorting order bit is smaller than the target sequence number.
[0077] For example, for the data type array [497, 448, 452], the sorting order of 497 is the first, the sorting order of 448 is the second, and the sorting order of 452 is the third. If the target sequence number is 2, the first type indicator value is 448, and the second type indicator value is 497; if the target sequence number is 3, the first type indicator value is 452, and the second type indicator values are 497 and 448.
[0078] It should be noted that, for the case of verifying the target data with the target sequence number of 1, since the sorting order bit matching the target sequence number 1 is the first one, there are no second type indicator values in the data type array whose sorting order bits are smaller than the target sequence number. In this case, the target sub-coding information can be determined directly from the first coded data in the data coding information according to the character length indicated by the first type indicator value.
[0079] S102-2: Determine, from the data encoding information, the sub-coding information of each piece of original data corresponding to the starting sequence number to the intermediate sequence number according to the sorting order bits of each second type indicator value; the intermediate sequence number is adjacent to the target sequence number and is smaller than the target sequence number.
[0080] Here, the intermediate sequence number may be the sequence number before the target sequence number. For example, when the target sequence number is 6, the intermediate sequence number is 5; when the target sequence number is 10, the intermediate sequence number is 9; when the target sequence number is 100, the intermediate sequence number is 99.
[0081] In specific implementation, the SQL type interpreter can be used to determine the sub-coding information of each piece of original data corresponding to the starting sequence number to the middle sequence number in sequence from the first coded data in the data coding information according to each second type indicator value in the order of the sorting order from small to large. Among them, the step of determining the sub-coding information according to each second type indicator value can refer to the subsequent step of determining the target sub-coding information according to the first type indicator value, and will not be repeated here.
[0082] S102-3: Determine the starting calculation position of the original data corresponding to the target sequence number in the data coding information according to the sub-coding information of the original data corresponding to the intermediate sequence number.
[0083] In specific implementation, the last bit of the sub-coding information of the original data corresponding to the intermediate sequence number can be determined, and the position of the coded data located after and adjacent to the last bit of the coded data in the data coding information can be used as the starting calculation position.
[0084] For example, when the target sequence number is 3 and the intermediate sequence number is 2, if the data encoding information is 0x00800000010005c885939396d385848785994040, and according to the second type indicator value 497 corresponding to the intermediate sequence number 2, the corresponding sub-coding information of the original data is determined to be 0x0005c885939396, then the position of the encoded data d located after the encoded data 6 can be used as the starting calculation position.
[0085] S102-4: Determine the target sub-coding information of the original data corresponding to the target sequence number from the data coding information according to the first type indicator value and the starting calculation position.
[0086] Exemplarily, the character length of the target sub-coding information of the original data corresponding to the target serial number can be determined according to the first type indicator value, and then the target sub-coding information can be sequentially determined in the data coding information starting from the starting calculation position according to the character length.
[0087] In another embodiment, after determining the first type indicator value and the second type indicator value, the length sum of the character lengths indicated by each second type indicator value may be determined first, and then the starting calculation position is determined according to the first coded data in the data coding information and the length sum. In this way, by using the length sum to determine the starting calculation position, there is no need to determine the sub-coding information corresponding to each second type indicator value from the data coding information, which is conducive to reducing the amount of calculation.
[0088] In one embodiment, when storing each column data in the data table, not only the data type can be set, but also the type setting rule of whether the column data is allowed to be a null value can be set. Therefore, the type indicator value can be determined by the data type used when the original data is stored and the type setting rule indicating whether the data of the data type can be set to a null value. For the above S102-4, it can be implemented according to the following steps:
[0089] S102-4-1: Determine the target data type of the original data corresponding to the target serial number and the type setting rule of the target data type according to the first type indicator value; the type setting rule is used to indicate whether the data with the target data type can be set to a null value.
[0090] Here, a raw data stored by the server has a serial number, so the raw data stored by the server includes the raw data corresponding to the target serial number, and the serial number of the raw data is the target serial number. The target data type of the raw data corresponding to the target serial number is the data type used by the server when storing the raw data. Different data types may have different type setting rules. The type setting rule corresponding to a data type is used to indicate whether the data with the data type can be null. Among them, nullable is used to indicate that the data can be null, that is, the type setting rule corresponding to nullable indicates that the data with the target data type can be set to a null value; non-null (not null) is used to indicate that the data cannot be null. That is, the type setting rule corresponding to not null indicates that the data with the target data type cannot be set to a null value.
[0091] In addition to indicating the data type, the type indicator value can also indicate the type setting rule of the original data corresponding to the type indicator value. In specific implementation, the association relationship between the type indicator value and the data type can be pre-stored, and then, based on the first type indicator value and the association relationship, the target data type indicated by the first type indicator value (i.e., the target data type of the original data corresponding to the target sequence number) can be determined, and at the same time, the type setting rule of the target data type can be determined based on the first type indicator value.
[0092] The type indicator value may specifically be an integer, and when determining the type setting rule of the target data type according to the first type indicator value, it may be determined according to the parity of the first type indicator value. Specifically, when the first type indicator value is an odd number, the type setting rule of the target data type may be determined to be a first setting rule indicating that the target data type can be set to a null value. Alternatively, when the first type indicator value is an even number, the type setting rule of the target data type may be determined to be a second setting rule indicating that the target data type cannot be set to a null value.
[0093] For example, for col1, since the type indication value corresponding to col1 is an odd number 497, the type setting rule corresponding to col1 is the first setting rule. According to the data table information corresponding to col1 (i.e., col1 nullable INT), col1 is nullable and can be set to a null value, which verifies that the type setting rule corresponding to col1 is the first setting rule.
[0094] S102-4-2: When the type setting rule indicates that the target data type cannot be set to a null value, the end position is determined from the starting calculation position according to the target data type and data encoding information.
[0095] Here, whether the data can be set to a null value will also affect the length of the encoding information corresponding to the data. Specifically, when the data can be set to a null value, a certain number of characters need to be preset to represent the null value, such as two characters; when the data cannot be set to a null value, no characters need to be preset.
[0096] In a specific implementation, when the type setting rule indicates that the target data type cannot be set to a null value, it can be determined that there are no preset characters related to the target sub-coding information in the data encoding information, and the calculation position can be directly started, and the end position can be determined based on the character length indicated by the target data type and the data encoding information.
[0097] Exemplarily, when the target sequence number is 3 and the starting calculation position is the encoded data d, it can be seen from the type indication value 452 corresponding to col3 that the target data type corresponding to col3 cannot be set to a null value, then it can be directly started from the encoded data d, and based on the character length indicated by the target data type, the end position of the target sub-encoding information is determined to be the position of the last encoded data 0 in the data encoding information.
[0098] In one embodiment, the step of determining the end position can be determined according to a specific target data type. Specifically, when the target data type is a variable character length type, according to the data encoding information, the intermediate sub-encoding information having a second preset character length is selected from the starting calculation position; the intermediate sub-encoding information is used to represent the target character length of the original data corresponding to the target sequence number.
[0099] Here, the character length variable type can be a VARCHAR type. Here, since the target data type is a character length variable type, it is necessary to dynamically obtain the target character length of the original data corresponding to the target sequence number each time the calculation is performed. The intermediate sub-coding information of the second preset character length is used to characterize the character length of the coding information corresponding to the VARCHAR type data. Exemplarily, the second preset character length can be 2, that is, two characters, corresponding to 4 coded data, that is, the character length of 2 coded data is 1.
[0100] For example, for col2, the starting calculation position is the position of the first coded data 0 in 0005, and the corresponding type indicator value 448 indicates a target data type of VARCHAR type. According to the second preset character length (2), the intermediate sub-coding information (i.e., 0x0005) with the second preset character length can be selected from the starting calculation position. According to the intermediate sub-coding information, the target character length of the original data (i.e., hello) corresponding to the target sequence number is 5.
[0101] Then, the end point position can be determined from the target encoding information according to the target character length indicated by the intermediate sub-encoding information and the intermediate sub-encoding information.
[0102] Taking col2 as an example, when the target character length is 5 and the middle sub-coding information is 0x0005, it can be determined based on the target character length that there are 10 coded data corresponding to the original data matching the target sequence number. Therefore, starting from the first coded data c after the middle sub-coding information, 10 coded data can be selected in sequence, and the position of the 10th coded data is taken as the end position, that is, the end position is determined to be the position of the coded data 6.
[0103] In another embodiment, when the target data type is any one of a plurality of preset character types, the target character length corresponding to the character type is determined; the character lengths corresponding to the plurality of preset character types are immutable. Here, the plurality of preset character types may include Int type, Char type, long type, short type, float type, etc. The target character length corresponding to each preset character type is fixed.
[0104] Exemplarily, when the target data type indicated by the first type indicator value is the INT type, the target character length can be 3, corresponding to 6 encoded data; when the target data type indicated by the first type indicator value is the Char type, the target character length can be 8, corresponding to 16 encoded data.
[0105] Furthermore, when the target character length is determined, the end point position may be determined based on the data encoding information, the starting calculation position and the target character length.
[0106] For example, for col3, the starting calculation position is the position of the encoded data d, and the target character length corresponding to the char type is 8. Therefore, starting from the encoded data d, the position of the 16th encoded data 0 can be determined as the end position (that is, the position of the last encoded data 0 in 4040).
[0107] S102-4-3: Determine the target sub-coding information based on the data coding information between the end position and the starting calculation position.
[0108] Exemplarily, the coded data between the end position and the starting calculation position, and the coded data corresponding to the end position and the starting calculation position can be extracted as the target sub-coding information. For example, for col1, the starting calculation position is the position of the first 0 in 0080, and the end position is the position of the coded data 1, so the coded data between coded data 0 and coded data 1, coded data 0, and coded data 1 can be extracted to obtain the target sub-coding information 0x0080000001 corresponding to col1. For col2, the starting calculation position is the position of the first 0 in 0005, and the end position is the position of the coded data 6, so the coded data between coded data 0 and coded data 6, coded data 0, and coded data 6 can be extracted to obtain the target sub-coding information 0x0005c885939396 corresponding to col2. For col3, the starting calculation position is the position of the encoded data d, and the end position is the position of the last encoded data 0. Therefore, the encoded data between the encoded data d and the last encoded data 0, the encoded data d and the last encoded data 0 can be extracted to obtain the target sub-encoding information 0xd385848785994040.
[0109] In another embodiment, when the type setting rule indicates that the target data type can be set to a null value, the intermediate calculation position can be determined from the data encoding information according to the starting calculation position and the first preset character length corresponding to the null value.
[0110] Here, the first preset character length is used to indicate the character length corresponding to the null value, which can be determined according to the encoding method of the server. For example, in the hexadecimal encoding method, the first preset character length can be 2 (corresponding to 4 encoded data).
[0111] Exemplarily, for col1, the starting calculation position is the position of the first encoded data in the data encoding information. Since the type indication value 497 corresponding to col1 is an odd number, the type setting rule indicates that it can be a null value. In this way, the position of the encoded data 0 in the middle calculation position 80 can be determined based on the starting calculation position and the first preset character length corresponding to the null value. That is, the encoded data 0080 corresponding to the first two bytes in the data encoding information is the encoded data corresponding to the null value.
[0112] Then, the end position can be determined based on the intermediate calculation position, the target data type and the data encoding information, and the target sub-coding information can be determined based on the data encoding information between the end position and the start calculation position.
[0113] Exemplarily, starting from the middle calculation position, the end position of the original data corresponding to the target serial number can be determined in the data encoding information according to the character length corresponding to the target data type.
[0114] For example, for col1, the target data type is an integer type (int), and the character length corresponding to the integer type is 3 (corresponding to 6 coded data), so according to the character length and the middle calculation position, the end position can be determined to be the position of the coded data 1. Afterwards, according to the end position and the starting calculation position, the sub-coding information corresponding to col1 can be determined to be 0x0080000001.
[0115] S103: Decode the target sub-coding information of the original data corresponding to the target serial number to obtain the original data to be verified, and determine the verification result according to the original data to be verified and the target data.
[0116] Here, the client may be preset with a data decoding rule, which may be determined and deployed according to the encoding method of the server. The original data to be verified is the data obtained after the client decodes the target sub-encoding information. When the client successfully decodes, the original data to be verified is the original data corresponding to the target sub-encoding information. The verification result is used to indicate whether the original data matching the target sequence number stored by the server is consistent with the target data, which may include verification success and verification failure, wherein verification success is used to indicate data consistency, and verification failure is used to indicate data inconsistency. .
[0117] Exemplarily, when it is determined that the target sub-coding information corresponding to col3 is 0xd385848785994040, the client can decode 0xd385848785994040 according to the preset data decoding rule to obtain the original data ledger to be verified.
[0118] After obtaining the original data to be verified, the verification result can be determined in any of the following two ways:
[0119] Method 1: The client encodes the original data to be verified according to its own encoding rules to obtain the encoded data. It determines whether the encoded data is consistent with the target data. If they are consistent, it is determined that the original data matching the target serial number stored on the server has been successfully verified, and the target data has also been successfully verified; if they are inconsistent, it is determined that the original data matching the target serial number stored on the server has failed to be verified, and the target data has also failed to be verified.
[0120] Method 2: The client decodes the target data according to the decoding rules that match its own encoding rules to obtain the decoded data. It is determined whether the decoded data is consistent with the original data to be verified. If they are consistent, it is determined that the original data matching the target serial number stored on the server has been successfully verified, and the target data has also been successfully verified; if they are inconsistent, it is determined that the original data matching the target serial number stored on the server has failed to be verified, and the target data has also failed to be verified.
[0121] Regardless of whether it is based on the above method 1 or method 2, fine-grained verification of the original data stored on the server can be implemented on the client, thereby improving the flexibility of data verification.
[0122] In one embodiment, the preset data decoding rule can also be determined and deployed on the client according to the conversion relationship between the encoding method of the server and the encoding method of the client itself. Based on the decoding rule, not only can the decoding process of the target sub-encoding information be realized, but also the original data to be verified obtained after the decoding process can be directly matched with the encoding method of the client. In this case, after obtaining the original data to be verified, it can be directly determined whether the original data to be verified is consistent with the target data. If they are consistent, it can be determined that the verification is successful, otherwise it can be determined that the verification fails.
[0123] In this way, since the type indicator value in the data type array is used to indicate the data type used when the original data is stored in the relational database, the data type used by the server to store each piece of original data can be accurately parsed according to the type indicator value in the acquired data type array. Furthermore, according to the determined data type of each piece of original data, the data length corresponding to each piece of original data can be determined in sequence; then based on the determined data length and data encoding information, the sub-coding information corresponding to each piece of original data corresponding to the starting sequence number to the target sequence number can be sequentially determined in the data encoding information, so that the target sub-coding information of the original data corresponding to the target sequence number can be obtained. By decoding the target sub-coding information, the corresponding original data to be verified before encoding can be accurately obtained. Finally, by comparing the original data to be verified with the target data, the fine-grained verification of the original data to be verified stored by the server and matching any target sequence number can be achieved. That is, based on the embodiments of the present disclosure, the data types corresponding to each piece of original data are first serialized by the server to obtain a data type array, and then the data type array is parsed by the client, and the data encoding information is processed based on the parsing result. The original data to be verified stored on the server can be deserialized on the client, and fine-grained verification of the original data stored on the server can be efficiently achieved based on the deserialization result.
[0124] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0125] Based on the same inventive concept, a data verification device corresponding to the data verification method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned data verification method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0126] like Figure 2 FIG. 1 is a schematic diagram of a data verification device provided by an embodiment of the present disclosure, comprising:
[0127] The acquisition module 201 is used to obtain, in response to the verification operation on the target data with the target sequence number, a data type array and data encoding information corresponding to the relational database from the server; the data type array is used to maintain the data type used when the original data is stored in the relational database according to the storage sequence, and the data encoding information includes sub-encoding information of each piece of the original data;
[0128] A first determining module 202 is used to determine, from the data encoding information, the sub-coding information of each piece of original data corresponding to the starting sequence number to the target sequence number according to the arrangement order of the type indication value indicating the data type in the data type array;
[0129] The second determination module 203 is used to decode the target sub-coding information of the original data corresponding to the target sequence number to obtain the original data to be verified, and determine the verification result according to the original data to be verified and the target data.
[0130] In a possible implementation manner, the first determining module 202, when determining, in accordance with the arrangement order of the type indication value indicating the data type in the data type array, from the data encoding information, the sub-coding information of each piece of original data corresponding to the starting sequence number to the target sequence number, is configured to:
[0131] According to the sorting order bits of the type indicator values and the target sequence number, determine a first type indicator value whose sorting order bit matches the target sequence number and each second type indicator value whose sorting order bit is smaller than the target sequence number;
[0132] According to the sorting order bits of the second type indicator values, determining, from the data encoding information, sub-coding information of each piece of original data corresponding to the starting sequence number to the intermediate sequence number; the intermediate sequence number is adjacent to the target sequence number and is smaller than the target sequence number;
[0133] Determine, according to the sub-coding information of the original data corresponding to the intermediate sequence number, a starting calculation position of the original data corresponding to the target sequence number in the data coding information;
[0134] According to the first type indication value and the starting calculation position, the target sub-coding information of the original data corresponding to the target sequence number is determined from the data coding information.
[0135] In a possible implementation manner, the first determination module 202, when determining the target sub-coding information of the original data corresponding to the target sequence number from the data coding information according to the first type indication value and the starting calculation position, is configured to:
[0136] Determine, according to the first type indication value, a target data type of the original data corresponding to the target sequence number and a type setting rule for the target data type; the type setting rule is used to indicate whether the data having the target data type can be set to a null value;
[0137] In the case where the type setting rule indicates that the target data type cannot be set to a null value, determining an end point position from the starting calculation position according to the target data type and the data encoding information;
[0138] The target sub-coding information is determined according to the data encoding information between the end position and the starting calculation position.
[0139] In a possible implementation manner, after determining the type setting rule, the first determining module 202 is further configured to:
[0140] In a case where the type setting rule indicates that the target data type can be set to a null value, determining an intermediate calculation position from the data encoding information according to the starting calculation position and a first preset character length corresponding to the null value;
[0141] Determining the end point position according to the intermediate calculation position, the target data type and the data encoding information;
[0142] The target sub-coding information is determined according to the data coding information between the end position and the starting calculation position.
[0143] In a possible implementation manner, the first type indicator value is an integer;
[0144] The first determination module 202, when determining the type setting rule of the target data type according to the first type indication value, is used to:
[0145] In a case where the first type indication value is an odd number, determining that the type setting rule of the target data type is a first setting rule indicating that the target data type can be set to a null value;
[0146] In a case where the first type indication value is an even number, it is determined that the type setting rule of the target data type is a second setting rule indicating that the target data type cannot be set to a null value.
[0147] In a possible implementation manner, the first determination module 202, when determining the end position from the starting calculation position according to the target data type and the data encoding information, is configured to:
[0148] In the case where the target data type is a variable character length type, selecting intermediate sub-coding information having a second preset character length from the starting calculation position according to the data encoding information;
[0149] The end point position is determined from the data encoding information according to the target character length indicated by the intermediate sub-encoding information and the intermediate sub-encoding information.
[0150] In a possible implementation manner, the first determination module 202, when determining the end position from the starting calculation position according to the target data type and the data encoding information, is configured to:
[0151] In the case where the target data type is any character type among multiple preset character types, determining a target character length corresponding to the character type; the character lengths corresponding to the multiple preset character types are all immutable;
[0152] The end position is determined according to the data encoding information, the starting calculation position and the target character length.
[0153] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0154] Based on the same technical concept, the embodiment of the present application also provides a computer device. Figure 3 FIG. 1 is a schematic diagram of a computer device provided in an embodiment of the present application, including:
[0155] Processor 31, memory 32 and bus 33. The memory 32 stores machine-readable instructions executable by the processor 31, and the processor 31 is used to execute the machine-readable instructions stored in the memory 32. When the machine-readable instructions are executed by the processor 31, the processor 31 performs the following steps: S101: In response to the verification operation for the target data with the target sequence number, the data type array and data encoding information corresponding to the relational database are obtained from the server; the data type array is used to maintain the data type used when the original data is stored in the relational database according to the storage sequence, and the data encoding information includes sub-coding information of each piece of original data; S102: According to the arrangement order of the type indicator value indicating the data type in the data type array, the sub-coding information of each piece of original data corresponding to the starting sequence number to the target sequence number is sequentially determined from the data encoding information; S103: The target sub-coding information of the original data corresponding to the target sequence number is decoded to obtain the original data to be verified, and the verification result is determined according to the original data to be verified and the target data.
[0156] The above-mentioned memory 32 includes internal memory 321 and external memory 322; the memory 321 here is also called internal memory, which is used to temporarily store the calculation data in the processor 31, as well as the data exchanged with the external memory 322 such as the hard disk. The processor 31 exchanges data with the external memory 322 through the internal memory 321. When the computer device is running, the processor 31 and the memory 32 communicate through the bus 33, so that the processor 31 executes the execution instructions mentioned in the above method embodiment.
[0157] The present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the data verification method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0158] The computer program product of the data verification method provided in the embodiments of the present disclosure includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the steps of the data verification method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.
[0159] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) and the like.
[0160] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0161] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0162] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0163] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0164] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
[0165] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A data verification method, characterized in that: Applied to the client, including: In response to a verification operation on target data with a target sequence number, a data type array and data encoding information corresponding to a relational database are obtained from a server; the data type array is used to maintain the data type used when the original data is stored in the relational database according to a storage time sequence, and the data encoding information includes sub-encoding information of each piece of the original data; According to the arrangement order of the type indication value indicating the data type in the data type array, the sub-coding information of each piece of original data corresponding to the starting sequence number to the target sequence number is sequentially determined from the data coding information; Decoding the target sub-coding information of the original data corresponding to the target serial number to obtain the original data to be verified, and determining the verification result according to the original data to be verified and the target data; The step of determining, in accordance with the arrangement order of the type indication value indicating the data type in the data type array, the sub-coding information of each piece of original data corresponding to the starting sequence number to the target sequence number from the data coding information in sequence, includes: According to the type indication value obtained in the data type array, the data type used by the server to store each piece of original data is parsed; Determining the data length corresponding to each piece of original data in turn according to the determined data type used by each piece of original data; and Based on the data length corresponding to each piece of original data and the data encoding information, sub-coding information corresponding to each piece of original data corresponding to a starting sequence number to a target sequence number is sequentially determined in the data encoding information.
2. The method according to claim 1, characterized in that: The step of sequentially determining, from the data encoding information, sub-encoding information of each piece of original data corresponding to the starting sequence number to the target sequence number according to the arrangement order of the type indication value indicating the data type in the data type array includes: According to the sorting order bits of the type indicator values and the target sequence number, determine a first type indicator value whose sorting order bit matches the target sequence number and each second type indicator value whose sorting order bit is smaller than the target sequence number; According to the sorting order bits of the second type indicator values, determining, from the data encoding information, sub-coding information of each piece of original data corresponding to the starting sequence number to the intermediate sequence number; the intermediate sequence number is adjacent to the target sequence number and is smaller than the target sequence number; Determine, according to the sub-coding information of the original data corresponding to the intermediate sequence number, a starting calculation position of the original data corresponding to the target sequence number in the data coding information; According to the first type indication value and the starting calculation position, the target sub-coding information of the original data corresponding to the target sequence number is determined from the data coding information.
3. The method according to claim 2, characterized in that The determining, from the data encoding information according to the first type indication value and the starting calculation position, the target sub-coding information of the original data corresponding to the target sequence number includes: Determine, according to the first type indication value, a target data type of the original data corresponding to the target sequence number and a type setting rule for the target data type; the type setting rule is used to indicate whether the data having the target data type can be set to a null value; In the case where the type setting rule indicates that the target data type cannot be set to a null value, determining an end point position from the starting calculation position according to the target data type and the data encoding information; The target sub-coding information is determined according to the data encoding information between the end position and the starting calculation position.
4. The method according to claim 3, characterized in that After determining the type setting rule, the method further includes: In a case where the type setting rule indicates that the target data type can be set to a null value, determining an intermediate calculation position from the data encoding information according to the starting calculation position and a first preset character length corresponding to the null value; Determining the end point position according to the intermediate calculation position, the target data type and the data encoding information; The target sub-coding information is determined according to the data coding information between the end position and the starting calculation position.
5. The method according to claim 3, characterized in that: The first type indicator value is an integer; Determining a type setting rule for the target data type according to the first type indication value includes: In a case where the first type indication value is an odd number, determining that the type setting rule of the target data type is a first setting rule indicating that the target data type can be set to a null value; In a case where the first type indication value is an even number, it is determined that the type setting rule of the target data type is a second setting rule indicating that the target data type cannot be set to a null value.
6. The method according to claim 3, characterized in that The step of determining the end position from the starting calculation position according to the target data type and the data encoding information includes: In the case where the target data type is a variable character length type, selecting intermediate sub-coding information having a second preset character length from the starting calculation position according to the data encoding information; The end point position is determined from the data encoding information according to the target character length indicated by the intermediate sub-encoding information and the intermediate sub-encoding information.
7. The method according to claim 3, characterized in that The step of determining the end position from the starting calculation position according to the target data type and the data encoding information includes: In the case where the target data type is any character type among multiple preset character types, determining a target character length corresponding to the character type; the character lengths corresponding to the multiple preset character types are all immutable; The end position is determined according to the data encoding information, the starting calculation position and the target character length.
8. A data verification device, characterized in that: include: An acquisition module, configured to acquire, in response to a verification operation on target data having a target sequence number, a data type array and data encoding information corresponding to a relational database from a server; The data type array is used to maintain the data type used when the original data is stored in the relational database according to the storage time sequence, and the data encoding information includes sub-encoding information of each piece of the original data; A first determining module is used to determine, from the data encoding information, the sub-coding information of each piece of original data corresponding to the starting sequence number to the target sequence number according to the arrangement order of the type indication value indicating the data type in the data type array; A second determination module is used to decode the target sub-coding information of the original data corresponding to the target sequence number to obtain the original data to be verified, and determine the verification result according to the original data to be verified and the target data; The step of determining, in accordance with the arrangement order of the type indication value indicating the data type in the data type array, the sub-coding information of each piece of original data corresponding to the starting sequence number to the target sequence number from the data coding information in sequence, includes: According to the type indication value obtained in the data type array, the data type used by the server to store each piece of original data is parsed; Determining the data length corresponding to each piece of original data in turn according to the determined data type used by each piece of original data; and Based on the data length corresponding to each piece of original data and the data encoding information, sub-coding information corresponding to each piece of original data corresponding to a starting sequence number to a target sequence number is sequentially determined in the data encoding information.
9. A computer device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the processor performs the steps of the data verification 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 a computer program. When the computer program is executed by a computer device, the computer device executes the steps of the data verification method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Data analysis processing system and data processing method
CN111813846A
Providing data verification in a blockchain ledger
US20200177390A1