Background
At present, when data in a database is verified, an object to be verified is generally constructed according to a received verification request, the object to be verified may include a plurality of attribute fields, and each attribute field is correspondingly provided with identification information. The identification information may include a query condition, a required check sum, and an unnecessary check sum. For example, the query condition is denoted by C, the required check is denoted by Y, and the non-required check is denoted by N. Assume that the object to be verified has four attribute fields, attribute 1, attribute 2, attribute 3, and attribute 4. The identification information corresponding to the attribute 1 is C, the identification information corresponding to the attribute 2 is Y, the identification information corresponding to the attribute 3 is Y, and the identification information corresponding to the attribute 4 is N. It can be known that the expected values of attribute 1 and attribute 1 of the verification request are used as query conditions to generate a data file requiring verification of attribute 2 and attribute 3, but not requiring verification of attribute 4, and the data file is verified.
However, when another verification request is received, the identification information corresponding to the attribute 1, the attribute 2, the attribute 3, and the attribute 4 may be changed, for example, the identification information of the attribute 1 is Y, the identification information of the attribute 2 is Y, the identification information of the attribute 3 is N, and the identification information of the attribute 4 is C. It can be known that the attribute 4 and the expected value of the attribute 4 of the check request are used as query conditions to generate a data file requiring the check of the attribute 1 and the attribute 2, but not requiring the check of the attribute 3, and the data file is checked.
The data verification method needs to generate corresponding data files according to different verification requests, that is, the corresponding data files need to be generated according to the identification information, and the data verification method is limited by the identification information and is not flexible enough.
Disclosure of Invention
The present invention is directed to solving, at least to some extent, one of the technical problems in the related art. Therefore, an object of the present invention is to provide a data verification method, which does not need to generate corresponding data files for different verification requests, is not limited by identification information, is more flexible, determines attributes to be verified and corresponding attribute values thereof in a reverse direction, and improves verification efficiency.
A second object of the present invention is to provide a data verification apparatus.
In order to achieve the above object, an embodiment of a first aspect of the present invention provides a data verification method, including: receiving a data verification request, wherein the data verification request comprises a plurality of attributes and expected values corresponding to the attributes, and the attributes comprise an attribute with identification information and an attribute without identification information; taking the attribute with the identification information and the expected value corresponding to the attribute as retrieval conditions to retrieve, and acquiring data meeting the retrieval conditions; and verifying the data according to the attribute without the identification information and the expected value corresponding to the attribute.
According to the data verification method provided by the embodiment of the invention, the data verification request is received, the attribute with the identification information and the expected value corresponding to the attribute are used as the retrieval conditions for retrieval, the data meeting the retrieval conditions are obtained, and the data are verified according to the attribute without the identification information and the expected value corresponding to the attribute, so that corresponding data files do not need to be generated aiming at different verification requests, the limitation of the identification information is avoided, the data verification method is more flexible, the attribute needing to be verified and the attribute value corresponding to the attribute are reversely determined, and the verification efficiency is improved.
An embodiment of a second aspect of the present invention provides a data verification apparatus, including: the device comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving a data verification request, the data verification request comprises a plurality of attributes and expected values corresponding to the attributes, and the attributes comprise attributes with identification information and attributes without identification information; the retrieval module is used for retrieving the attribute with the identification information and the expected value corresponding to the attribute as retrieval conditions and acquiring data meeting the retrieval conditions; and the checking module is used for checking the data according to the attribute without the identification information and the expected value corresponding to the attribute.
According to the data verification device provided by the embodiment of the invention, the data verification request is received, the attribute with the identification information and the expected value corresponding to the attribute are used as the retrieval conditions for retrieval, the data meeting the retrieval conditions are obtained, and the data are verified according to the attribute without the identification information and the expected value corresponding to the attribute, so that corresponding data files do not need to be generated aiming at different verification requests, the limitation of the identification information is not needed, the data verification device is more flexible, the attribute needing to be verified and the attribute value corresponding to the attribute are reversely determined, and the verification efficiency is improved.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
A data verification method and apparatus according to an embodiment of the present invention are described below with reference to the drawings.
FIG. 1 is a flow diagram of a data verification method according to one embodiment of the invention.
As shown in fig. 1, the data verification method may include:
and S1, receiving a data verification request.
The data verification request may include a plurality of attributes and expected values corresponding to the attributes. The plurality of attributes may include an attribute having identification information and an attribute not having identification information. For example, the data check request may include three properties, namely property1, property2, and property3, where the expected value of property1 is property1 ', the expected value of property2 is property2 ', and the expected value of property3 is property3 '. Then, one identification information may be set for the attribute 1. Of course, identification information may also be set for attribute 2. Here, the setting may be made according to an actual data verification request.
And S2, searching by taking the attribute with the identification information and the expected value corresponding to the attribute as a searching condition, and acquiring data meeting the searching condition.
Specifically, a search sentence corresponding to the search condition may be generated, and the corresponding database may be searched according to the search sentence. For example: the search statement is select property2, property3from table _ XX where property1 is property1 ', where property1 is the property value of property1, property 1' is the expected value of property1, and property1 carries identification information. The database table _ XX may be retrieved based on property1 and its expected value property1 'to select the property value property2 for property2 and the property value property3 for property3from the database table _ XX when property1 is property 1'.
And S3, verifying the data according to the attribute without the identification information and the corresponding expected value.
Specifically, the attribute field that is consistent with the attribute without the identification information in the data and the attribute value corresponding to the attribute field may be obtained, and then the attribute value corresponding to the attribute field and the expected value of the attribute without the identification information may be compared one by one. If the attribute value is consistent with the expected value of the attribute without the identification information, the verification is passed; if the attribute value is not consistent with the expected value of the attribute without the identification information, the check fails. For example, when property1 is property 1', the obtained property value of property2 is property2 and the obtained property value of property3 is property 3. Then, according to the verification rules, property2vs property2 'and property3vs property 3', the property value of property2 is property2 and the expected value property2 'of property2 are compared, and the property value of property3 is property3 and the expected value property 3' of property3 are compared. If property2 is property2 'and property3 is property 3', the check passes. If the attribute value of either of attribute 2 and attribute 3 is not consistent with its corresponding expected value, the check fails.
It should be understood that when different data verification requests are received, corresponding data files do not need to be generated for the data verification requests, attribute values of other attributes can be obtained only by setting one piece of identification information for the attributes and using the identification information as a retrieval condition for retrieval, and then the attribute values and expected values of the other attributes are verified, so that the problem that corresponding identification information needs to be set for each attribute during each verification is solved.
According to the data verification method provided by the embodiment of the invention, the data verification request is received, the attribute with the identification information and the expected value corresponding to the attribute are used as the retrieval conditions for retrieval, the data meeting the retrieval conditions are obtained, and the data are verified according to the attribute without the identification information and the expected value corresponding to the attribute, so that corresponding data files do not need to be generated aiming at different verification requests, the limitation of the identification information is avoided, the data verification method is more flexible, the attribute needing to be verified and the attribute value corresponding to the attribute are reversely determined, and the verification efficiency is improved.
In order to achieve the purpose, the invention further provides a data checking device.
Fig. 2 is a schematic structural diagram of a data verification apparatus according to an embodiment of the present invention.
As shown in fig. 2, the data verification apparatus may include: a receiving module 110, a retrieving module 120 and a verifying module 130.
The receiving module 110 is configured to receive a data verification request. The data verification request may include a plurality of attributes and expected values corresponding to the attributes. The plurality of attributes may include an attribute having identification information and an attribute not having identification information. For example, the data check request may include three properties, namely property1, property2, and property3, where the expected value of property1 is property1 ', the expected value of property2 is property2 ', and the expected value of property3 is property3 '. Then, one identification information may be set for the attribute 1. Of course, identification information may also be set for attribute 2. Here, the setting may be made according to an actual data verification request.
The retrieving module 120 is configured to retrieve the attribute with the identification information and the expected value corresponding to the attribute as a retrieving condition, and obtain data meeting the retrieving condition. Specifically, a search sentence corresponding to the search condition may be generated, and the corresponding database may be searched according to the search sentence. For example: the search statement is select property2, property3from table _ XX where property1 is property1 ', where property1 is the property value of property1, property 1' is the expected value of property1, and property1 carries identification information. The database table _ XX may be retrieved based on property1 and its expected value property1 'to select the property value property2 for property2 and the property value property3 for property3from the database table _ XX when property1 is property 1'.
The checking module 130 is configured to check the data according to the attribute without the identification information and the expected value corresponding to the attribute. Specifically, the attribute field that is consistent with the attribute without the identification information in the data and the attribute value corresponding to the attribute field may be obtained, and then the attribute value corresponding to the attribute field and the expected value of the attribute without the identification information may be compared one by one. If the attribute value is consistent with the expected value of the attribute without the identification information, the verification is passed; if the attribute value is not consistent with the expected value of the attribute without the identification information, the check fails. For example, when property1 is property 1', the obtained property value of property2 is property2 and the obtained property value of property3 is property 3. Then, according to the verification rules, property2vs property2 'and property3vs property 3', the property value of property2 is property2 and the expected value property2 'of property2 are compared, and the property value of property3 is property3 and the expected value property 3' of property3 are compared. If property2 is property2 'and property3 is property 3', the check passes. If the attribute value of either of attribute 2 and attribute 3 is not consistent with its corresponding expected value, the check fails.
It should be understood that when different data verification requests are received, corresponding data files do not need to be generated for the data verification requests, attribute values of other attributes can be obtained only by setting one piece of identification information for the attributes and using the identification information as a retrieval condition for retrieval, and then the attribute values and expected values of the other attributes are verified, so that the problem that corresponding identification information needs to be set for each attribute during each verification is solved.
According to the data verification device provided by the embodiment of the invention, the data verification request is received, the attribute with the identification information and the expected value corresponding to the attribute are used as the retrieval conditions for retrieval, the data meeting the retrieval conditions are obtained, and the data are verified according to the attribute without the identification information and the expected value corresponding to the attribute, so that corresponding data files do not need to be generated aiming at different verification requests, the limitation of the identification information is not needed, the data verification device is more flexible, the attribute needing to be verified and the attribute value corresponding to the attribute are reversely determined, and the verification efficiency is improved.
In the description of the present invention, it is to be understood that the terms "central," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," "circumferential," and the like are used in the orientations and positional relationships indicated in the drawings for convenience in describing the invention and to simplify the description, and are not intended to indicate or imply that the referenced devices or elements must have a particular orientation, be constructed and operated in a particular orientation, and are therefore not to be considered limiting of the invention.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
In the present invention, unless otherwise expressly stated or limited, the terms "mounted," "connected," "secured," and the like are to be construed broadly and can, for example, be fixedly connected, detachably connected, or integrally formed; can be mechanically or electrically connected; they may be directly connected or indirectly connected through intervening media, or they may be connected internally or in any other suitable relationship, unless expressly stated otherwise. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
In the present invention, unless otherwise expressly stated or limited, the first feature "on" or "under" the second feature may be directly contacting the first and second features or indirectly contacting the first and second features through an intermediate. Also, a first feature "on," "over," and "above" a second feature may be directly or diagonally above the second feature, or may simply indicate that the first feature is at a higher level than the second feature. A first feature being "under," "below," and "beneath" a second feature may be directly under or obliquely under the first feature, or may simply mean that the first feature is at a lesser elevation than the second feature.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.