Database operation instruction determination method and device, electronic equipment and storage medium
By parsing and verifying database operation requests, and combining global multi-level cache directory and namespace information, target database operation instructions are generated. This solves the problem of poor instruction flexibility and accuracy in multi-terminal database processing systems, and achieves efficient and stable database operations.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-26
- Publication Date
- 2026-04-07
AI Technical Summary
In multi-terminal database processing systems, the poor flexibility and accuracy of database operation commands lead to high coupling, difficult maintenance, and system instability.
By acquiring database operation requests, parsing and verifying associated information, and combining global multi-level cache directory and namespace information, the target database operation instruction template is determined, and the target database operation instruction is generated based on business parameters. The method of hierarchical parsing and cache matching is used to achieve standardized generation of operation instructions.
It improves the flexibility and accuracy of database operations, reduces system coupling, enhances operational efficiency and scalability, and adapts to the needs of different database types and versions.
Smart Images

Figure CN121807807A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of database, and particularly relates to a database operation instruction determination method and device, electronic equipment and storage medium. BACKGROUND
[0002] In the field of databases, in a multi-end database processing system involving a source end, a backup end or middleware, in a database operation process, different databases may be involved, and different command statements need to be maintained between different databases. Therefore, the command statements are persisted in the code, and in the actual need for modification, the code needs to be changed. For example, with the upgrade and modification of the database, the instruction needs to be changed, which causes high coupling degree, destroys the closed principle in the maintenance of the program, and needs to determine different instructions in different situations, which limits the application scenarios and causes instability of the database system. SUMMARY
[0003] The present application provides a database operation instruction determination method and device, electronic equipment and storage medium, to solve the problems of poor flexibility and poor accuracy of database operation instruction determination.
[0004] According to an aspect of the present application, a database operation instruction determination method is provided, comprising:
[0005] Obtaining a database operation request, and determining database operation associated information based on the database operation request, wherein the database operation associated information comprises database node information, a database operation task and business parameters corresponding to the database operation task, the database node information comprises a database node name, a database type and a database mode;
[0006] Determining a target multi-level cache directory based on the database node information and a global multi-level cache directory, wherein the global multi-level cache directory comprises namespace information corresponding to a plurality of database types, a plurality of database versions and / or at least one database node name, and the namespace information comprises a mapping relationship between a database operation identifier and a database operation instruction template;
[0007] Determining at least one database operation identifier corresponding to the database operation task, and determining a target database operation instruction template based on the database operation identifier and the namespace information in the target multi-level cache directory;
[0008] Generating a target database operation instruction based on the business parameters and the target database operation instruction template.
[0009] Optionally, the database operation association information is determined based on the database operation request, including: performing analysis and information extraction processing on the database operation request to obtain a key information extraction result; performing verification on the key information extraction result by a parameter verification module to obtain database operation association information that meets a preset information verification condition, and determining the database operation association information that meets the preset information verification condition as the database operation association information, wherein the preset information verification condition includes an information integrity verification condition and a legality verification condition.
[0010] Optionally, the target multi-level cache directory is determined based on the database node information and the global multi-level cache directory, including: obtaining the global multi-level cache directory from a preset storage space; and performing retrieval and positioning processing on the global multi-level cache directory based on a database node name, a database type and a database mode in the database node information to obtain the target multi-level cache directory.
[0011] Optionally, at least one database operation identifier corresponding to the database operation task is determined, including: obtaining a preset mapping relationship between a database operation task and a database operation identifier; and performing matching on the mapping relationship based on the database operation task in the database operation association information to obtain at least one database operation identifier corresponding to the database operation task.
[0012] Optionally, the target database operation instruction template is determined based on the database operation identifier and namespace information in the target multi-level cache directory, including: performing query on the namespace information in the target multi-level cache directory based on the database operation identifier according to a preset priority query rule to obtain the target database operation instruction template, wherein the target multi-level cache directory includes a first-level cache, a second-level cache and a zero-level cache, and the preset priority query rule is that the priority of the second-level cache, the first-level cache and the zero-level cache decreases in turn.
[0013] Optionally, the method further includes: after the global multi-level cache directory is updated in real time by a preset hot loading method, updating the second-level cache in the target multi-level cache directory based on the updated global multi-level cache directory.
[0014] Optionally, the target database operation instruction is generated based on the business parameter and the target database operation instruction template, including: adding the business parameter to the target database operation instruction template according to a preset parameter transmission manner to generate the target database operation instruction, wherein the preset parameter transmission manner includes a position parameter transmission manner, a key-value pair transmission manner, an object transmission manner and a list transmission manner.
[0015] According to another aspect of the present application, a database operation instruction determination apparatus is provided, including:
[0016] The database operation association information determination module is configured to acquire a database operation request, and determine database operation association information based on the database operation request, wherein the database operation association information comprises database node information, a database operation task, and service parameters corresponding to the database operation task, and the database node information comprises a database node name, a database type, and a database schema;
[0017] The target multi-level cache directory determination module is configured to determine a target multi-level cache directory based on the database node information and a global multi-level cache directory, wherein the global multi-level cache directory comprises namespace information corresponding to a plurality of database types, a plurality of database versions, and / or at least one database node name, and the namespace information comprises a mapping relationship between a database operation identifier and a database operation instruction template;
[0018] The target database operation instruction template determination module is configured to determine at least one database operation identifier corresponding to the database operation task, and determine a target database operation instruction template based on the database operation identifier and the namespace information in the target multi-level cache directory;
[0019] The target database operation instruction determination module is configured to generate a target database operation instruction based on the service parameters and the target database operation instruction template.
[0020] According to another aspect of the present application, an electronic device is provided, and the electronic device comprises:
[0021] at least one processor; and
[0022] a memory connected to the at least one processor in communication; wherein
[0023] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the database operation instruction determination method of any one of the embodiments of the present application.
[0024] According to another aspect of the present application, a computer readable storage medium is provided, and the computer readable storage medium stores computer instructions for enabling a processor to implement the database operation instruction determination method of any one of the embodiments of the present application when executed by the processor.
[0025] The technical scheme of the embodiment of the application comprises the following steps: obtaining a database operation request, determining database operation association information based on the database operation request, wherein the database operation association information comprises database node information, a database operation task and service parameters corresponding to the database operation task, the database node information comprises a database node name, a database type and a database mode; the database operation request is analyzed to obtain accurate database operation association information, which provides data basis for subsequent determination of accurate target database operation instructions. The target multi-level cache directory is determined based on the database node information and a global multi-level cache directory, wherein the global multi-level cache directory comprises namespace information corresponding to a plurality of database types, a plurality of database versions and / or at least one database node name, the namespace information comprises a mapping relationship between a database operation identifier and a database operation instruction template, the target multi-level cache directory matched with the database node information can be obtained, accurate namespace information can be obtained therefrom, which is helpful for subsequent rapid determination of a target database operation instruction template matched with the database type, the plurality of database versions and / or the database node in the database node information. At least one database operation identifier corresponding to the database operation task is determined, a target database operation instruction template is determined based on the database operation identifier and the namespace information in the target multi-level cache directory, the target database operation instruction template matched with the database type and / or the database node in the database node information is rapidly determined, which is helpful for rapid generation of a database operation instruction. The target database operation instruction is generated based on the service parameters and the target database operation instruction template, the executability of the target database operation instruction is ensured, and the stability and adaptability of the database operation are improved. The present scheme realizes standardized generation of operation instructions through hierarchical analysis and cache matching, not only realizes accurate positioning and adaptation in a multi-database environment, but also improves the instruction generation efficiency by means of cache reuse; the operable database instruction corresponding to the database operation task is determined, in the actual application process, the database operation instruction format that can adapt to different database types, different database versions and database nodes can be determined without stopping the current business processing process, and the efficiency, accuracy and expansibility of the database operation are ensured.
[0026] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the application, nor is it used to limit the scope of the application. Other features of the application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed in the embodiment description. Obviously, the drawings in the following description only show some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor.
[0028] Figure 1 is a flow chart of a database operation instruction determination method provided by the first embodiment of the present application;
[0029] Figure 2 is a flow chart of a database operation instruction determination method provided by the second embodiment of the present application;
[0030] Figure 3 is a flow structure execution schematic diagram suitable for the embodiments of the present application;
[0031] Figure 4 is a command parameter key input mode schematic diagram suitable for the embodiments of the present application;
[0032] Figure 5 is a non-relational database instruction coding schematic diagram suitable for the embodiments of the present application;
[0033] Figure 6 is a structural schematic diagram of a database operation instruction determination device provided by the third embodiment of the present application;
[0034] Figure 7 is a structural schematic diagram of an electronic device for implementing the database operation instruction determination method of the embodiments of the present application. DETAILED DESCRIPTION
[0035] In order to make the personnel in the technical field better understand the present application scheme, the following will combine the drawings in the embodiments of the present application, and clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments only show some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should belong to the scope of protection of the present application.
[0036] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and in the above drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0037] Embodiment one
[0038] Figure 1 is a flowchart of a database operation instruction determination method provided by the first embodiment of the present application. The present embodiment can be applied to the case of determining a database operation instruction. The method can be executed by a database operation instruction determination device, which can be realized in the form of hardware and / or software, and can be configured in electronic devices such as computers and servers. As shown in the figure, the method comprises: Figure 1
[0039] S110, obtaining a database operation request, and determining database operation associated information based on the database operation request.
[0040] The database operation associated information comprises database node information, a database operation task and business parameters corresponding to the database operation task. The database node information comprises a database node name, a database type and a database mode.
[0041] The database operation request can be specifically understood as a request initiated by a user, an application program or other systems, which wants to perform a specific action on a database, such as a request to query data of a table, add a record, modify a field value or copy a data table. The database operation associated information can be understood as key supporting information determined from the request, including but not limited to database node information, a database operation task and business parameters corresponding to the database operation task. The database node information is used to specify the relevant information of the target database to which the operation is directed, including but not limited to the database node name, the database type and the database mode. The database operation task is used to specify the specific operation to be requested, for example, a database query instruction, a database copy instruction and a database addition instruction, which are not limited here. The business parameters corresponding to the database operation task are used to specify the business parameters of the multiple data required for the operation, for example, the copied database information, the user ID when querying and the new field value when modifying.
[0042] Specifically, the database operation request from the user or the application can be received through the interface preset by the system, then the database operation request is parsed to obtain a parsed result, and the key content is extracted from the parsed request to determine the database operation association information. The node information including the database node name, the database type (such as MySQL, Oracle) and the database mode (such as single machine, cluster) can be extracted first, and then the specific database operation task is determined. For example, taking the database replication request as an example: if the request is “from the MySQL database node ‘db-master-01’ in the master-slave mode, copy the records with the status of ‘completed’ in the order table (order_2025) to the ‘history order collection (order_history)’ of the MongoDB node ‘db-cluster-02’ in the cluster mode, and the replication frequency is every day at 2 a.m.”, the database operation association information determined after parsing is: the database node information includes: the source node name “db-master-01”, the type “MySQL”, and the mode “master-slave mode”; the target node name “db-cluster-02”, the type “MongoDB”, and the mode “cluster mode”, the database operation task “data replication”, and the business parameters “source table order_2025, target collection order_history, data filtering condition ‘status = completed’, and replication frequency ‘every day at 2 a.m.’”, wherein the data filtering condition and the replication frequency can be added or deleted according to the demand.
[0043] For example, in the task request of deleting the custom primary key column of the database table data issued by the upstream, the task mode type (table mapping, schema mapping or library mapping), the filtering object (some schemas or tables), the primary key column object name and other contents are determined according to the task demand and the parameter requirement, then the constraints and index information on the column are queried according to the different database characteristics, and after the relevant information is obtained, the constraints, indexes and columns related to the column are sequentially deleted by the downstream task.
[0044] Optionally, the database node information further includes basic connection information and authentication information, and a session factory is established to identify the basic connection information and the authentication information in the database node information, so as to correctly connect the relational database and the non-relational database.
[0045] In the embodiment, the operation object can be accurately positioned through explicit node information, the database node information, the database operation task and the business parameters corresponding to the database operation task are determined, the operation confusion in the multi-database environment is avoided, the split operation task and the business parameters can be verified for legality and integrity in advance, the database problems caused by illegal operation or missing parameters are reduced, and the system development and maintenance cost is reduced.
[0046] Optionally, the database operation association information is determined based on the database operation request, including: performing analysis and information extraction processing on the database operation request to obtain a key information extraction result; and performing verification on the key information extraction result through a parameter verification module to obtain the database operation association information satisfying a preset information verification condition, and determining the database operation association information satisfying the preset information verification condition as the database operation association information, wherein the preset information verification condition includes an information integrity verification condition and a legality verification condition.
[0047] The key information extraction result can be understood as information related to positioning the target operation database. The database operation request can be analyzed and processed to extract a core information set, and the core information set is determined as the key information extraction result. The key information extraction result mainly includes the basic content required for subsequent determination of the database operation association information, including but not limited to the name of the database node, the database type and the database mode, the specific database operation task, and the business parameters corresponding to the execution task (such as the ID for query and the value for update). These key information extraction results are the premise of generating valid operation association information. The preset information verification condition is a rule standard preset for judging whether the key information extraction result is available. The preset information verification condition includes but is not limited to the information integrity verification condition and the legality verification condition. The information integrity verification condition is a verification condition set for checking whether necessary information is missing in the extraction result. The necessary information includes but is not limited to the database node name and the key business parameters. The legality verification condition is a verification condition set for verifying whether the extracted information conforms to the specification, for example, whether the database type is within the support range and whether the operation task has execution authority. Optionally, only the extraction result satisfying the two types of conditions can be further converted into valid database operation association information.
[0048] Specifically, the received database operation request is analyzed and information is extracted to obtain the key information extraction result including the database node information, the operation task and the business parameters. Then, the parameter verification module verifies the extraction result according to the preset information integrity verification condition and the legality verification condition, and finally determines the result passing the verification as the valid database operation association information.
[0049] In the embodiment, the accurate acquisition of key information is ensured through the analysis and extraction link, and the double verification mechanism can effectively filter incomplete or illegal requests, avoiding subsequent operation failures due to missing information, and preventing unauthorized operations, incompatible operations and other risks through legality verification, while the standardized verification rules improve the standardization and security of database operations, providing reliable protection for subsequent stable database task execution.
[0050] S120, determining a target multi-level cache directory based on the database node information and the global multi-level cache directory, wherein the global multi-level cache directory includes namespace information corresponding to a plurality of database types, a plurality of database versions, and / or at least one database node name, and the namespace information includes a mapping relationship between a database operation identifier and a database operation instruction template.
[0051] The global multi-level cache directory can be understood as a unified cache structure total directory covering all database scenarios, which includes namespace information corresponding to a plurality of database types and / or namespace information corresponding to at least one database node name, for overall management of cache resources related to different database namespaces. The target multi-level cache directory can be understood as a part of the cache directory directly related to the current database operation request, which is filtered from the global multi-level cache directory according to the specific database node information, and is the specific pointing information for subsequent actual call of cache resources. The namespace information can be understood as the core component unit of the global multi-level cache directory, which stores the mapping relationship between the database operation identifier and the database operation instruction template, realizes the association between the operation identifier and the execution instruction, and divides independent and clear management units for cache resources of different database types or nodes.
[0052] In the embodiment, the configuration file corresponding to the namespace information can be obtained, the configuration file can be an XML format file, and then the configuration file is parsed, and the parsed namespace information corresponding to different database types, same database types but different database versions, and / or database nodes is stored in the first-level cache, the second-level cache and the zero-level cache according to a preset data format, so as to obtain the target multi-level cache directory. If the configuration file is updated, the second-level cache can be updated according to the updated information in the updated configuration file. It should be noted that if the force attribute in the attribute corresponding to the first-level cache is not set to the active state, i.e. the force attribute is not set to true, the first-level cache cannot be modified, otherwise, the first-level cache can be modified synchronously with the second-level cache, i.e. modified according to the updated information in the updated configuration file.
[0053] Specifically, a database or a session corresponding to the database node can be created according to the database node information, and then matching can be performed in a global multi-level cache directory containing multiple database types and / or namespace information corresponding to at least one database node name, a target namespace corresponding to the current node information is found, and then a target multi-level cache directory is determined, and the mapping relationship between the database operation identifier and the database operation instruction template is stored in each namespace information, the namespace information in the target multi-level cache directory can be stored in the constructed session, and the target database operation instruction can be determined through the session subsequently.
[0054] In the embodiment, the target cache directory is quickly located through accurate matching, the cache search time is reduced, the efficiency and consistency of the database operation instruction generation are improved with the aid of the standardized instruction template mapping, different types and different nodes of databases can be adapted, and the universality and expansibility of the cache system are enhanced.
[0055] Optionally, the mapping relationship between the plurality of database types and / or the at least one database node name and the corresponding namespace information is determined based on a preset dynamic mapping mode, wherein the preset dynamic mapping mode includes but is not limited to default namespace redirection, custom default space mapping, SqlId instruction override, and database node-specific single mapping. The default namespace redirection: if the internal cache of the same database type contains a plurality of namespace mapping modules, the system defaults to enable one mapping module; if it is needed to switch to other modules, only the target module needs to be specified in the secondary cache template through the default attribute, and the secondary cache will load the new configuration in real time without modifying the internal logic. When there is a difference between the internal and external default space domains, the force attribute can be used to force uniformity to ensure cache consistency. Custom default space mapping: if there is no required namespace module in the primary cache, a mapping module can be customized under the corresponding database type of the secondary cache, and the default attribute is set as the default. Since the primary cache does not have this module, the secondary cache will automatically search for the default area of the primary cache when it is not hit, which takes into account the custom requirements and the bottom-up role of the basic cache. SqlId instruction override: when a certain instruction (identified by SqlId) in the internal primary cache default space domain does not meet the requirements, the instruction corresponding to the SqlId can be individually rewritten and overlaid in the same namespace domain of the external secondary cache, which realizes local adjustment of the instruction without modifying the overall cache structure. Database node-specific single mapping: when different nodes (such as different versions of Kingbase) under the same database type have special mapping requirements, the namespace domain can be specified in the node mapping module of the external template, combined with custom modules or reuse of existing modules, to realize dynamic adjustment. This can avoid modifying the source code for special scenarios, reduce coupling, and new mappings can be used to benefit the internal template for subsequent reuse, improving maintenance efficiency. Through the flexible configuration of the hierarchical cache, the preset dynamic mapping mode realizes dynamic switching, customization and local adjustment of the namespace mapping, which not only meets the needs of diversified business scenarios (such as version differences and personalized instructions), but also reduces code changes and enhances the scalability and maintainability of the system.
[0056] In S130, at least one database operation identifier corresponding to the database operation task is determined, and a target database operation instruction template is determined based on the database operation identifier and the namespace information in the target multi-level cache directory.
[0057] The database operation identifier can be understood as a unique identifier assigned to each database operation task, which is used to accurately correspond and distinguish different database operation types. For example, the operation of "querying user information according to user ID" is identified by "USER_QUERY_001", which is the key connection information between the operation task and the specific execution instruction. The target database operation instruction template can be understood as a pre-defined standardized instruction framework corresponding to the database operation identifier. For example, the database operation instruction template corresponding to "USER_QUERY_001" is "SELECT * FROM user WHERE user_id = #{userId}", which contains a fixed syntax structure of the operation. Only the specific business parameters, such as the actual user ID, need to be filled in to generate a directly executable database instruction. It is the core carrier to realize the standardization and rapid execution of database operations.
[0058] Specifically, at least one database operation identifier corresponding to the specific database operation task can be determined. If the number of tasks in the identified database operation task is only one, then one database operation identifier will be matched. If the number of tasks in the identified database operation task is multiple, then multiple database operation identifiers will be matched. Then, according to these identifiers, the corresponding database operation instruction templates are matched in the matched namespace information in the determined target multi-level cache directory, so as to determine the target database operation instruction template.
[0059] In this embodiment, the corresponding relationship between the operation task and the identifier is used to realize accurate positioning, and the namespace information of the target cache directory is used to realize fast mapping relationship. The instruction template suitable for the current operation can be quickly obtained, which improves the search efficiency of the instruction template and ensures the matching accuracy of the template and the operation task. At the same time, the reuse of the cache reduces the cost of repeatedly generating instructions, enhances the efficiency and standardization of the database operation execution.
[0060] Optionally, determining at least one database operation identifier corresponding to the database operation task comprises: obtaining a preset mapping relationship between the database operation task and the database operation identifier; and matching the database operation task in the mapping relationship based on the database operation association information to obtain at least one database operation identifier corresponding to the database operation task.
[0061] The database operation task can be specifically understood as a specific action performed on the database, for example, a copy operation on the target database, or updating the inventory quantity of the product table. The database operation identifier can be specifically understood as a unique identifier assigned to the operation task, for example, USER_QUERY_ADULT or PRODUCT_UPDATE_STOCK can be set as the database operation identifier according to actual task requirements, for accurately indicating and distinguishing different tasks. The mapping relationship between the preset database operation task and the database operation identifier can be specifically understood as a predefined corresponding rule between the two, for example, the task of updating the inventory quantity of the product table is bound to the PRODUCT_UPDATE_STOCK identifier, which explicitly indicates the specific identifier corresponding to each task, forming a direct association from the operation task to the identifier, which is the basis for quickly finding the corresponding identifier through the task. In short: the database operation task is a specific action, the database operation identifier is a unique identifier of the database operation task, and the preset mapping relationship is a fixed corresponding rule connecting the database operation task and the database operation identifier. It should be noted that if the number of database operation tasks is one, then one database operation identifier can be matched, and if the number of database operation tasks is multiple, then the corresponding number of database operation identifiers can be matched.
[0062] Specifically, the mapping relationship between the preset database operation task and the database operation identifier can be established and obtained in advance, the current specific database operation task can be extracted from the database operation association information, and finally the database operation task can be matched and searched in the preset mapping relationship, so as to obtain at least one database operation identifier corresponding to the database operation task.
[0063] In the embodiment, the preset mapping relationship makes the correspondence between the database operation task and the database operation identifier more direct, without the need for temporarily generating an identifier, thereby improving the efficiency of identifier determination, and the standardized mapping rule can avoid confusion or errors when matching the task and the identifier, thereby ensuring the accuracy of the identifier.
[0064] Optionally, the target database operation instruction template is determined based on the database operation identifier and the namespace information in the target multi-level cache directory, including: querying the namespace information in the target multi-level cache directory based on the database operation identifier according to a preset priority query rule, to obtain the target database operation instruction template, wherein the target multi-level cache directory includes a first-level cache, a second-level cache and a zero-level cache, and the preset priority query rule is that the priority of the second-level cache, the first-level cache and the zero-level cache decreases in turn.
[0065] Among them, the first-level cache, the second-level cache and the zero-level cache are cache spaces of different levels in the target multi-level cache directory. The first-level cache is used as an internal cache, the second-level cache is used as an external cache, and the zero-level cache is used as a default cache, which together constitute a hierarchical cache system to adapt to the access requirements of different types and different versions of databases. The preset priority query rule is a query order standard set for the three levels of caches. Specifically, the second-level cache has the highest priority, the first-level cache has the second highest priority, and the zero-level cache has the lowest priority. That is, when querying, the target data will be first searched from the second-level cache, and if not found, the first-level cache and the zero-level cache will be searched in turn. Through the explicit priority order, the query efficiency and data coverage range are balanced.
[0066] Specifically, the database operation identifier corresponding to the current database operation is first determined, and then the database operation identifier is used as a query basis to search in the target multi-level cache directory including the first-level cache, the second-level cache and the zero-level cache according to the preset priority query rule that the second-level cache has the highest priority, the first-level cache has the second highest priority, and the zero-level cache has the lowest priority. The namespace information of each level of cache is matched and queried in turn, and finally the corresponding target database operation instruction template is found.
[0067] Optionally, if the target database operation instruction template is not found, the specified namespace is determined according to the default attribute, and then re-matching is performed in the specified namespace to obtain the target database operation instruction template. Further, if the target database operation instruction template is still not found, an exception prompt information is generated to remind the relevant personnel to modify the namespace information, so that the target database operation instruction template can be accurately and quickly determined in the future.
[0068] On the basis of the above embodiment, the method further comprises: after the global multi-level cache directory is updated in real time by the preset hot loading mode, updating the second-level cache in the target multi-level cache directory based on the updated global multi-level cache directory.
[0069] Among them, the preset hot loading mode can be understood as a dynamic updating mechanism that does not need to stop system service and does not interrupt the current business running, which is mainly used for real-time synchronization of data in the global multi-level cache directory. The latest cache data can be automatically loaded in the process of normal system running through the trigger conditions set in advance (such as timing trigger, configuration change trigger, business data update trigger) or listening mechanism, and the newly added, modified or deleted contents are synchronized to the global cache. Then, the updated data is obtained from the global cache, which is used to update the second-level cache in the target multi-level cache directory. The whole process does not need to restart the service, which can ensure the continuity of business while ensuring that the cache data is always consistent with the latest business requirements and configuration information.
[0070] Specifically, the namespace information corresponding to different database types, the same database type but different database versions and / or database nodes in the global multi-level cache directory is updated in real time through a preset hot loading manner, so as to ensure that the global cache data is synchronized with the latest business requirements or configuration files; after the global cache is updated, the updated global multi-level cache directory is taken as a data source, and the data synchronization update is performed on the second-level cache with the highest priority in the target multi-level cache directory, so that the latest cache content related to the current target directory in the global cache is synchronized to the second-level cache, and the update processing of the second-level cache is completed.
[0071] In the embodiment, the hot loading update of the global cache can avoid system downtime and ensure business continuity; meanwhile, the second-level cache is updated preferentially, so that the cache data with high frequency access is always the latest, the high-efficiency query advantage of the second-level cache is maintained, the consistency of the cache data is ensured through the synchronization mechanism from the global cache to the target cache, and the operation error caused by the expiration of the cache is reduced.
[0072] In S140, a target database operation instruction is generated based on the business parameter and the target database operation instruction template.
[0073] The target database operation instruction can be understood as a specific instruction generated based on the business parameter and the target database operation instruction template, which can be directly executed in the database, such as a database operation statement filled with a user ID parameter, for example, “SELECT * FROM user WHERE user_id = 123”. The target database operation instruction is the final execution carrier of the database operation, which not only inherits the standardized format of the instruction template, but also incorporates the specific business parameter required for the current operation, can be directly recognized and executed by the database, and can realize specific database operations such as query, addition, update and deletion, and is a key bridge connecting the database operation requirement and the actual data processing action.
[0074] Specifically, the business parameter can be obtained from the recognized database operation association information, and the target database operation instruction template is called to fill the business parameter into the parameter placeholder of the target database operation instruction template according to the corresponding rule, so as to complete the fusion of the parameter and the template, and finally generate the target database operation instruction which can be directly executed.
[0075] In the embodiment, through the separation design of the target database operation instruction template and the business parameter, the standardized template is used to ensure the standardization of the instruction format and avoid syntax errors, the dynamic filling of the business parameter is used to realize the flexible adaptation of the instruction, the same type of instruction does not need to be repeatedly written, the generation efficiency of the database operation instruction is greatly improved, the error probability of manually writing the instruction is reduced, and the stability of the operation execution is enhanced.
[0076] Optionally, the target database operation instruction is generated based on the business parameter and the target database operation instruction template, including: adding the business parameter to the target database operation instruction template according to a preset parameter passing mode to generate the target database operation instruction, wherein the preset parameter passing mode includes a position parameter passing mode, a key-value pair passing mode, an object passing mode and a list passing mode.
[0077] The preset parameter passing mode can be specifically understood as a standardized rule set followed when the business parameter is added to the target database operation instruction template, and the preset parameter passing mode includes but is not limited to position parameter passing, key-value pair passing, object passing and list passing, and is used to adapt to the matching needs of different parameter formats and template placeholders. The position parameter passing mode is to fill the positions of the placeholders in the template in sequence according to the order of the business parameters, for example, the parameter [100, "Zhang San"] corresponds to the template "WHERE id=#{agr0} AND name=#{agr1}"; the key-value pair passing mode is to fill by the corresponding relationship between the parameter name and the named placeholder in the template, for example, the parameter {id: 100, name: "Zhang San"} corresponds to the template "WHERE id=#{id} AND name=#{name}"; the object passing mode is to map the attribute values of the object to the placeholders matched with the attribute names in the template, for example, the id and name attributes of the user object user correspond to #{user.id} and #{user.name} in the template; and the list passing mode is to fill the elements in the list to the array type placeholder of the template in sequence, for example, the list [100, 200, 300] corresponds to the template "WHERE id IN (#{:list})", and the form of the <for separate="," collection1=":list1" item1="l1"> *** #{l1} ***< / for> tag can also be used. The four modes together constitute a flexible parameter passing system to meet the parameter filling needs in different business scenarios.
[0078] Specifically, the business parameter can be obtained from the recognized database operation association information, and the corresponding parameter passing mode is determined according to the parameter state corresponding to the business parameter, and the business parameter is added to the parameter placeholder of the target database operation instruction template, the fusion of the parameter and the template is completed, and finally the target database operation instruction directly executable is generated. In this embodiment, the simple parameters can be passed by position, and the complex structure parameters can be passed by object, and the actual parameter state is set according to the actual parameter state, which is not limited here.
[0079] In the embodiment, the diversified preset parameter delivery mode can adapt to the parameter format requirements in different scenarios, improving the flexibility and compatibility of parameter filling; meanwhile, through the standardized delivery rule, the accurate matching of parameters and template placeholders is ensured, the instruction error caused by parameter misplacement is avoided, the accuracy of instruction generation is ensured, and the efficiency of instruction generation in different business scenarios is improved.
[0080] The technical scheme of the embodiment determines the database operation associated information including the database node information, the operation task and the corresponding business parameters by analyzing the received database operation request; then, the target multi-level cache directory is located in combination with the node information and the global multi-level cache directory including the namespace information corresponding to the multiple database types or node names; then, at least one database operation identifier corresponding to the current task is found according to the preset operation task and identifier mapping relationship, and then the target database operation instruction template is matched in the namespace of the target cache directory; finally, the business parameters are filled into the template according to the preset parameter delivery mode to generate an executable target database operation instruction. Through hierarchical analysis and cache matching, the standardized generation of operation instructions is realized, which not only realizes accurate positioning and adaptation in the multi-database environment, but also improves the instruction generation efficiency by cache reuse; the operable database instruction corresponding to the determined database operation task is improved, and in the actual application process, the database operation instruction format that can adapt to different database types, different database versions and database nodes can be determined without stopping the current business processing process, thereby ensuring the efficiency, accuracy and expansibility of the database operation.
[0081] Embodiment two
[0082] Figure 2 is a flowchart of a database operation instruction determination method provided by the second embodiment of the application. The method of the embodiment is a further optimization of the method of the above-mentioned embodiment. Optionally, a global multi-level cache directory is obtained from a preset storage space; the database node name, the database type and the database mode in the database node information are searched and positioned in the global multi-level cache directory to obtain a target multi-level cache directory. As shown in Figure 2 , the method comprises the following steps.
[0083] S210, obtaining a database operation request, and determining database operation associated information based on the database operation request, wherein the database operation associated information includes database node information, a database operation task and business parameters corresponding to the database operation task, and the database node information includes a database node name, a database type and a database mode.
[0084] S220, obtaining a global multi-level cache directory from a preset storage space.
[0085] The preset storage space can be specifically understood as a physical or logical storage carrier planned and fixed in advance for storing the global multi-level cache directory, which provides a stable storage location for the global multi-level cache directory, supports reading and updating of directory data through a standardized interface, and is the basis for ensuring safe storage and efficient access of directory data. The global multi-level cache directory can be specifically understood as a total directory stored in the preset storage space, which comprehensively manages all database-related cache resources, contains namespace information corresponding to multiple database types and / or at least one database node name, and stores a mapping relationship between a database operation identifier and an operation instruction template in each namespace. The global multi-level cache directory is equivalent to a total index of the cache system, and provides core data support for subsequent positioning of a target cache directory and matching of an instruction template.
[0086] Specifically, the global multi-level cache directory can be obtained by connecting the preset storage space through a system-preset access interface or a calling protocol (such as a file reading protocol or an API interface), reading complete data of the global multi-level cache directory stored in the preset storage space after verifying access rights.
[0087] S230, based on the database node name, the database type and the database schema in the database node information, searching and positioning processing is performed in the global multi-level cache directory to obtain a target multi-level cache directory.
[0088] Specifically, the database node name, the database type and the database schema can be extracted from the database node information as three key dimension information, and then the three key dimension information is used as a search condition to match the global multi-level cache directory containing namespace information corresponding to multiple database types and / or node names, so as to accurately position the cache unit completely matched with the current operation, and finally obtain the target multi-level cache directory.
[0089] In this embodiment, multi-dimensional combined search can avoid positioning deviation caused by single condition matching, ensure the adaptability of the target cache directory to the current database node, improve the directory search efficiency, lay a foundation for subsequent rapid matching of database operation instruction templates, and make the management of the cache directory more targeted.
[0090] S240, determining at least one database operation identifier corresponding to the database operation task, and determining a target database operation instruction template based on the database operation identifier and the namespace information in the target multi-level cache directory.
[0091] S250, generating a target database operation instruction based on the business parameter and the target database operation instruction template.
[0092] In one specific embodiment, the XML format configuration file corresponding to the namespace information is acquired, and the MappersRecord structure is designed to record the configuration properties and multiple mapping spaces MapperSpace under a database. Each MapperSpace records all the required CommandModel instructions and the name of the current mapping space. The MappersRecord structure also records the default mapping space used, and records whether the internal and external mapping spaces are unified. Finally, the key is recorded into the first-level cache according to the database type of MappersRecord. If the secondary cache of the Mapper mapping template is defined outside the program at the specified location, the program will automatically load the file, and record it into the secondary cache as the same as the first-level cache. The required information can be obtained during subsequent loading, and when the template file is modified, the program monitor will reload the file to the internal cache. In the process of determining the target database operation instruction template, the session factory builder SessionFactoryBuilder needs to be defined, the connection information of the database is passed through the build method to build the session factory class SessionFactory, and the construction details of the session factory class are transparent to the user. Then the session information under a certain database type is initialized through the session factory class, which includes:
[0093] (1) Establishing a database connection
[0094] The database connection is established by acquiring the database node parameter information issued, which includes basic user information, database information, database mode, authentication method and other information. The session factory identifies the database type and the required connection authentication method, and establishes the correct connection for the relational database and the non-relational database.
[0095] (2) Loading the multi-level cache corresponding to the database
[0096] The session factory needs to initialize all the information required for the database node and then build the sessioner to return. Under the demand of various dynamic mapping methods, the loading of the two-level main cache needs multiple case judgments: when the two-level cache is empty, the default space domain of the type under the first-level cache will be loaded into the two-level cache of the sessioner; when the first-level cache is empty, if the two-level cache exists and is loaded into the memory, the first-level cache of the sessioner is still empty, and the two-level cache saves the cache information; if the external two-level template file defines the database node mapping module, the one- and two-level caches will load the space domain under the database type into the sessioner of this node according to the configuration; if the two-level cache template switches the default space domain for the current type, but the underlying first-level cache uses the original space domain, at this time, if the first-level cache exists for the space domain and needs to ensure that the default space domains of the internal and external caches are consistent, the judgment of the forced uniformity attribute configured can be used to modify the cache loaded in the sessioner.
[0097] Finally, the common instruction area defined by the internal common module is loaded in the zero-level cache of the sessioner, which exists as the most bottom layer of the common instruction module that can be used publicly. In the case that the instructions cannot be found in the one- and two-level caches, the zero-level cache will be searched and returned.
[0098] The sessioner object is created for each database node, and the relevant database operations are performed for the current database node. The sessioner object saves the connection, zero- and two-level caches, instruction mapping cache, drive management object, parameter configuration object and type adapter of the current database node (as shown in a flow structure execution schematic diagram in FIG. 1). Figure 3 The operation management of the relational database and the non-relational database has different ways.
[0099] i. For the relational database, the database operation instruction template, i.e., the sql template, can be obtained through the instruction id, and the required parameters are transmitted to the database operation instruction template through different execution methods with specific placeholders (as shown in a command parameter input method schematic diagram in FIG. 2). Figure 4 There are multiple ways to transmit parameters: one is to transmit the positions of multiple parameters, and specify which position of the parameters is used in the template; two is to transmit the map, and use the key in the map to specify the parameter in the template file; three is to directly transmit an object, and specify the attribute name of the object through the template, but the premise is that there must be a get method for the attribute; four is to input the list to input the parameters. The execution method call of the sessioner can be selected according to the above parameter loading requirements, but the calling logic is consistent and divided into: instruction query, instruction recompilation and execution return.
[0100] ii. In the non-relational database aspect, no executable instructions are available, and the instruction design code is calculated. For the instruction design scheme of the non-relational database, the total instruction code length uses a 16-bit length number (such as a non-relational database instruction code diagram shown in the accompanying drawings). Figure 5 The instruction structure of different non-relational databases can be different. When the instruction is executed through the unique method specified by the sessioner, on the one hand, it can be the instruction id in the template, and on the other hand, it can be a direct instruction. The final instruction code is obtained by accumulating the code values of the keywords through instruction analysis. The instruction and the instruction keyword are defined in the enumeration class for easy definition and acquisition. At the same time, the @CommandMapping annotation is marked in the specific execution method, and the value in the annotation is the specific instruction. The sessioner can call the corresponding method through the mapping relationship between the instruction and the method. The mapping relationship between the instruction and the method can be a many-to-one relationship.
[0101] The technical scheme of the embodiment comprises the following steps: receiving a database operation request; parsing the database operation request to determine database operation association information comprising database node information, operation tasks and corresponding business parameters; then obtaining a global multi-level cache directory from a preset storage space; then searching and positioning a target multi-level cache directory in the global cache directory in multiple dimensions according to the name, type and mode of the database node information; then finding at least one database operation identifier corresponding to the current task through a preset operation task and identifier mapping relationship, and then matching a target database operation instruction template in the namespace of the target cache directory; and finally filling the business parameters into the template in a preset manner to generate an executable target database operation instruction. Through hierarchical analysis and cache matching, the standardized generation of the operation instruction is realized, which not only helps the accurate positioning and adaptation in the multi-database environment, but also helps the cache reuse to improve the instruction generation efficiency. The determination of the operable database instruction corresponding to the database operation task is improved. In the actual application process, the database operation instruction format that can adapt to different database types, different database versions and database nodes can be determined without stopping the current business processing process, thereby guaranteeing the efficiency, accuracy and expansibility of the database operation.
[0102] Embodiment Three
[0103] Figure 6 is a structural schematic diagram of a database operation instruction determination device provided by Embodiment Three of the present application. As shown in the figure, the device comprises: Figure 6
[0104] The database operation association information determination module 610 is configured to obtain a database operation request, and determine database operation association information based on the database operation request, wherein the database operation association information comprises database node information, a database operation task, and service parameters corresponding to the database operation task, the database node information comprises a database node name, a database type, and a database schema;
[0105] The target multi-level cache directory determination module 620 is configured to determine a target multi-level cache directory based on the database node information and a global multi-level cache directory, wherein the global multi-level cache directory comprises namespace information corresponding to a plurality of database types, a plurality of database versions, and / or at least one database node name, and the namespace information comprises a mapping relationship between a database operation identifier and a database operation instruction template;
[0106] The target database operation instruction template determination module 630 is configured to determine at least one database operation identifier corresponding to the database operation task, and determine a target database operation instruction template based on the database operation identifier and the namespace information in the target multi-level cache directory;
[0107] The target database operation instruction determination module 640 is configured to generate a target database operation instruction based on the service parameters and the target database operation instruction template.
[0108] The technical scheme of the embodiment determines database operation associated information based on the database operation request, wherein the database operation associated information comprises database node information, a database operation task, and business parameters corresponding to the database operation task, the database node information comprises a database node name, a database type, and a database schema; a target multi-level cache directory determination module determines a target multi-level cache directory based on the database node information and a global multi-level cache directory, wherein the global multi-level cache directory comprises namespace information corresponding to a plurality of database types, a plurality of database versions, and / or at least one database node name, and the namespace information comprises a mapping relationship between a database operation identifier and a database operation instruction template; a target database operation instruction template determination module determines at least one database operation identifier corresponding to the database operation task, and determines a target database operation instruction template based on the database operation identifier and the namespace information in the target multi-level cache directory; and a target database operation instruction determination module generates a target database operation instruction based on the business parameters and the target database operation instruction template. Through hierarchical analysis and cache matching, the standardized generation of operation instructions is realized, the precise positioning and adaptation in the multi-database environment are assisted, the instruction generation efficiency is improved by means of cache reuse, the operable database instruction corresponding to the database operation task is determined, the database operation instruction format of different database types, different database versions, and database nodes is adapted, and the efficiency, accuracy, and expansibility of the database operation are ensured.
[0109] On the basis of the above-mentioned embodiments, the database operation associated information determination module 610 is specifically configured to analyze and extract information of the database operation request to obtain a key information extraction result, and to verify the key information extraction result by the parameter verification module to obtain database operation associated information satisfying a preset information verification condition, and to determine the database operation associated information satisfying the preset information verification condition as the database operation associated information, wherein the preset information verification condition comprises an information integrity verification condition and a legality verification condition.
[0110] Optionally, the target multi-level cache directory determination module 620 is specifically configured to obtain the global multi-level cache directory from a preset storage space, and to search and locate the global multi-level cache directory based on the database node name, the database type, and the database schema in the database node information to obtain the target multi-level cache directory.
[0111] Optionally, the target database operation instruction template determination module 630 is specifically configured to obtain a preset mapping relationship between a database operation task and a database operation identifier, and to match the database operation task in the mapping relationship based on the database operation associated information to obtain at least one database operation identifier corresponding to the database operation task.
[0112] Optionally, the target database operation instruction template determination module 630 is specifically configured to query the namespace information in the target multi-level cache directory based on the database operation identifier according to a preset priority query rule, to obtain a target database operation instruction template, wherein the target multi-level cache directory includes a first-level cache, a second-level cache and a zero-level cache, and the preset priority query rule is that the priority of the second-level cache, the first-level cache and the zero-level cache is sequentially reduced.
[0113] Optionally, the device is further configured to update the second-level cache in the target multi-level cache directory based on the updated global multi-level cache directory after the global multi-level cache directory is updated in real time by the preset hot loading manner.
[0114] Optionally, the target database operation instruction determination module 640 is specifically configured to add the business parameter to the target database operation instruction template according to a preset parameter passing manner, to generate a target database operation instruction, wherein the preset parameter passing manner includes a position parameter passing manner, a key-value pair passing manner, an object passing manner and a list passing manner.
[0115] The database operation instruction determination device provided by the embodiment of the application can execute the database operation instruction determination method provided by any embodiment of the application, and has the corresponding function modules and beneficial effects of the execution method.
[0116] Embodiment Four
[0117] Figure 7 is a structural schematic diagram of an electronic device provided by Embodiment Four of the application. The electronic device 10 is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the application described and / or claimed in this document.
[0118] As Figure 7As shown, the electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., connected to the at least one processor 11 in communication. The memory stores computer programs executable by the at least one processor 11, and the processor 11 can perform various appropriate actions and processes according to the computer programs stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0119] Various components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, a speaker, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0120] The processor 11 can be various general and / or special-purpose processing components having processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the database operation instruction determination method.
[0121] In some embodiments, the database operation instruction determination method can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the database operation instruction determination method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the database operation instruction determination method by any other appropriate means, such as by means of firmware.
[0122] The various embodiments of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system on a chip systems (SOCs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0123] Computer programs implementing the database operation instruction determination method of the present application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the computer program, when executed by the processor, implements the functions / operations specified in the flow charts and / or block diagrams. The computer program can execute entirely on a machine, partly on a machine, partly on a machine as a stand-alone software package, partly on a machine and partly on a remote machine or entirely on a remote machine or server.
[0124] Embodiment five
[0125] Embodiment five of the present application also provides a computer readable storage medium, which stores computer instructions for causing a processor to execute a database operation instruction determination method, the method comprising:
[0126] Obtaining a database operation request, and determining database operation association information based on the database operation request, wherein the database operation association information comprises database node information, a database operation task, and service parameters corresponding to the database operation task, the database node information comprises a database node name, a database type, and a database schema;
[0127] Determining a target multi-level cache directory based on the database node information and a global multi-level cache directory, wherein the global multi-level cache directory comprises namespace information corresponding to a plurality of database types, a plurality of database versions, and / or at least one database node name, and the namespace information comprises a mapping relationship between a database operation identifier and a database operation instruction template;
[0128] determine at least one database operation identifier corresponding to the database operation task, and determine a target database operation instruction template based on the database operation identifier and namespace information in the target multi-level cache directory;
[0129] generate the target database operation instruction based on the business parameter and the target database operation instruction template.
[0130] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store the program for use by or in connection with the instruction execution system, apparatus, or device. The computer-readable storage medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0131] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0132] The systems and techniques described herein can be implemented in a computing system that includes a back end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front end component, e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described herein, or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0133] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.
[0134] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be performed in parallel, in series, or in a different order, and the present disclosure is not limited in this regard.
[0135] The specific embodiments described above are not intended to limit the scope of the present disclosure. Those skilled in the art will understand that various modifications, combinations, sub-combinations, and alternatives can be made to the specific embodiments without departing from the spirit and principles of the present disclosure. Any further modifications, equivalents, and / or alternatives come within the scope of the present disclosure as recited by the claims.
Claims
1. A method for determining database operation instructions, characterized in that, include: Obtain a database operation request, and determine database operation association information based on the database operation request. The database operation association information includes database node information, database operation task, and business parameters corresponding to the database operation task. The database node information includes database node name, database type, and database mode. The target multi-level cache directory is determined based on the database node information and the global multi-level cache directory. The global multi-level cache directory includes namespace information corresponding to multiple database types, multiple database versions, and / or at least one database node name. The namespace information includes the mapping relationship between database operation identifiers and database operation instruction templates. Determine at least one database operation identifier corresponding to the database operation task, and determine a target database operation instruction template based on the database operation identifier and the namespace information in the target multi-level cache directory; Generate target database operation instructions based on the business parameters and the target database operation instruction template.
2. The method according to claim 1, characterized in that, The step of determining the database operation association information based on the database operation request includes: The database operation request is parsed and information extraction is performed to obtain the key information extraction results; The key information extraction results are verified by the parameter verification module to obtain database operation association information that meets the preset information verification conditions. The database operation association information that meets the preset information verification conditions is determined as the database operation association information. The preset information verification conditions include information integrity verification conditions and legality verification conditions.
3. The method according to claim 1, characterized in that, The step of determining the target multi-level cache directory based on the database node information and the global multi-level cache directory includes: Obtain the global multi-level cache directory from the preset storage space; Based on the database node name, database type, and database mode in the database node information, the target multi-level cache directory is obtained by searching and locating the target multi-level cache directory in the global multi-level cache directory.
4. The method according to claim 1, characterized in that, The step of determining at least one database operation identifier corresponding to the database operation task includes: Obtain the preset mapping relationship between database operation tasks and database operation identifiers; Based on the database operation tasks in the database operation association information, the database operation tasks are matched in the mapping relationship to obtain at least one database operation identifier corresponding to the database operation task.
5. The method according to claim 1, characterized in that, The step of determining the target database operation instruction template based on the database operation identifier and the namespace information in the target multi-level cache directory includes: Based on the database operation identifier, the namespace information in the target multi-level cache directory is queried according to the preset priority query rule to obtain the target database operation instruction template. The target multi-level cache directory includes a first-level cache, a second-level cache, and a zero-level cache. The preset priority query rule is that the priorities of the second-level cache, the first-level cache, and the zero-level cache decrease sequentially.
6. The method according to claim 5, characterized in that, The method also includes: After the global multi-level cache directory is updated in real time using a preset hot-loading method, the second-level cache in the target multi-level cache directory is updated based on the updated global multi-level cache directory.
7. The method according to claim 1, characterized in that, The process of generating target database operation instructions based on the business parameters and the target database operation instruction template includes: The business parameters are added to the target database operation instruction template according to the preset parameter transmission method to generate the target database operation instruction. The preset parameter transmission method includes position parameter transmission method, key-value pair transmission method, object transmission method and list transmission method.
8. A database operation instruction determining device, characterized in that, include: A database operation association information determination module is used to obtain a database operation request and determine database operation association information based on the database operation request. The database operation association information includes database node information, database operation task, and business parameters corresponding to the database operation task. The database node information includes database node name, database type, and database mode. The target multi-level cache directory determination module is used to determine the target multi-level cache directory based on the database node information and the global multi-level cache directory. The global multi-level cache directory includes namespace information corresponding to multiple database types, multiple database versions, and / or at least one database node name. The namespace information includes a mapping relationship between database operation identifiers and database operation instruction templates. The target database operation instruction template determination module is used to determine at least one database operation identifier corresponding to the database operation task, and determine the target database operation instruction template based on the database operation identifier and the namespace information in the target multi-level cache directory. The target database operation instruction determination module is used to generate target database operation instructions based on the business parameters and the target database operation instruction template.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, which is executed by the at least one processor to enable the at least one processor to perform the database operation instruction determination method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the database operation instruction determination method according to any one of claims 1-7.