A method and device for acquiring data by matching application scenarios through a self-incrementing primary key

CN115309741BActive Publication Date: 2026-10-16SUZHOU GADUN QUANSHENG INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210868020.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-22
Publication Date
2026-10-16
Estimated Expiration
2042-07-22

AI Technical Summary

Technical Problem

[0006]有鉴于此,本发明的目的在于提出一种通过自增长数列匹配应用场景的数据管理方法,用以解决现有技术中通过规则编码管理数据产生的能耗大且发生重码的问题

Benefits of technology

[0036] 1. This application uses an auto-incrementing sequence as a unique code, superimposes rules to limit scene conditions in the scene, generates a new unique code when a task is accepted, and expands the scene involved in the task under the premise of the unique code. By superimposing rules to limit scene conditions in the scene, the problem of auto-incrementing sequences being unable to match rules is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115309741B_ABST
    Figure CN115309741B_ABST
Patent Text Reader

Abstract

The application provides a method for acquiring data by matching application scenarios of self-incrementing primary keys, receiving a task, forming a record in a transaction link table, the record taking a self-incrementing sequence as a primary key to form a unique code representing a transaction; respectively establishing a characteristic table for a node involved in task running, for storing corresponding node data values; the characteristic table being linked with the link table by taking the unique code as a primary key; and in response to a user query, linking any characteristic table through the unique code to acquire relevant data. The application takes a self-incrementing sequence as a unique code, limits scenario conditions by superimposing rules in a scenario, obtains a unique code, and solves the problem that a self-incrementing sequence cannot be matched with rules; and in response to a user query, links any characteristic table through the unique code to acquire relevant data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to data querying, and in particular to methods, apparatus and computer programs for querying data in a database system using an auto-incrementing primary key. Background Technology

[0002] Relational databases are a common mechanism for storing information on computer systems while providing convenient access for users. A typical relational database is an organized collection of information stored as "records" with informational "fields." For example, an employee database has records for each employee, where each record contains fields specifying details about the employee, such as name, home address, salary, etc.

[0003] In database systems, auto-incrementing IDs are created by setting the `id` field to auto-increment during table design. This means that when inserting a row of data, the system automatically generates an ID to populate the table without requiring a specified ID. Databases offer automatic numbering, which is fast, and the incremental, sequential storage of IDs is highly advantageous for retrieval. Furthermore, auto-incrementing IDs are numeric, occupy little space, are easy to sort, and are convenient to pass within programs. However, in practical use, because auto-incrementing IDs lack rules, they cannot be matched to system scenarios, thus making it impossible to perform operations such as queries using auto-incrementing IDs.

[0004] To address the above issues, a universally unique identifier (UUID) was developed. This refers to a number generated on a single machine that guarantees uniqueness across all scenarios within the same time and space. To ensure the uniqueness of the primary key ID within a certain range, encoding rules need to be set. However, these encoding rules make UUIDs slower to query compared to purely numeric auto-incrementing sequences; UUIDs also consume more space and energy, and their generation requires setting encoding rules, thus limiting their capacity. Because the rules for UUIDs are unique, flawed rule design or loopholes can lead to issues such as duplicate codes.

[0005] In summary, developing a self-incrementing ID that occupies little space, is easy to sort, has low system energy consumption, high system capacity, and can solve the problem that self-incrementing encoding cannot reflect rules is one of the important problems that need to be solved. Summary of the Invention

[0006] In view of this, the purpose of this invention is to propose a data management method that matches application scenarios through an auto-incrementing sequence, in order to solve the problems of high energy consumption and duplicate codes in the existing technology of managing data through rule encoding.

[0007] To achieve the above objectives, this invention provides a method for managing data based on application scenarios using auto-incrementing primary keys, comprising the following steps:

[0008] Receive the task and form a transaction record in the transaction link table. The transaction record uses an auto-incrementing column as the primary key as a unique code representing the transaction.

[0009] A feature table is established for each process node involved in the task execution scenario to store the corresponding node data values; the feature table is linked to the linked table with a unique code as the primary key.

[0010] In response to user queries, the system matches the relevant scenarios based on the conditions specified in the query and determines the feature table corresponding to the queried scenario.

