CN110286883B - Intelligent database coding monitoring method and device and electronic equipment - Google Patents

Intelligent database coding monitoring method and device and electronic equipment Download PDF

Info

Publication number
CN110286883B
CN110286883B CN201910476075.XA CN201910476075A CN110286883B CN 110286883 B CN110286883 B CN 110286883B CN 201910476075 A CN201910476075 A CN 201910476075A CN 110286883 B CN110286883 B CN 110286883B
Authority
CN
China
Prior art keywords
code
database
orm
module
table structure
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910476075.XA
Other languages
Chinese (zh)
Other versions
CN110286883A (en
Inventor
唐啸
黄坤
程力
胡畔
唐翔
郑峥
林明
张艺榕
卞成志
王栈
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN201910476075.XA priority Critical patent/CN110286883B/en
Publication of CN110286883A publication Critical patent/CN110286883A/en
Application granted granted Critical
Publication of CN110286883B publication Critical patent/CN110286883B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation

Abstract

The application discloses an intelligent database coding monitoring method, an intelligent database coding monitoring device and electronic equipment, wherein the intelligent database coding monitoring method comprises the steps of monitoring a database table structure corresponding to a target database in real time; if the change of the database table structure is monitored, automatically generating an ORM automatic generation code corresponding to the data influenced by the current change of the database table structure; and acquiring and outputting pre-stored difference data between the current ORM storage codes corresponding to the target database and the ORM automatic generation codes so as to perform code error correction on the target database. According to the method and the device, when the database table structure of the database is changed, the full-automatic monitoring and error correction process aiming at the change content can be realized, the monitoring reliability is high, the error correction accuracy is high, and the error correction efficiency of the database table structure change can be effectively improved.

Description

Intelligent database coding monitoring method and device and electronic equipment
Technical Field
The application relates to the technical field of software development, in particular to an intelligent database coding monitoring method and device and electronic equipment.
Background
In the research and development process of the existing enterprise-level web background software, the programming of ORM mapping related codes related to a database is an important and indispensable component; there are many semi-automatic ORM frameworks (such as myBatis and Green Dao) to solve the cost problem of manual programming by manpower in the software programming involved in ORM mapping, specifically, the object-type data at the back end of the software and the relational data in the database are mapped by an automatic module, and the code is automatically generated by applying a tool, so as to solve the problems of low efficiency and easy error caused by the large code amount related to ORM mapping and the need of manual coding.
However, due to frequent changes of the requirements in the early and mid stages of the large-scale enterprise-level web background software development process, there are often situations where there is a change in the data tables in the database, especially in the database table structure; the change can cause omission, deletion and error of code mapping relation related to ORM generated by a tool in early stage, so that the ORM related codes are inconsistent and lagged with data tables in a database system, thus a researcher has to manually check whether a table structure is changed or not, and further needs to manually generate new ORM mapping related codes by using the tool again frequently and irregularly, so as to cover the corresponding related codes before in a software warehouse.
Disclosure of Invention
Aiming at the problems in the prior art, the application provides an intelligent database coding monitoring method, an intelligent database coding monitoring device and electronic equipment, which can realize the full-automatic monitoring and error correction process aiming at the changing content when the database table structure of a database is changed, and has high monitoring reliability and high error correction accuracy, and can effectively improve the error correction efficiency of the change of the database table structure.
In order to solve the technical problems, the application provides the following technical scheme:
In a first aspect, the present application provides an intelligent database code monitoring method, including:
monitoring a database table structure corresponding to the target database in real time;
if the change of the database table structure is monitored, automatically generating an ORM automatic generation code corresponding to the data influenced by the current change of the database table structure;
and acquiring and outputting pre-stored difference data between the current ORM storage codes corresponding to the target database and the ORM automatic generation codes so as to perform code error correction on the target database.
Further, if the database table structure is monitored to change, automatically generating an ORM automatic generation code corresponding to data affected by the current change of the database table structure, including:
if the database table structure is monitored to change, controlling a preset trigger to store trigger information corresponding to the current change of the database table structure into a trigger information table;
and judging whether the current change of the database table structure meets a preset trigger accumulation condition or not based on the trigger information, if so, automatically generating an ORM automatic generation code corresponding to the data influenced by the current change of the database table structure.
Further, after the automatically generating the ORM automatic generation code corresponding to the data affected by the current change of the database table structure, the method further comprises:
and storing the ORM automatic generation code into an ORM database.
Further, the method further comprises the following steps:
generating corresponding database triggering statistical summary information for auxiliary coding based on the triggering information;
and sending the database triggering statistical summary information to a corresponding client to assist a user in encoding the target database.
Further, before the obtaining and outputting the difference data between the pre-stored ORM current stored code corresponding to the target database and the ORM automatic generation code to perform code error correction on the target database, the method further includes:
updating data related to the ORM in the code corresponding to the target database in the code warehouse corresponding to the target database, and confirming the data related to the ORM as the current code stored by the ORM.
Further, the obtaining and outputting the difference data between the current storage code of the ORM and the automatic generation code of the ORM to perform code error correction on the target database includes:
Respectively acquiring corresponding ORM automatic generation codes and ORM current storage codes from the trigger information table and the code warehouse;
performing difference comparison between the current ORM storage code and the ORM automatic generation code to obtain corresponding difference data;
and sending the difference data to a corresponding client so that a user can correct the code of the current change of the target database according to the difference data from the client.
Further, before the sending the difference data to the corresponding client to enable the user to perform code error correction for the current change of the target database according to the difference data, the method further includes:
and filtering the difference data according to the time stamp of the automatically generated code.
In a second aspect, the present application provides an intelligent database code monitoring apparatus, comprising:
the database monitoring module is used for monitoring the database table structure corresponding to the target database in real time;
the code storage module is used for automatically generating an ORM automatic generation code corresponding to the data influenced by the current change of the database table structure if the change of the database table structure is monitored;
The code difference analysis module is used for acquiring and outputting difference data between the pre-stored ORM current storage code corresponding to the target database and the ORM automatic generation code so as to perform code error correction on the target database.
In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the steps of the intelligent database code monitoring method when the program is executed.
In a fourth aspect, the present application provides a computer readable storage medium having stored thereon computer instructions that when executed implement the steps of the intelligent database code monitoring method.
The intelligent database coding monitoring method comprises the steps of monitoring a database table structure corresponding to a target database in real time; if the change of the database table structure is monitored, automatically generating an ORM automatic generation code corresponding to the data influenced by the current change of the database table structure; the method comprises the steps of acquiring and outputting prestored ORM current storage codes corresponding to a target database and difference data between the ORM automatic generation codes so as to correct the codes of the target database, realizing full-automatic monitoring and correction processes aiming at changing contents when the database table structure of the database is changed, having high monitoring reliability and high correction accuracy, effectively improving the correction efficiency of the database table structure change, avoiding frequent and active manual execution scripts, avoiding complicated processes caused by repeated generation and coverage of the corresponding codes, effectively saving labor cost and time cost, and further effectively improving the accuracy, reliability and development efficiency of enterprise-level web background software development.
Drawings
In order to more clearly illustrate the embodiments of the present description or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, and it is obvious that the drawings in the following description are some embodiments of the present description, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic architecture diagram of an intelligent database code monitoring system according to an embodiment of the present application;
FIG. 2 is a flow chart of an intelligent database code monitoring method in an embodiment of the present application;
FIG. 3 is a first flowchart of step 200 in the intelligent database code monitoring method according to the embodiment of the present application;
FIG. 4 is a second flowchart of step 200 in the intelligent database code monitoring method according to the embodiment of the present application;
FIG. 5 is a flow chart of an intelligent database code monitoring method including steps 400 and 500 according to an embodiment of the present application;
FIG. 6 is a flow chart of a method for intelligent database code monitoring including step 204 in an embodiment of the present application;
FIG. 7 is a flowchart of step 300 in the intelligent database code monitoring method according to the embodiment of the present application;
FIG. 8 is a flow chart of an intelligent database code monitoring method including step 3021 in an embodiment of the present application;
FIG. 9 is a schematic structural diagram of an intelligent database code monitoring device in an embodiment of the present application;
FIG. 10 is a schematic diagram of a specific structure of an intelligent database code monitoring device according to an embodiment of the present application;
FIG. 11 is a flowchart illustrating a method for monitoring the encoding of an intelligent database according to an embodiment of the present application;
fig. 12 is a hardware configuration block diagram of a server of the intelligent database code monitoring method according to the embodiment of the present application.
Detailed Description
In order to make the technical solutions in the present specification better understood by those skilled in the art, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only some embodiments of the present specification, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are intended to be within the scope of the present disclosure.
Many semi-automated ORM frameworks (e.g., myBatis, greenDao) address the cost of manually programming by human labor involved in ORM mapping; such as: the code related to the database can be triggered and generated by manually executing the script, and for the scene with frequent change of the database table structure, the change causes the conditions of omission, deletion, error and inconsistency and hysteresis with the database table in the database system of the code mapping relation related to the ORM generated by the tool in early stage; the research personnel have to manually check whether the table structure is changed or not, and then frequently and irregularly manually generate a new code related to ORM mapping by using a tool again, which is complex and still has the problems of manpower and time investment and consumption.
In summary, the problem that the conventional semi-automatic ORM framework used at the server side or the mobile phone terminal cannot solve the problem of repeated encoding and inefficiency of the ORM mapping code caused by the change of the database table structure still exists, and when the database table structure is changed, the user needs to frequently and actively manually execute the script by manpower to repeatedly generate and cover the corresponding code, so that the flow is very complicated; tools for mining and utilizing related information of database table structure change, without manual labor and manual intervention, and performing full-automatic error correction and efficient auxiliary coding on codes related to ORM mapping are still studied.
In view of the foregoing problems with the prior art, the present application provides an intelligent database code monitoring method, an intelligent database code monitoring apparatus, an electronic device, and a computer-readable storage medium, which perform real-time monitoring by performing real-time monitoring on a database table structure corresponding to a target database; if the change of the database table structure is monitored, automatically generating an ORM automatic generation code corresponding to the data influenced by the current change of the database table structure; the method comprises the steps of acquiring and outputting prestored ORM current storage codes corresponding to a target database and difference data between the ORM automatic generation codes so as to correct the codes of the target database, realizing full-automatic monitoring and correction processes aiming at changing contents when the database table structure of the database is changed, having high monitoring reliability and high correction accuracy, effectively improving the correction efficiency of the database table structure change, avoiding frequent and active manual execution scripts, avoiding complicated processes caused by repeated generation and coverage of the corresponding codes, effectively saving labor cost and time cost, and further effectively improving the accuracy, reliability and development efficiency of enterprise-level web background software development.
In one or more embodiments of the present application, object relational mapping (Object Relation Mapping, ORM for short) is a well-established database-related software programming technique that makes it unnecessary to go through complex SQL statements when a specific entity object is manipulated by mapping objects represented by an object model into an SQL-based relational model database structure, and only requires simple manipulation of the attributes and methods of the entity object. The ORM technology provides a bridge between objects and relationships through which object-type data at the back end of software and relational data in databases are transformed into each other.
In one or more embodiments of the present application, the trigger may specifically be a DDL trigger (Data Definition Language Trigger) for auditing and normalizing operations on structures such as tables, triggers, and views in a database. Such as in a modification table, a modification column, a new addition table, a new addition column, etc. A section of the program within the trigger may be executed when a change in the database structure occurs.
For this purpose, in an embodiment of the present application, an intelligent database code monitoring system is provided, and referring to fig. 1, the intelligent database code monitoring system may at least include: a server 11 and at least one client device 12, and the client device 12 may comprise a display interface, various different types of data table databases may be deployed in the server 11.
The server 11 performs a process of intelligent database coding monitoring, that is, the server may monitor a database table structure corresponding to a target database in real time, if it is monitored that the database table structure changes, an ORM automatic generation code corresponding to data affected by the current change of the database table structure is automatically generated, and difference data between a prestored ORM current storage code corresponding to the target database and the ORM automatic generation code is obtained and output to perform code error correction on the target database, and then the server 11 may send the difference data to a corresponding pre-subscribed and authorized client device 12 to enable a user to perform code error correction for the current change of the target database according to the difference data from the client device 12 held by the user.
In practical applications, the portion of performing intelligent database coding monitoring may be performed at the server side, i.e. the architecture shown in fig. 1, or all operations may be completed in the client device. The selection may be specifically based on the processing power of the client device, and restrictions on the use scenario of the user. For example, an administrator of a target area may apply the client devices it holds online for intelligent database code monitoring for individual client devices in the target area. The present application is not limited in this regard.
It will be appreciated that the client device may include a cell phone, tablet computer, network set top box, portable computer, desktop computer, personal Digital Assistant (PDA), vehicle device, smart wearable device, all-in-one, etc., or an APP for smart database code monitoring. Wherein, intelligent wearing equipment can include intelligent glasses, intelligent wrist-watch, intelligent bracelet etc.. The particular form of the client device is not limited in this application.
The client device may have a communication module (i.e. a communication unit) and may be connected to a remote server in a communication manner, so as to implement data transmission with the server. The server may include a server on the side of the task scheduling center, and in other implementations may include a server of an intermediate platform, such as a server of a third party server platform having a communication link with the task scheduling center server. The server may include a single computer device, a server cluster formed by a plurality of servers, or a server structure of a distributed device.
Any suitable network protocol may be used for communication between the server and the client device, including those not yet developed at the filing date of this application. The network protocols may include, for example, TCP/IP protocol, UDP/IP protocol, HTTP protocol, HTTPS protocol, etc. Of course, the network protocol may also include, for example, RPC protocol (Remote Procedure Call Protocol ), REST protocol (Representational State Transfer, representational state transfer protocol), etc. used above the above-described protocol.
In order to realize the full-automatic monitoring and error correction process aiming at the change content when the database table structure of the database sends the change, the monitoring reliability is high, the error correction accuracy is high, and the error correction efficiency of the database table structure change can be effectively improved. In the steps or the structures of the apparatuses, which logically do not have the necessary cause and effect, the execution order of the steps or the structure of the modules is not limited to the execution order or the structure of the modules shown in the embodiments or the drawings of the present application. When the method or module structure is applied to a device, a server or a client device in practice, the method or module structure may be performed sequentially or in parallel (for example, a parallel processor or a multi-threaded processing environment, or even an implementation environment including distributed processing and server clusters) according to the embodiment or the method or module structure shown in the drawings.
Based on the above-mentioned intelligent database coding monitoring system, the embodiment of the present application may execute the process of intelligent database coding monitoring through the server, and execute the process of sending the intelligent database coding monitoring instruction to the server and receiving the monitoring result sent by the server through the client device online, which is specifically described in the following embodiments.
The application provides an embodiment of an intelligent database coding monitoring method with an execution subject serving as a server, referring to fig. 2, the intelligent database coding monitoring method specifically includes the following contents:
step 100: and monitoring the database table structure corresponding to the target database in real time.
In step 100, the server monitors the database table structure corresponding to the target database in real time according to preset monitoring parameters. It can be understood that after the user starts the server, the server automatically judges whether the monitoring parameters are set, if so, the database table structure corresponding to the target database is monitored in real time according to the monitoring parameters, and if not, a prompt is sent to the user to enable the user to set the monitoring parameters; for example: the database table alters the associated frequency and time rule parameters, code path parameters, etc.
Step 200: if the database table structure is monitored to change, automatically generating an ORM automatic generation code corresponding to the data influenced by the current change of the database table structure.
Step 300: and acquiring and outputting pre-stored difference data between the current ORM storage codes corresponding to the target database and the ORM automatic generation codes so as to perform code error correction on the target database.
It can be understood that outputting the difference data between the ORM currently stored code corresponding to the target database and the ORM automatically generated code, which is pre-stored, refers to sending the difference data to the corresponding client device or directly performing display processing on the difference data.
As can be seen from the above description, the intelligent database coding monitoring method provided by the embodiment of the application can realize the full-automatic monitoring and error correction process aiming at the changing content when the database table structure of the database is changed, has high monitoring reliability and high error correction accuracy, can effectively improve the error correction efficiency of the database table structure change, can avoid frequent and active manual execution of scripts, and avoids the complicated process caused by repeated generation and coverage of corresponding codes, can effectively save labor cost and time cost, and further can effectively improve the accuracy, reliability and development efficiency of enterprise-level web background software development.
In order to further reduce the server load and improve the reliability of the error correction process on the basis of improving the error correction efficiency and the automation degree of the database table structure change, in one embodiment of the present application, referring to fig. 3, step 200 in the intelligent database coding monitoring method specifically includes the following:
step 201: if the database table structure is monitored to change, a preset trigger is controlled to store trigger information corresponding to the current change of the database table structure into a trigger information table.
In one or more embodiments subsequent to the present application, the trigger information table is specifically stored in a folder named monitor_ orm _trigger. Wherein the attribute field of the trigger information table for storing the trigger information includes: modifying a modification timestamp of a database structure of the target database, executing a client IP address of a modification operation aiming at the database structure, a user identification, an operation type aiming at the target database, an operation table name, an sql statement of a specific trigger operation and the like contain environment and execution context information.
Step 202: and judging whether the current change of the database table structure meets a preset trigger accumulation condition or not based on the trigger information, if so, automatically generating an ORM automatic generation code corresponding to the data influenced by the current change of the database table structure.
On this basis, in order to effectively improve the storage reliability of the ORM automatic generation code, in one embodiment of the present application, referring to fig. 4, after step 202 in the intelligent database coding monitoring method, the following is specifically included:
step 203: and storing the ORM automatic generation code into an ORM database.
In one or more embodiments subsequent to this application, the information in the ORM database is specifically stored in a folder named dir_ ORM _database.
In order to further provide auxiliary coding information for users to improve the cognitive ability of developers to design potential problems of the table structure on the basis of improving the error correction efficiency and the automation degree of the table structure change, in one embodiment of the present application, referring to fig. 5, the following are further specifically included after step 300 of the intelligent database coding monitoring method:
step 400: and generating corresponding database triggering statistical summary information for auxiliary coding based on the triggering information.
Step 500: and sending the database triggering statistical summary information to a corresponding client to assist a user in encoding the target database.
In order to further improve the accuracy of the error correction result on the basis of improving the error correction efficiency and the automation degree of the database table structure change, in an embodiment of the present application, referring to fig. 6, before step 300 of the intelligent database coding monitoring method, the following is further specifically included:
Step 204: updating data related to the ORM in the code corresponding to the target database in the code warehouse corresponding to the target database, and confirming the data related to the ORM as the current code stored by the ORM.
In one or more embodiments subsequent to this application, the information in the code repository is specifically stored in a folder named dir_repo_database.
In order to further improve the error correction efficiency and the automation degree of the database table structure change, in an embodiment of the present application, referring to fig. 7, step 300 of the intelligent database code monitoring method specifically includes the following:
step 301: and respectively acquiring the corresponding ORM automatic generation code and the corresponding ORM current storage code from the trigger information table and the code warehouse.
Step 302: and performing difference comparison between the current ORM storage code and the ORM automatic generation code to obtain corresponding difference data.
Step 303: and sending the difference data to a corresponding client so that a user can correct the code of the current change of the target database according to the difference data from the client.
In order to further improve the accuracy of the error correction result on the basis of improving the error correction efficiency and the automation degree of the database table structure change, in one embodiment of the present application, referring to fig. 8, before step 303 in the intelligent database coding monitoring method, the method specifically includes the following:
Step 3021: and filtering the difference data according to the time stamp of the automatically generated code.
Based on the above, the intelligent database coding method provided in the embodiment of the present application, by designing an intelligent triggering rule for database table structure change, monitors the database table structure change in real time, regenerates the code affected by the database table structure change through an ORM tool, extracts the difference between new and old codes caused by the change of the database from front to back, and extracts the difference summary information covering the data statistics feature of the database structure change, and transmits the difference summary information to the subscriber through a message mechanism; the difference abstract information containing the data statistics characteristics can obviously improve the cognitive ability of research personnel on potential problems of the table structural design, so that the logic of the table structural design is optimized; compared with the conventional ORM frame code automatic generation technology, the scheme is different from the conventional scheme in the change of the database table structure, does not need to adopt frequent and active manual execution scripts, repeatedly generates and covers the complicated processes of corresponding codes, can enable a user to fully automatically and efficiently know errors or defects of related codes of the database ORM in real time, avoids technical risks, improves automation efficiency, increases coverage of the automation codes, and reduces partial adverse defects caused by manual triggering of script generation code operation.
Based on the embodiment of the foregoing intelligent database coding monitoring method in the software aspect, the present application further provides an intelligent database coding monitoring device for implementing all or part of the content in the intelligent database coding monitoring method, referring to fig. 9, where the intelligent database coding monitoring device specifically includes the following contents:
and the database monitoring module 003 is used for monitoring the database table structure corresponding to the target database in real time.
The code storage module 006 is configured to automatically generate an ORM automatic generation code corresponding to data affected by the current change of the database table structure if the change of the database table structure is detected.
The code difference analysis module 007 is configured to obtain and output difference data between the pre-stored ORM current stored code corresponding to the target database and the ORM automatic generation code, so as to perform code error correction on the target database.
Specifically, in addition to the above database monitor module 003, the code storage module 006 and the code difference analysis module 007, referring to fig. 10, the intelligent database code monitor apparatus further includes: the database core system service module 001, the data storage module 002, the ORM code generation module 004, the ORM code generation triggering module 005 and the code difference reminding module 008 are specifically described as follows:
(1) Referring to table 1, the database core system service module 001 serves as a core service, and initializes system parameters to operate other business sub-modules.
TABLE 1
(2) Referring to Table 2, data storage module 002 contains a database table structure that is logically related to normal web software business; in the software development and debugging operation process, a developer performs operations related to adding, deleting, changing and checking on the existing information of the database according to a software development flow, and simultaneously modifies, adds and deletes a table, adds a column of modified table structure, reduces a column of modified table structure, modifies the attribute of a certain field of the table structure and the like according to the change of service logic, and particularly, the data storage module 002 comprises a trigger monitoring information table, and then is uniformly represented by a monitor_trigger_table; the data information monitored by the database monitoring module 003 is contained; the database monitoring module 003 establishes DDL language triggering rules by setting triggers; monitoring the change of the table structure of the database; and storing the triggered information by designing a brand new monitor_ orm _trigger table; and simultaneously contains context information to make joint decisions.
TABLE 2
The attribute field of the monitor_trigger_table table at least comprises the following contents:
1) Executing a modification timestamp opttime that modifies the database structure;
2) The ip of the execution modification operation client, the hostname, the type of database operation, the name of an operation table, the sql statement of the specific trigger operation and the like contain environment and execution context information, so that the subsequent module can conveniently carry out joint decision.
(3) Referring to table 3, the database monitoring module 003 is configured to monitor changes of the database table in the above module, and includes a DDL trigger, and record operations related to a DDL-related database table structure; when the program developer changes the database structure, the program developer can execute a section of program in the trigger, store the trigger information into the trigger monitoring information table monitor_trigger_table, and call the ORM code to generate the trigger module 005.
The attribute fields of the monitor_trigger_table table include, but are not limited to, a modification timestamp openertime for modifying the database structure, an ip for executing a modification operation client, a hostname, a type of database operation, a name of an operation table, and sql statement for specifically triggering the operation, which include environment and execution context information, so that a subsequent module can conveniently make a joint decision;
TABLE 3 Table 3
(4) Referring to table 4, the ORM code generating module 004 is configured to receive the generation information from the ORM code generating triggering module 005, generate a semi-automatic ORM frame related code, store the semi-automatic ORM frame related code in the code storage module 006, and perform the code difference analysis by the code difference analysis module 007; the ORM code generating module 004 generally has existing commercialized open source codes, such as myBatis automatic generating framework MyBatis Generator of java, and the ORM code generating module 004 needs to set the current connected database ip address, user name password, code file path name of the target, etc.; after the setting is finished, calling the interface of the module, and obtaining the automatically generated code corresponding to the latest database table structure.
TABLE 4 Table 4
(5) Referring to table 5, the ORM code generation triggering module 005 is used for judging and analyzing the ORM trigger, deciding whether to start the ORM code generation module 004 to generate codes; optionally, in order to relieve the database pressure, the cumulative judgment of the trigger is performed, and in the frequently submitted code time work time, the ORM code generation module 004 is triggered to generate codes only when the time period n_work has m_work times or more; in the idle time idletime, triggering k_idletime times or more in the j_idletime time interval period, and triggering an ORM code generating module 004 to generate codes; by querying the code storage module 006, the latest modification time of the database code in the code of the code warehouse is marked as t_repo_database, and the data of DDL table structure change stored in the monitor_trigger_table in the time from the present time t_currenttime to the t_repo_database is obtained as a query condition.
TABLE 5
(6) Referring to table 6, the code storage module 006 contains two items of content: the code and ORM of the code repository automatically generate the code. The codes of the code warehouse represent the relevant codes of the database ORM in the latest codes of the current time of the code warehouse, and the file in which the codes are located is assumed to be dir_repo_database; the above-mentioned ORM automatic generation code is a new code generated by the ORM code generation module 004, and we assume that the folder in which it is located is dir_ ORM _database.
TABLE 6
(7) Referring to table 7, the code difference analysis module 007 will first update the code file of dir_repo_database to ensure that the code of the secondary folder is the most recent code repository code; then, comparing the folder part dir_repo_database of the database code in the latest code at the current time with the ORM through a comparison tool to automatically generate a difference part of two folders of the code dir_ ORM _database, and generating an independent comparison difference file diff_patch; the comparison tool, the specific software realizes that a plurality of mature open-source text comparison tools exist, which are not described in detail herein, and research personnel can download and use the text comparison tool according to engineering practice requirements; specifically, the code difference analysis module 007 may query a monitor_trigger_table table to generate database trigger statistics summary information; the database triggering statistics summary information is information for carrying out data analysis on monitor_trigger_table history information, and can provide frequency information including but not limited to the table which is modified in the past week, table names modified by the current ranking top10 trigger and the like, and the most frequently modified table interfaces and fields are used as the database triggering statistics summary information, so that the meaning of generating report summaries is that a database designer is reminded to reasonably optimize the table interfaces for reminding and risk control; in particular, the code difference analysis module 007 analyzes the diff_patch difference file, filters out the difference part of the timestamp of the automatically generated code in the difference, and reduces the unnecessary false triggering probability; if the last confirmation is a table structure difference, a code difference reminding module 008 is called.
TABLE 7
(8) Referring to table 8, the code difference reminding module 008 is configured to send the database trigger statistics summary information generated by the code difference analysis module 007 and the comparison difference file diff_patch to all the developers in the form of mail.
TABLE 8
Based on the foregoing, the present application provides an embodiment of implementing the intelligent database coding monitoring method by using the intelligent database coding monitoring device, referring to fig. 11, specifically including the following:
s1: starting a server: the user opens the database core system service module 001;
s2: judging whether a server parameter is set;
if yes, directly executing S3;
otherwise, the database core system service module 001 performs parameter initialization: setting frequency and time rule parameters related to database table change and code path parameters related to an ORM code generating module 004;
s3: judging whether a DDL trigger event exists;
the database monitoring module 003 monitors the change of the database table structure in the data storage module 002 by using the DDL trigger, i.e. whether a DDL trigger event is generated, if yes, S4 is executed;
s4: the database monitoring module block 003 writes the DDL trigger event and the current environmental context information into a monitor_trigger_table data table in the data storage module block 002;
S5: the ORM code generation triggering module 005 analyzes the triggering time and frequency of the DDL triggering event, judges the ORM triggering, and decides whether to start the ORM code generation module 004 to generate codes;
if yes, executing S6;
s6: the ORM code generation module 004 generates a corresponding code;
the ORM code generating module 004 receives the generation information from the ORM code generating triggering module 005, generates semi-automatic ORM frame related codes, and stores the semi-automatic ORM frame related codes to the code storing module 006;
optionally, to relieve the database pressure, a cumulative judgment of triggering is made:
(1) In the time of frequently submitting codes, triggering the ORM code generating module 004 to generate codes only when m-work times or more are triggered in the time period n-work;
(2) In the idle time idletime, triggering k_idletime times or more in the j_idletime time interval period, and triggering an ORM code generating module 004 to generate codes;
by querying the code storage module 006, the latest modification time of the database code in the code of the code warehouse is marked as t_repo_database, and the data of DDL table structure change stored in the monitor_trigger_table in the time from the current time t_currenttime to the t_repo_database is obtained as a query condition;
S7: ensuring that the code file of the t_repo_database is updated to the latest;
the code difference analysis module 007 will first update the code file of dir_repo_database to ensure that the code of the secondary folder is the most recent code repository code;
s8: acquiring code differences using a comparison tool;
the code difference analysis module 007 automatically generates the difference part of two folders, namely the dir_ ORM _database, of the database code in the code of the current time by comparing the folder part dir_repo_database and the ORM through a comparison tool, and generates an independent comparison difference file diff_patch;
s9: generating database triggering statistical summary information;
the code difference analysis module 007 queries a monitor_trigger_table table in the data storage module 002 to generate database trigger statistical summary information;
the code difference analysis module 007 analyzes the diff_patch difference file, filters and removes the difference part of the time stamp of the automatically generated code in the difference, and reduces the unnecessary false triggering probability;
the code difference analysis module 007 invokes the code difference alert module 008 if it is confirmed that it is a table structure difference.
S10: sending the comparison difference file diff_patch and the database triggering statistical summary information to a subscriber in a mail form;
The code difference reminding module 008 sends the database trigger statistics summary information generated by the code difference analysis module 007 and the comparison difference file diff_patch to all the research personnel in the form of mail.
In order to further explain the scheme, the application also provides a specific application example for implementing the intelligent database coding monitoring method by using the intelligent database coding monitoring device, which specifically comprises the following contents:
in the application example, a list of whether a valid new field is added to a transaction history database table in a background large project development process of a certain bank is taken as an example, and an automatic code generation process is taught;
1) An administrator opens a database core system service module 001 to enable other business sub-modules to operate; simultaneously setting related module parameters;
the data storage module 002 comprises a database table structure related to normal web software business logic; in the process of software development and debugging operation, a developer performs operations of adding, deleting, modifying and checking related information in the database according to a software development flow, and simultaneously modifies the structure of the table according to the change of service logic, adds and deletes the table, adds a list of modified table structures, reduces a list of modified table structures, modifies the attribute of a certain field of the table structure and the like;
In particular, the data storage module 002 includes a trigger monitor information table, which is denoted by monitor_trigger_table; the method comprises the step of monitoring data information by a database monitoring module 003, wherein the specific expression is shown in a table 9:
TABLE 9
The developer modifies the transaction_history table 10 times in succession during the working time interval of 1 hour, with the sql statement shown in table 10 being executed once:
table 10
alter table transaction_history add(valid VARchar2(1)default('1'))
2) A database monitoring module 003 for monitoring the change of the database table in the module;
the monitoring module comprises a DDL trigger and records the operation related to the database table structure related to the DDL; when the program developer changes the database structure, the program developer can execute a section of program in the trigger, store the trigger information into the trigger monitoring information table monitor_trigger_table, and call the ORM code to generate the trigger module 005.
The attribute fields of the monitor_trigger_table table include, but are not limited to, a modification timestamp openertime for executing a modification database structure, an ip for executing a modification operation client, a hostname, a type of database operation, a name of an operation table, and sql statement of a specific trigger operation, which include environment and execution context information, so that a subsequent module can conveniently make a joint decision;
For example, in this specific example, since the developer adds a column of valid to the transaction_history,
for example, the trigger core key code that is similar to the trigger core key code that is preset in this example is shown in table 11 (specific fields and table attribute details in the sql syntax are omitted here):
TABLE 11
After the trigger is preset, the table modification operation is monitored, and the information is stored in the monitor_trigger_table.
3) The ORM code generation triggering module 005 is used for judging and analyzing ORM triggering, deciding whether to start the ORM code generation module 004 to generate codes;
optionally, to relieve database pressure, a cumulative determination of triggers is made,
in the time of frequently submitting codes, triggering the ORM code generating module 004 to generate codes only when m-work times or more are triggered in the time period n-work;
in the idle time idletime, triggering k_idletime times or more in the j_idletime time interval period, and triggering an ORM code generating module 004 to generate codes;
by querying the code storage module 006, the latest modification time of the database code in the code of the code warehouse is marked as t_repo_database, and the data of DDL table structure change stored in the monitor_trigger_table in the time span from the current time t_currenttime to t_repo_database is obtained as a query condition;
For example, in this specific example, there are 10 table structure modification operations within 120min of the working period, which is greater than the threshold value of m_worktime=5, so automatic code generation can be triggered; by querying that the time span from the time t_currenttime to the time t_repo_database is 5 days, 20 modifications exist in the 5 days, and the modifications are all changes to the transformation_history table structure.
4) The ORM code generating module 004 receives the generation information from the ORM code generating triggering module 005, generates semi-automatic ORM frame related codes, stores the semi-automatic ORM frame related codes in the code storage module 006, and simultaneously executes the code difference analysis module 007 to perform code difference analysis;
the ORM code generation module 004 generally has an existing commercial open source code, such as myBatis auto generation framework MyBatis Generator of java.
The ORM code generation module needs to set the current connected database ip address, user name and password, the code file path name of the target and the like; after the setting is finished, calling an interface of the module to obtain an automatically generated code corresponding to the latest database table structure;
for example, in this example, the database ip is filled with the host ip where the transaction_history is located, the object code path is filled with "D: \ ORM _database", and the semi-automatic ORM framework used is MyBatis Generator; and finally mapping the transaction_history database table to generate a corresponding automation code.
5) The generated code is stored in the code storage module 006; the code storage module 006 contains two items of content, the code of the code repository, the ORM automatically generating the code.
The codes of the code warehouse represent the related codes of the database ORM in the latest codes of the current time of the code warehouse, and the file folder in which the codes are located is assumed to be dir_repo_database;
the automatic ORM code generation module 004 generates a new code, and the folder in which the code is located is assumed to be dir_ ORM _database.
6) Code difference analysis module 007
The module firstly updates the code file of dir_repo_database to ensure that the code of the secondary folder is the latest code warehouse code;
then, by means of comparison tool, the folder portion of the database code in the code of the current time update is compared
The dir_repo_database and the ORM automatically generate the difference part of two folders of the code dir_ ORM _database, and an independent comparison difference file diff_patch is generated;
the comparison tool, the specific software realizes that a plurality of mature open-source text comparison tools exist, which are not described in detail herein, and research personnel can download and use the text comparison tool according to engineering practice requirements;
specifically, the code difference analysis module 007 queries a monitor_trigger_table table to generate database trigger statistics summary information;
The database triggering statistics summary information is information for carrying out data analysis on monitor_trigger_table history information, and can provide frequency information including but not limited to the table which is modified in the past week, table names modified by the current ranking top10 trigger and the like, and the most frequently modified table interfaces and fields are used as the database triggering statistics summary information, so that the meaning of generating report summaries is that a database designer is reminded to reasonably optimize the table interfaces for reminding and risk control;
in particular, the code difference analysis module 007 analyzes the diff_patch difference file, filters out the difference part of the timestamp of the automatically generated code in the difference, and reduces the unnecessary false triggering probability;
and finally, confirming the table structure difference and calling a code difference reminding module 008.
For example, in this example, the valid field is added to the transaction_history table due to the table structure change; the generated diff_patch will necessarily contain information that suggests that in the new code, the acquiring and setting functions of the valid field attribute need to be added, and information related to the attribute declaration field;
meanwhile, through time condition constraint, inquiring monitor_trigger_table related information, finding that the transformation_history is the most frequent one, namely the most frequent one of the database tables with the top10 table structure modified, and generating database triggering statistical summary information.
7) The code difference reminding module 008 sends the database triggering statistical summary information generated by the code difference analysis module 007 to all research and development personnel in the form of mail by comparing the difference file diff_patch;
for example, in the example, the research personnel receive mails with modified structures of the transaction_history list from eight and a half points to a company in the morning every day;
in a short period, a researcher and a developer applies the patch to the latest code warehouse through a tool, so that the method is efficient and quick;
in a long term, a research and development team finds that the transformation_history data table is most frequently modified, reminds database designers of whether the design of the table is too bulky, and then brings reasonable optimization table interfaces up to a plan and a schedule for a long term, so that the method is used as an important basis for reminding and risk control.
Based on the method, the system and the device, the intelligent database table structure change triggering rule and the real-time monitoring is adopted to conduct real-time monitoring on the database table structure change, and when the database table structure is changed, codes influenced by the database table structure change are automatically regenerated through an ORM tool; the scheme can enable a user to fully automatically and efficiently know errors or defects of related codes of the database ORM in real time, avoids technical risks, improves automation efficiency, increases coverage of the automation codes, and reduces partial adverse drawbacks caused by manual triggering of script generation code operation; extracting difference abstract information covering data statistics characteristics of database structure change caused by the difference of new and old codes due to the change of the database back and forth, and transmitting the information to a subscriber through a message mechanism; the difference abstract information containing the data statistics features can obviously improve the cognitive ability of research personnel on potential problems of the table structural design, and further optimize the logic of the table structural design.
As can be seen from the above description, the application example of the present application implements the intelligent database coding monitoring method by designing an intelligent database table structure change triggering rule, monitoring the database table structure change in real time, automatically generating the code affected by the database table structure change again through an ORM tool, extracting the difference of new and old codes caused by the change of the database from front to back, and the difference summary information covering the data statistics feature of the database structure change, and transmitting the extracted information to the subscriber through a message mechanism; the difference abstract information containing the data statistics characteristics can obviously improve the cognitive ability of research personnel on potential problems of the table structural design, so that the logic of the table structural design is optimized; compared with the prior ORM frame automatic code generation technology, the scheme is different from the prior scheme in the change of the database table structure, does not need to adopt frequent and active manual execution scripts, repeatedly generates and covers the complicated processes of corresponding codes, can enable a user to fully automatically and efficiently know errors or defects of related codes of the database ORM in real time, avoids technical risks, improves the automation efficiency, increases the coverage range of the automation codes, and reduces partial adverse defects caused by manual triggering of script generation code operation.
The method embodiments provided above in the present application may be performed in a client device 12, a server device 11, a computer cluster or similar computing means. Taking the operation on a server as an example, fig. 12 is a block diagram of a hardware structure of a server of an intelligent database code monitoring method according to an embodiment of the present invention. As shown in fig. 12, the server device 11 may include one or more (only one is shown in the figure) processors 1020 (the processor 1020 may include, but is not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA), a memory 1040 for storing data, and a transmission module 1060 for communication functions. It will be appreciated by those of ordinary skill in the art that the configuration shown in fig. 12 is merely illustrative and is not intended to limit the configuration of the electronic device described above. For example, the server device 11 may also include more or fewer components than shown in fig. 12, or have a different configuration than shown in fig. 12.
The memory 1040 may be used to store software programs and modules of application software, such as program instructions/modules corresponding to the intelligent database code monitoring method in the embodiment of the present invention, and the processor 1020 executes the software programs and modules stored in the memory 1040, thereby executing various functional applications and data processing, that is, implementing the intelligent database code monitoring method of application program described above. Memory 1040 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 1040 may further include memory remotely located relative to processor 1020, which may be connected to server device 11 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission module 1060 is used to receive or transmit data via a network. The specific example of the network described above may include a wireless network provided by a communication provider of the server apparatus 11. In one example, the transmission module 1060 includes a network adapter (Network Interface Controller, NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission module 1060 may be a Radio Frequency (RF) module for communicating with the internet wirelessly.
Based on the content of the intelligent database code monitoring, the embodiment of the application also provides electronic equipment, which comprises a display screen, a processor and a memory for storing instructions executable by the processor. The display screen may include a touch screen, a liquid crystal display, a projection device, or the like, which displays information content. The electronic equipment types can comprise mobile terminals, special car insurance equipment, car machine interaction equipment, personal computers and the like. All or part of the intelligent database code monitoring method may be implemented when the processor executes the instructions, for example, the processor may implement the following when executing the instructions:
Step 100: and monitoring the database table structure corresponding to the target database in real time.
Step 200: if the database table structure is monitored to change, automatically generating an ORM automatic generation code corresponding to the data influenced by the current change of the database table structure.
Step 300: and acquiring and outputting pre-stored difference data between the current ORM storage codes corresponding to the target database and the ORM automatic generation codes so as to perform code error correction on the target database.
It can be understood that outputting the difference data between the ORM currently stored code corresponding to the target database and the ORM automatically generated code, which is pre-stored, refers to sending the difference data to the corresponding client device or directly performing display processing on the difference data.
As can be seen from the above description, the electronic device provided in the embodiment of the present application can realize a full-automatic monitoring and error correction process for a changing content when a database table structure of a database is changed, so that the monitoring reliability is high and the error correction accuracy is high, and the error correction efficiency of the database table structure change can be effectively improved, frequent and active manual execution of scripts can be avoided, and complicated procedures caused by repeated generation and coverage of corresponding codes are avoided, so that labor cost and time cost can be effectively saved, and further, the accuracy, reliability and development efficiency of enterprise-level web background software development can be effectively improved.
Based on the foregoing content of the intelligent database code monitoring, embodiments of the present application further provide a computer readable storage medium capable of implementing all or part of the steps in the foregoing intelligent database code monitoring method embodiments, where the computer readable storage medium stores a computer program, where the computer program when executed by a processor implements all of the intelligent database code monitoring method in the foregoing embodiments, for example, where the processor implements the following steps when executing the computer program:
step 100: and monitoring the database table structure corresponding to the target database in real time.
Step 200: if the database table structure is monitored to change, automatically generating an ORM automatic generation code corresponding to the data influenced by the current change of the database table structure.
Step 300: and acquiring and outputting pre-stored difference data between the current ORM storage codes corresponding to the target database and the ORM automatic generation codes so as to perform code error correction on the target database.
It can be understood that outputting the difference data between the ORM currently stored code corresponding to the target database and the ORM automatically generated code, which is pre-stored, refers to sending the difference data to the corresponding client device or directly performing display processing on the difference data.
As can be seen from the above description, the computer readable storage medium provided in the embodiments of the present application can realize a full-automatic monitoring and error correction process for a change content when a database table structure of a database is changed, so that the monitoring reliability is high and the error correction accuracy is high, and the error correction efficiency of the database table structure change can be effectively improved, frequent and active manual execution of scripts can be avoided, and complicated procedures caused by repeated generation and coverage of corresponding codes are avoided, so that labor cost and time cost can be effectively saved, and further the accuracy, reliability and development efficiency of enterprise-level web background software development can be effectively improved.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
The instructions described above may be stored in a variety of computer-readable storage media. The computer readable storage medium may include physical means for storing information, where the information may be stored electronically, magnetically, or optically, etc. The computer readable storage medium according to the present embodiment may include: means for storing information using electrical energy such as various memories, e.g., RAM, ROM, etc.; devices for storing information using magnetic energy such as hard disk, floppy disk, magnetic tape, magnetic core memory, bubble memory, and USB flash disk; devices for optically storing information, such as CDs or DVDs. Of course, there are other ways of readable storage medium, such as quantum memory, graphene memory, etc. Instructions in a device or server or client or system described below are as described above.
Although the present application provides method operational steps as described in the examples or flowcharts, more or fewer operational steps may be included based on conventional or non-inventive labor. The order of steps recited in the embodiments is merely one way of performing the order of steps and does not represent a unique order of execution. When implemented by an actual device or client product, the instructions may be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment) as shown in the embodiments or figures.
The apparatus or module set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. For convenience of description, the above devices are described as being functionally divided into various modules, respectively. The functions of the various modules may be implemented in the same piece or pieces of software and/or hardware when implementing the present application. Of course, a module that implements a certain function may be implemented by a plurality of sub-modules or a combination of sub-units.
The methods, apparatus or modules described herein may be implemented in computer readable program code means and in any suitable manner, e.g., the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable logic controllers and embedded microcontrollers, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic of the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller in a pure computer readable program code, it is well possible to implement the same functionality by logically programming the method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Such a controller can be regarded as a hardware component, and means for implementing various functions included therein can also be regarded as a structure within the hardware component. Or even means for achieving the various functions may be regarded as either software modules implementing the methods or structures within hardware components.
From the description of the embodiments above, it will be apparent to those skilled in the art that the present application may be implemented in software plus necessary hardware. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product, or may be embodied in the implementation of data migration. The computer software product may be stored on a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., comprising instructions for causing a computer device (which may be a personal computer, mobile terminal, server, or network device, etc.) to perform the methods described in various embodiments or portions of embodiments herein.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a car-mounted human-computer interaction device, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification embodiments may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects.
The present embodiments may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The embodiments of the specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments. In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the embodiments of the present specification. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
Although the present application has been described by way of example, those of ordinary skill in the art will recognize that there are many variations and modifications of the present application without departing from the spirit of the present application, and it is intended that the appended claims encompass such variations and modifications without departing from the spirit of the present application.
The foregoing is merely an example of the present specification and is not intended to limit the present specification. Various modifications and variations of the illustrative embodiments will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, or the like, which is within the spirit and principles of the embodiments of the present specification, should be included in the scope of the claims of the embodiments of the present specification.

Claims (5)

1. An intelligent database code monitoring method is characterized by comprising the following steps:
real-time monitoring is carried out on a database table structure corresponding to the target database so as to monitor whether DDL triggering events representing the change of the database table structure are generated or not;
if the database table structure is monitored to change, a preset trigger is controlled to store DDL trigger events and current environmental context information corresponding to the current change of the database table structure into a trigger information table;
analyzing the triggering time and the frequency of the DDL triggering event, judging whether m-working time times and more triggers exist in the n-working time of the time period in the frequently submitted code time working time, if yes, automatically generating an ORM automatic generation code corresponding to data influenced by the current change of the database table structure; judging whether the j_idletime time interval period has k_idletime times or more triggers in the non-working time idletime, if so, automatically generating an ORM automatic generation code corresponding to data influenced by the current change of the database table structure;
Updating the ORM related codes of the target database in the code warehouse;
comparing the ORM related codes of the target database in the latest code warehouse at the current time with the difference parts of the ORM automatically generated codes, and generating an independent comparison difference file;
inquiring the trigger information table to generate database trigger statistics summary information; filtering to remove a difference part of a timestamp of the automatically generated code in the comparison difference file, analyzing the comparison difference file, if the comparison difference file is confirmed to be a table structure difference, sending the comparison difference file and the statistical summary information to a client, enabling the client to perform code error correction on target data based on the comparison difference file, and reasonably optimizing a table interface based on the statistical summary information to perform risk control.
2. The intelligent database code monitoring method according to claim 1, further comprising, after said dynamically generating the ORM automatic generation code corresponding to the data affected by the current change of the database table structure:
and storing the ORM automatic generation code into an ORM database.
3. An intelligent database code monitoring device, comprising:
The database core system service module is used for initializing system parameters;
the data storage module is used for storing a trigger information table, wherein the stored trigger information table comprises DDL trigger events corresponding to the current change of the database table structure and current environment context information;
the database monitoring module is used for monitoring the change of a database table and comprises a DDL trigger, recording the related operation of the database table structure related to the DDL, storing the DDL trigger event and the current environment context information into the stored trigger information table, and calling an ORM code to generate a trigger module;
the ORM code generation triggering module is used for judging whether m-work time times or more trigger exists in the time period n-work time within the frequently submitted code time work time, and if so, triggering the ORM code generation module 004 to generate codes; judging whether k_idle time is triggered for more than k_idle time in the idle time interval period, if yes, triggering an ORM code generating module 004 to generate codes;
the ORM code generation module is used for receiving the generation information from the ORM code generation triggering module, automatically generating an ORM automatic generation code corresponding to the data influenced by the current change of the database table structure, and storing the ORM automatic generation code into the code storage module;
The code storage module is used for storing codes of a code warehouse and automatically generating codes by the ORM;
the code difference analysis module is used for updating the related codes of the database ORM in the code warehouse; comparing the related code of the database ORM in the latest code warehouse at the current time with the difference part of the code automatically generated by the ORM, and generating an independent comparison difference file; inquiring the trigger information table to generate database trigger statistics summary information; filtering to remove the difference part of the timestamp of the automatically generated code in the comparison difference file, analyzing the comparison difference file, and calling a code difference reminding module if the comparison difference file is confirmed to be the table structure difference;
the code difference reminding module is used for sending the comparison difference file generated by the code difference analysis module and the statistical summary information to the client so that the client can carry out code error correction on the target data based on the comparison difference file and reasonably optimize a table interface based on the statistical summary information to carry out risk control.
4. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the intelligent database code monitoring method of any of claims 1 to 2 when the program is executed by the processor.
5. A computer readable storage medium having stored thereon computer instructions, which when executed implement the steps of the intelligent database code monitoring method of any of claims 1 to 2.
CN201910476075.XA 2019-06-03 2019-06-03 Intelligent database coding monitoring method and device and electronic equipment Active CN110286883B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910476075.XA CN110286883B (en) 2019-06-03 2019-06-03 Intelligent database coding monitoring method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910476075.XA CN110286883B (en) 2019-06-03 2019-06-03 Intelligent database coding monitoring method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN110286883A CN110286883A (en) 2019-09-27
CN110286883B true CN110286883B (en) 2024-01-30