[0011] The unique code is obtained from the characteristic table, and the other characteristic tables linked to the unique code are queried in the transaction link table to obtain all task data.

[0012] In some embodiments, the step of receiving a task and creating a transaction record in the transaction link table is described.

[0013] The transaction record uses an auto-incrementing array as the primary key as a unique code representing the transaction.

[0014] A transaction link table is established, including primary key data and other attribute data. The primary key data is the transaction ID, which follows an auto-incrementing sequence rule. Each time a task is received, a task record is added to the transaction link table. The system automatically generates the transaction ID for each task record according to the auto-incrementing sequence's growth rule.

[0015] The generated transaction ID serves as a unique identifier.

[0016] In some embodiments, a characteristic table is established for each node involved in the task execution to store the corresponding node data values; the characteristic table is linked to a linked table using a unique code as the primary key.

[0017] Based on the transaction execution rules, the nodes involved in the transaction are determined, and a characteristic table template is established. The characteristic table includes the transaction ID, other attribute data, and...

[0018] Based on the task, establish a characteristic table of the nodes involved in the task;

[0019] The characteristic table is linked to the linked table via transaction ID.

[0020] In some embodiments, in response to a user query, retrieving relevant data by linking any feature table through the unique code includes,

[0021] In response to a user query, the system matches the content of the corresponding attribute field in the attribute table. A unique code is obtained from the data in any attribute field of the attribute table. By matching the content of any attribute field in the attribute table, a specific record in the attribute table is located, and a unique code (transaction ID) is extracted from that specific record.

[0022] Based on the unique encoding, the corresponding query content of all feature tables can be obtained by linking the linked tables to other feature tables.

[0023] In some embodiments, obtaining relevant data by linking any feature table through the unique code includes,

[0024] The characteristic table is used to store the corresponding node data values. When a node action occurs, the transaction ID and the data generated by the action are combined and recorded in the characteristic table to form a characteristic table record.

[0025] In some embodiments, when the task undergoes a deletion / append action,

[0026] In response to a user's data deletion operation, delete the corresponding transaction ID in the transaction linked table.

[0027] In response to a user's append data operation, a new transaction record is added to the transaction linked table. The new record uses an auto-incrementing column as the primary key to form a unique code representing the new transaction.

[0028] Another aspect of the present invention is to provide an apparatus for querying data using an auto-incrementing primary key.

[0029] The task receiving module is used to receive tasks and form records in the transaction link table. The records form a unique code representing the transaction with an auto-incrementing number as the primary key.

[0030] The task linking module is used to create feature tables for each node involved in the task execution. The feature tables are linked to the linking table using a unique code as the primary key.

[0031] The query module is used to respond to user queries by linking to any feature table through the unique code, and querying and retrieving relevant data.

[0032] In some embodiments, the device includes

[0033] The delete module is a device used to delete the corresponding transaction ID in the transaction linked table in response to user data deletion operations.

[0034] An append module is used to respond to user data update operations by adding a new transaction record to the transaction linked table. The new record is a device that uses an auto-incrementing column as the primary key to form a unique code representing the new transaction.

[0035] The present invention has at least the following beneficial technical effects:

[0036] 1. This application uses an auto-incrementing sequence as a unique code, superimposes rules to limit scene conditions in the scene, generates a new unique code when a task is accepted, and expands the scene involved in the task under the premise of the unique code. By superimposing rules to limit scene conditions in the scene, the problem of auto-incrementing sequences being unable to match rules is solved.

[0037] 2. This application uses an auto-incrementing sequence as the primary key. Upon receiving a task, an auto-incrementing sequence is generated as the primary key. Using an auto-incrementing sequence as the primary key results in small space usage and low energy consumption.

[0038] 3. This application utilizes the inherent mechanism of computers to generate self-increasing sequences; since self-increasing sequences are based on computer mechanisms, they are inherently unique, have no capacity limitations, and will not generate duplicate codes. Any update / addition by any task forms a new record, achieving complete elimination of duplicate codes and improving the effectiveness of data use;

[0039] 4. This application uses an auto-incrementing sequence as the primary key of any transaction, and establishes a characteristic table based on any node involved in the transaction process. The characteristic tables are all linked to the transaction link table through the transaction ID. During querying, the content of any attribute field in the characteristic table can be matched and queried to lock the characteristic record in the characteristic table.