Family

ID=68003202

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910476075.XA Active CN110286883B (en) 2019-06-03 2019-06-03 Intelligent database coding monitoring method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN110286883B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111125101B (en) * 2019-12-16 2023-10-13 杭州涂鸦信息技术有限公司 Data center table structure consistency monitoring method and system
CN113297038B (en) * 2020-04-07 2022-07-19 阿里巴巴集团控股有限公司 Monitoring and data processing method, device and equipment, monitoring system and data center
CN111767269B (en) * 2020-06-24 2021-05-04 苏州紫焰网络科技有限公司 Health detection method, device and equipment of database instance and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101727320A (en) * 2008-10-22 2010-06-09 国际商业机器公司 Method and tools for identifying impact of database changes on an application
CN103294462A (en) * 2012-03-05 2013-09-11 阿里巴巴集团控股有限公司 Object mapping processing method, mapping processor and object mapping processing system
US8874621B1 (en) * 2011-10-09 2014-10-28 LockPath, Inc. Dynamic content systems and methods
US9037614B1 (en) * 2012-02-24 2015-05-19 Amazon Technologies, Inc. Secondary mappings to enable code changes without schema updates
CN107423142A (en) * 2017-06-28 2017-12-01 北京明朝万达科技股份有限公司 It is a kind of based on issue, the database message Notification Method of subscribing mode and system
CN108255925A (en) * 2017-11-10 2018-07-06 平安普惠企业管理有限公司 A kind of display methods and its terminal of data list structure alteration
CN108572996A (en) * 2017-03-14 2018-09-25 北京京东尚科信息技术有限公司 Synchronous method, device, electronic equipment and the storage medium of database table structure
CN108804708A (en) * 2018-06-22 2018-11-13 平安科技(深圳)有限公司 Business datum table files modification method, device, computer equipment and storage medium
CN108920698A (en) * 2018-07-16 2018-11-30 北京京东金融科技控股有限公司 A kind of method of data synchronization, device, system, medium and electronic equipment
CN109064345A (en) * 2018-08-14 2018-12-21 中国平安人寿保险股份有限公司 Message treatment method, system and computer readable storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6385618B1 (en) * 1997-12-22 2002-05-07 Sun Microsystems, Inc. Integrating both modifications to an object model and modifications to a database into source code by an object-relational mapping tool
US8782001B2 (en) * 2010-02-19 2014-07-15 International Business Machines Corporation Computation of impacted and affected code due to database schema changes

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101727320A (en) * 2008-10-22 2010-06-09 国际商业机器公司 Method and tools for identifying impact of database changes on an application
US8874621B1 (en) * 2011-10-09 2014-10-28 LockPath, Inc. Dynamic content systems and methods
US9037614B1 (en) * 2012-02-24 2015-05-19 Amazon Technologies, Inc. Secondary mappings to enable code changes without schema updates
CN103294462A (en) * 2012-03-05 2013-09-11 阿里巴巴集团控股有限公司 Object mapping processing method, mapping processor and object mapping processing system
CN108572996A (en) * 2017-03-14 2018-09-25 北京京东尚科信息技术有限公司 Synchronous method, device, electronic equipment and the storage medium of database table structure
CN107423142A (en) * 2017-06-28 2017-12-01 北京明朝万达科技股份有限公司 It is a kind of based on issue, the database message Notification Method of subscribing mode and system
CN108255925A (en) * 2017-11-10 2018-07-06 平安普惠企业管理有限公司 A kind of display methods and its terminal of data list structure alteration
CN108804708A (en) * 2018-06-22 2018-11-13 平安科技(深圳)有限公司 Business datum table files modification method, device, computer equipment and storage medium
CN108920698A (en) * 2018-07-16 2018-11-30 北京京东金融科技控股有限公司 A kind of method of data synchronization, device, system, medium and electronic equipment
CN109064345A (en) * 2018-08-14 2018-12-21 中国平安人寿保险股份有限公司 Message treatment method, system and computer readable storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Juan M. Vara 等.Model transformation for object-relational database development.《SAC '07: Proceedings of the 2007 ACM symposium on Applied computing》.2007,1012–1019. *
一种基于触发器的数据同步系统的研究及关键技术实现;刘树 等;《计算机应用与软件》;第29卷(第12期);189-200 *
基于ORM数据映射工具的设计与分析;赵烽;《中国优秀硕士学位论文全文数据库信息科技辑》;I138-601 *