[0040] 5. The query described in this application also includes extracting the transaction ID by locking the characteristic table records; and linking other characteristic tables through the transaction ID to obtain the query content of all characteristic tables, resulting in fast query speed;

[0041] 6. The auto-incrementing sequence provided in this application is linked to other characteristic tables based on the transaction ID in the linked table to obtain the characteristic records of all linked characteristic tables;

[0042] 7. The characteristic table of this application is generated from the task itself that needs to be run, producing characteristic table records and solving the problem of determining the characteristic table. Attached Figure Description

[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these drawings without creative effort.

[0044] Figure 1 This illustrates a query processing flow according to an embodiment of the present invention;

[0045] Figure 2This schematic diagram illustrates the structure of the transaction link table generating transaction IDs when the application receives a task.

[0046] Figure 3 schematic representation Figure 2 The diagram shown illustrates the relationship between each process node and the transaction ID in the task.

[0047] Figure 4 This is a schematic diagram illustrating the query process for the corresponding user. Detailed Implementation

[0048] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to specific examples and the accompanying drawings.

[0049] It should be noted that all uses of "first" and "second" in the embodiments of the present invention are for the purpose of distinguishing two different entities or different parameters with the same name. Therefore, "first" and "second" are merely for convenience of expression and should not be construed as limiting the embodiments of the present invention. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, such as other steps or units inherent in a process, method, system, product, or device that includes a series of steps or units.

[0050] Encoding rules are the rules that a program must follow when encoding. The rule-based encoding widely used today is to embody information within the rules, thus requiring restrictions on length, naming conditions, etc. However, in reality, the amount of data that can be carried after limiting the length is limited, and in actual use, if operations such as deletion, updating, and appending occur, problems such as duplicate codes and code skipping are likely to occur, posing challenges to the effectiveness and security of data use.

[0051] To achieve the above objectives, a first aspect of this invention proposes a method for obtaining data by matching application scenarios using an auto-incrementing primary key. This application uses attribute fields to represent scenario information and, through a linked table method, can extract all attribute fields. Figure 1 The diagram shown is a schematic of the self-incrementing primary key application method based on scenario binding provided by the present invention.

[0052] like Figure 1 As shown, a method for retrieving data by matching application scenarios using an auto-incrementing primary key includes:

[0053] The task is received and a transaction record is formed in the transaction link table. The transaction record uses an auto-incrementing column as the primary key as a unique code representing the transaction. The transaction record is a log record that records the transaction processing process.

[0054] A feature table is established for each process node involved in the task execution scenario to store the corresponding node data values; the feature table is linked to the linked table with a unique code as the primary key.

[0055] In response to user queries, the system matches the relevant scenarios based on the conditions specified in the query and determines the feature table corresponding to the queried scenario.

[0056] The unique code is obtained from the characteristic table, and the other characteristic tables linked to the unique code are queried in the transaction link table to obtain all task data.

[0057] In this embodiment of the invention, a transaction is the smallest unit of work in database operations, which is a series of operations executed as a single logical unit of work; these operations are submitted to the system as a whole, and either all of them are executed or none of them are executed; a transaction is a set of indivisible operations.

[0058] This application uses an auto-incrementing sequence as a unique code. When a task is accepted, a new unique code is generated. A feature table is linked on the unique code. The feature table is used to record the data of the scenario involved in the task. Rules are superimposed on the scenario to limit the scenario conditions, thus solving the problem that the auto-incrementing sequence cannot match the rules.

[0059] A node is a series of steps in a process; a process task consists of several nodes. The node types include task nodes, activity nodes, branch nodes, aggregation nodes, decision nodes, and edge nodes. Process logic is implemented through combinations of different node types. As described in this application, each task is assigned a unique number, and a preset characteristic table is expanded based on this unique number. This characteristic table is used to record the data of the corresponding process node. The process node in this application is defined as a segment of the process nodes involved in the transaction execution, where each process node is divided into independent nodes. Each node is linked to a transaction ID at only one end; hence, it is called a process node in this application.

[0060] In this application, since each characteristic table is linked to a linked table and linked to other characteristic tables through the transaction ID in the linked table, the characteristic table only records the data of its corresponding process node and is not linked to other characteristic tables, serving as the node for the recorded data.

[0061] like Figure 2 As shown in this application, the process of receiving a task and forming a transaction record in a transaction link table, wherein the transaction record uses an auto-incrementing column as the primary key as a unique code representing the transaction, includes the following specific steps:

[0062] Establish a transaction link table, including primary key data and other attribute data; the primary key data is the transaction ID, and the transaction ID follows an auto-incrementing sequence rule. Each time a task is received, a task record is added to the transaction link table. The system automatically generates the transaction ID of the task record according to the growth rule of the auto-incrementing sequence. The transaction record is a log record that records the transaction processing process.

[0063] The generated transaction ID serves as a unique code for the accepted task.

[0064] In this application, characteristic tables are established for each process node involved in the task execution scenario to store the corresponding node data values; the characteristic tables are linked to linked tables using a unique code as the primary key, including,

[0065] Based on the transaction execution rules of the aforementioned task, the scenarios involved in running the transaction and the process nodes involved in each scenario are determined.

[0066] A feature table template is created based on process nodes. The feature table includes transaction ID, other attribute data, and the feature table is linked to the transaction link table through the transaction ID.

[0067] The characteristic table is used to store the data values ​​of the corresponding process nodes. When the node action occurs, the transaction ID and the data generated by the action are combined and recorded in the characteristic table to form a characteristic record.

[0068] Example 1

[0069] Taking the task of accepting the production of washing labels as an example, such as Figure 3 As shown,

[0070] According to the process of washing label task 1, which involves process nodes such as material preparation, production, settlement and shipment, the system receives washing label task 1 and forms a record in the transaction link table. The record forms a unique code representing the transaction, namely the transaction ID, with an auto-incrementing column as the primary key.

[0071] Based on the process nodes involved in the label washing task 1, such as material preparation, production, settlement, and shipment, corresponding characteristic tables for material preparation, production, settlement, and shipment are established respectively to store the attribute information of the corresponding nodes; the characteristic tables are linked to the linked tables with the transaction ID as the primary key.

[0072] In some embodiments, in response to a user's query, the relevant data is obtained by linking any feature table through the unique code.

[0073] like Figure 4 As shown, specifically including

[0074] Step S1: In response to the user query, match the content of the corresponding attribute field in the feature table according to the query content;

[0075] Step S2: Query the transaction ID to which any attribute field in the shipping characteristic table belongs. Locate the specific record in the characteristic table by matching the content of any attribute field. Extract the unique code (transaction ID) from the specific record.

[0076] Step S3: Based on the unique code, obtain the corresponding query content of all characteristic tables based on the transaction ID by linking other characteristic tables through the linked table.

[0077] Example 2

[0078] Taking the label-receiving task in Example 1 as an example, in response to a user's query, the relevant data is obtained by linking any feature table through the unique code as follows:

[0079] Step S1: In response to the user's shipment query, match the corresponding attribute field content in the feature table according to the query content;

[0080] Step S2: Query the transaction ID to which the shipping characteristic table belongs by any attribute field in the shipping characteristic table. Locate a specific record in the characteristic table by matching the content of any attribute field in the characteristic table, and extract the unique code (transaction ID) from the specific record.

[0081] Step S3: Based on the transaction ID, obtain the corresponding characteristic records of all characteristic tables linked to the transaction ID by linking other characteristic tables through the linked table.

[0082] Example 3

[0083] When the task is deleted.

[0084] In response to a user's data deletion operation, delete the corresponding transaction ID in the transaction linked table.

[0085] When the aforementioned task is added...

[0086] In response to a user's append data operation, a new transaction record is added to the transaction linked table. The new record uses an auto-incrementing column as the primary key to form a unique code representing the append transaction.

[0087] Another aspect of the present invention is to provide an apparatus for querying data using an auto-incrementing primary key.

[0088] The task receiving module is used to receive tasks and form records in the transaction link table. The records form a unique code representing the transaction with an auto-incrementing number as the primary key.

[0089] The task linking module is used to create feature tables for each node involved in the task execution. The feature tables are linked to the linking table using a unique code as the primary key.

[0090] The query module is used to respond to user queries by linking to any feature table through the unique code, and querying and retrieving relevant data.

[0091] In some embodiments, this application further includes,

[0092] The delete module is a device used to delete the corresponding transaction ID in the transaction linked table in response to user data deletion operations.

[0093] The update module is used to respond to user data update operations by adding a new transaction record to the transaction linked table. The new record is a device that uses an auto-incrementing column as the primary key to form a unique code representing the new transaction.

Claims

1. A method for obtaining data by matching application scenarios using an auto-incrementing primary key, characterized in that, Receive the task and form a transaction record in the transaction link table. The transaction record uses an auto-incrementing column as the primary key as a unique code representing the transaction. A feature table is established for each process node involved in the task execution scenario to store the corresponding node data values; the feature table is linked to the linked table with a unique code as the primary key. In response to user queries, the system matches the relevant scenarios based on the conditions specified in the query and determines the feature table corresponding to the queried scenario. In response to a user's query, the system matches the relevant scenario based on the conditions defined in the query, and determines the characteristic table corresponding to the queried scenario, including... In response to user queries, the system matches the corresponding scenario based on the conditions specified in the user query, and performs a matching query by the content of any attribute field in the feature table to lock a specific record in the feature table; The unique code is obtained from the characteristic table, and the other characteristic tables linked to the unique code are queried in the transaction link table to obtain all task data. The process of obtaining a unique code from a characteristic table, and then retrieving all data for the task from any characteristic table linked to that unique code in the transaction connection table, includes: obtaining the unique code through data in any attribute field of the characteristic table, specifically... By matching the content of any attribute field in the attribute table, a specific record in the attribute table can be located. Extract the transaction ID from a specific record and link other characteristic tables in the linked table based on that transaction ID to obtain the characteristic records of all the linked characteristic tables; The receiving task, and the formation of transaction records in the transaction link table, wherein the transaction records use an auto-incrementing column as the primary key as a unique code representing the transaction, include... A transaction link table is established, including primary key data and other attribute data. The primary key data is the transaction ID, which follows an auto-incrementing sequence rule. Each time a task is received, a task record is added to the transaction link table. The system automatically generates the transaction ID of the task record according to the growth rule of the auto-incrementing sequence, and the generated transaction ID serves as a unique code.

2. The method for obtaining data by matching application scenarios through auto-incrementing primary keys according to claim 1, characterized in that, A characteristic table is established for each process node involved in the task execution scenario to store the corresponding node data values; the characteristic table is linked to a linked table using a unique code as the primary key, including, Based on the transaction execution rules of the task, the scenarios involved in running the transaction and the process nodes involved in each scenario are determined. A feature table template is created based on process nodes. The feature table includes transaction ID, other attribute data, and the feature table is linked to the transaction link table through the transaction ID. The characteristic table is used to store the data values ​​of the corresponding process nodes. When the node action occurs, the transaction ID and the data generated by the action are combined and recorded in the characteristic table to form a characteristic record.

3. The method for obtaining data by matching application scenarios through auto-incrementing primary keys according to claim 1, characterized in that, When the task performs a delete / append operation, in response to the user's data deletion operation, the corresponding transaction ID is deleted from the transaction linked table; in response to the user's data append operation, a new transaction record is added to the transaction linked table. The new transaction record uses an auto-incrementing column as the primary key to form a unique code representing the appended transaction.

4. An apparatus for implementing the method of obtaining data by matching application scenarios through auto-incrementing primary keys as described in claim 1, characterized in that, The task receiving module is used to receive tasks and form records in the transaction link table. The records form a unique code representing the transaction with an auto-incrementing number as the primary key. The task linking module is used to create characteristic tables for each process node involved in the task execution. The characteristic tables are linked to the linking table using a unique code as the primary key. The query module is used to respond to user queries, link any feature table through the unique code, and query and retrieve relevant data.

5. The apparatus according to claim 4, characterized in that, include, The delete module is a device for deleting the corresponding transaction ID in the transaction linked table in response to a user's data deletion operation; An append module is used to respond to user append data operations by adding a new transaction record to the transaction linked table. The new transaction record is a device that uses an auto-incrementing column as the primary key to form a unique code representing the append transaction.

Citation Information

Patent Citations

  • Digital dictionary establishment method and device based on dimension table model

    CN114579568A

  • Rule engine establishing method and device based on attribute identification

    CN114579569A