Also Published As

Publication number Publication date
CN110286883A (en) 2019-09-27

Similar Documents

Publication Publication Date Title
US10534773B2 (en) Intelligent query parameterization of database workloads
CN110286883B (en) Intelligent database coding monitoring method and device and electronic equipment
CA3092722A1 (en) Data retention handling for data object stores
CN108304329B (en) Test case design method and device, terminal and readable storage medium
US10394805B2 (en) Database management for mobile devices
US20230342663A1 (en) Machine learning application method, device, electronic apparatus, and storage medium
CN111737227B (en) Data modification method and system
CN110175027A (en) A kind of method and apparatus for developing business function
CN108897587B (en) Pluggable machine learning algorithm operation method and device and readable storage medium
CN111078701A (en) Data extraction method and device based on relational database
CN107977867A (en) Billing model update method, data system for settling account and computer-readable recording medium
CN111949831A (en) Graphic database establishing method and device and readable storage medium
CN114969441A (en) Knowledge mining engine system based on graph database
CN113722345A (en) Method and device for displaying mapping relation, electronic equipment and storage medium
US20190220828A1 (en) Methods and systems for re-configuring a schedule of a preventive maintenance plan
US20180173601A1 (en) Energy consumption analysis based on telemetry data
CN113467782B (en) Method, device and equipment for determining business process
CN103107898A (en) Method, device and system for sending or receiving multiple managed objects simultaneously
CN108664499B (en) Data storage method, device and equipment
CN113220701B (en) Block chain-based data structure self-adaptive change upgrading method, device, equipment and product
CN115174368B (en) Method and system for generating and acquiring logs of terminal equipment of Internet of vehicles
US11934396B2 (en) Data reconciliation for big data environments
CN117573199B (en) Model difference comparison analysis method, device, equipment and medium
CN101883004A (en) Method, device and system for synthesizing service data
Fanjiang et al. Automatic data logging and quality analysis system for mobile devices

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20220913

Address after: 25 Financial Street, Xicheng District, Beijing 100033

Applicant after: CHINA CONSTRUCTION BANK Corp.

Address before: 25 Financial Street, Xicheng District, Beijing 100033

Applicant before: CHINA CONSTRUCTION BANK Corp.

Applicant before: Jianxin Financial Science and Technology Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant