CN111177183B - Method and device for generating database access statement - Google Patents

Method and device for generating database access statement Download PDF

Info

Publication number
CN111177183B
CN111177183B CN201911347583.4A CN201911347583A CN111177183B CN 111177183 B CN111177183 B CN 111177183B CN 201911347583 A CN201911347583 A CN 201911347583A CN 111177183 B CN111177183 B CN 111177183B
Authority
CN
China
Prior art keywords
access
database
generating
elements
models
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
CN201911347583.4A
Other languages
Chinese (zh)
Other versions
CN111177183A (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 CN201911347583.4A priority Critical patent/CN111177183B/en
Publication of CN111177183A publication Critical patent/CN111177183A/en
Application granted granted Critical
Publication of CN111177183B publication Critical patent/CN111177183B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a method and a device for generating database access sentences, and relates to the technical field of computers. One embodiment of the method comprises the following steps: each access element is arranged and combined to obtain an access model set; wherein the set of access models includes at least one access model; generating database standard encapsulation programs corresponding to all the access models according to all the access models; and receiving parameters provided by a user, and referencing the parameters into the database standard packaging program so as to generate a database access statement. The implementation mode can solve the technical problem of great difficulty in code development.

Description

Method and device for generating database access statement
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for generating a database access statement.
Background
In the software development process, access to database resources is mostly achieved by writing SQL sentences. The traditional implementation mode is that different developers write the embedded SQL according to different business requirements and different writing languages. The problems introduced by this approach are: on one hand, the development is relatively complex, and the requirements on the developers are high; on the other hand, database management staff face a large amount of complex SQL, operation management difficulty is also very high, and a plurality of problems can be found only in the on-line operation process, so that the problems are difficult to avoid in advance.
In the process of implementing the present invention, the inventor finds that at least the following problems exist in the prior art:
the operation of accessing the database requires that the developer has certain SQL writing capability, but the skills of actual personnel are uneven, and the requirements cannot be met; SQL sentences submitted by developers are biased to function implementation, performance problems are not focused enough, and the SQL sentences are not easy to find in advance; the database access scene design and the index design are not effectively combined, and the index needs to be added or modified only when the production has problems.
Disclosure of Invention
In view of this, the embodiment of the invention provides a method and a device for generating database access sentences, so as to solve the technical problem of high difficulty in code development.
To achieve the above object, according to one aspect of an embodiment of the present invention, there is provided a method of generating a database access statement, including:
each access element is arranged and combined to obtain an access model set; wherein the set of access models includes at least one access model;
generating database standard encapsulation programs corresponding to all the access models according to all the access models;
and receiving parameters provided by a user, and referencing the parameters into the database standard packaging program so as to generate a database access statement.
Optionally, generating a database standard encapsulation program corresponding to each access model according to each access model includes:
generating database access templates corresponding to all the access models according to all the access models;
and generating a corresponding database standard encapsulation program according to the table name, the index sequence number and the database access template.
Optionally, before the ranking and combining of the access elements, the method further includes:
each element is obtained from the existing database access statement, and a plurality of elements with differences are screened out as access elements.
Optionally, the parameter includes at least one of a table name, an operation code, an index sequence number, and an access condition value.
In addition, according to another aspect of an embodiment of the present invention, there is provided an apparatus for generating a database access statement, including:
the combination module is used for arranging and combining all the access elements to obtain an access model set; wherein the set of access models includes at least one access model;
the generation module is used for generating database standard encapsulation programs corresponding to the access models according to the access models;
and the parameter entering module is used for receiving parameters provided by a user, entering the parameters into the database standard packaging program and generating a database access statement.
Optionally, the generating module is further configured to:
generating database access templates corresponding to all the access models according to all the access models;
and generating a corresponding database standard encapsulation program according to the table name, the index sequence number and the database access template.
Optionally, the combination module is further configured to:
before the arrangement and combination of the access elements, the elements are obtained from the existing database access sentences, and a plurality of elements with differences are screened out as the access elements.
Optionally, the parameter includes at least one of a table name, an operation code, an index sequence number, and an access condition value.
According to another aspect of an embodiment of the present invention, there is also provided an electronic device including:
one or more processors;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the methods of any of the embodiments described above.
According to another aspect of an embodiment of the present invention, there is also provided a computer readable medium having stored thereon a computer program which, when executed by a processor, implements the method according to any of the embodiments described above.
One embodiment of the above invention has the following advantages or benefits: because the access model set is obtained by arranging and combining the access elements, the database standard encapsulation program corresponding to each access model is generated according to each access model, and the parameters are added into the database standard encapsulation program, so that the technical means of generating the database access statement is adopted, and the technical problem of high code development difficulty in the prior art is solved. According to the embodiment of the invention, the code writing mode of the developer is changed from writing the database access code into calling the unified interface, so that the development difficulty is greatly reduced. And the index is strongly associated with the database access statement, so that the database access is performed through the index according to the specification, and the performance of the database is effectively ensured. Therefore, access to database resources is achieved by calling the structured code module, and SQL writing processes are avoided.
The embodiment of the invention can generate the database access statement based on the custom access element, can adapt to different business systems and different access scenes, and completely realizes customization. The type and the method of the database resource access are configurable, and can be refined to the index granularity, so that the quantity of database resource access sentences is controllable; the custom access elements are strongly associated with the index, and database access is performed through the index according to the specification, so that the performance problem caused by index deletion or non-compliance is greatly reduced; the access to the database resources is realized by calling the structured code module, so that the code writing process is avoided, and the workload and the labor cost are greatly reduced.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main flow of a method of generating a database access statement according to an embodiment of the invention;
FIG. 2 is a schematic diagram of an access element according to an embodiment of the invention;
FIG. 3 is a schematic illustration of an embodiment of the invention
FIG. 4 is a schematic diagram of the main flow of a method of generating a database access statement according to one referenceable embodiment of the invention;
FIG. 5 is a schematic diagram of the major modules of an apparatus for generating database access statements in accordance with an embodiment of the present invention;
FIG. 6 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
fig. 7 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In order to solve the technical problems in the prior art, the development mode of database resource access codes needs to be simplified as much as possible, and meanwhile, the database resource access operation is standardized.
Fig. 1 is a schematic diagram of the main flow of a method of generating a database access statement according to an embodiment of the invention. As an embodiment of the present invention, as shown in fig. 1, the method for generating a database access statement may include:
and 101, arranging and combining all the access elements to obtain an access model set.
Firstly, extracting a plurality of access elements based on database definition abstraction, and forming an access model set by permutation and combination of the values of each access element. Wherein the set of access models includes at least one access model. Since the database definition mainly includes a table structure and an index definition, a plurality of access elements can be extracted from the database definition.
As shown in fig. 2, the partial access elements are enumerated:
the access element-query condition column combination refers to different query conditions which can be composed based on columns contained in a specific index, and the precondition of the query conditions is that data can be read in an index matching mode.
The access element two-column operator combination refers to operators used in assigning values to index columns, and various combinations of the operators exist.
The three operation functions of the access element refer to corresponding different database access operations, such as adding a record, inquiring according to conditions, deleting the record, updating the record, and the like.
The access element N is used for being expandable, namely, the extracted requirement and the value thereof are not strictly limited, and the access element N is abstracted by a designer according to specific situations.
For example, the existing INDEX1 (COL 1, COL2, COL 3), i.e. the INDEX named INDEX1, consists of 3 fields COL1, COL2, COL 3. Then
The INDEX1 access element-query condition row combination is (COL 1), (COL 1, COL 2) three types (COL 1, COL2, COL 3).
The access element two column operator combination may be: equal to (=), greater than (>), less than (<), etc
The three operation functions of the access element can be insert, select, update, delete and the like
Based on the above access element values, the set of access models (3 of which are enumerated) that can be generated are as follows:
insert into table tbtest values(A,B,C)
select*from tbtest where col1=A;
select*from tbtest where col1=A and COL2>=B
optionally, before step 101, the method may further include: each element is obtained from the existing database access statement, and a plurality of elements with differences are screened out as access elements. In the embodiment of the invention, the principle of access element picking is based on the application scene of the system. Specifically, statistics may be performed on existing database access sentences in the system, the most important elements (for example, 90% of the SQL differences are represented by the elements or the values thereof) are extracted, and then the access elements are arranged and combined, so as to obtain an access model set.
And 102, generating database standard encapsulation programs corresponding to the access models according to the access models.
After each access model is determined, a corresponding database standard encapsulation program may be generated from each access model, respectively. Optionally, step 102 may include: generating database access templates corresponding to all the access models according to all the access models; and generating a corresponding database standard encapsulation program according to the table name, the index sequence number and the database access template. That is, for a database table, each index sequence number has its corresponding database standard encapsulation program, and the two are related to each other, so that the index has a strong association with the finally generated database access statement, the database access statement is normalized, and the performance problem caused by index missing or non-compliance is greatly reduced.
And step 103, receiving parameters provided by a user, and referencing the parameters into the database standard encapsulation program so as to generate a database access statement.
After the database standard encapsulation program is determined, the code implementation can be performed on each database standard encapsulation program, the uncertain elements in the implementation are selected by reading the configuration table, and a tool program (the tool program is written by java codes) can generate a final code according to the parameters and the database standard encapsulation program.
Optionally, the parameter includes at least one of a table name, an operation code, an index sequence number, and an access condition value. The user can submit at least one of table name, operation code, index sequence number and access condition value, and the tool program refers the parameters submitted by the user to the corresponding database standard encapsulation program according to the parameters so as to generate a database access statement.
As shown in fig. 3, parameters such as table name, operation code (select/update/delete/insert/open_cursor, etc.), index number, access condition value, etc. may be transferred by calling the database standard encapsulation access interface, and after the database standard encapsulation access interface receives these parameters, some basic compliance checks are performed, and the database standard encapsulation program code to be called is determined, so as to complete the corresponding function.
Because each index sequence number has a corresponding database standard encapsulation program and the index sequence numbers are mutually related, the database access statement after entering the reference is also mutually related with the index sequence number, thereby establishing strong association between index design and the database access statement, namely, all SQL operations must have corresponding index support, otherwise, problems are prompted, and the database access performance problems caused by index design deletion are greatly reduced. Moreover, the developer does not need to write codes any more, but realizes database operation by calling related code modules, so that development complexity is reduced.
The strong association is because the element corresponding to the index is the most dominant element on which the code generation depends, and all database access statements are generated based on the index, i.e., the query condition fed into the database must be the index column.
According to the various embodiments described above, it can be seen that the method and the device for generating the database access statement by arranging and combining the access elements to obtain the access model set, generating the database standard encapsulation program corresponding to each access model according to each access model, and entering the parameters into the database standard encapsulation program, so that the technical means of generating the database access statement is achieved, and the technical problem of high code development difficulty in the prior art is solved. According to the embodiment of the invention, the code writing mode of the developer is changed from writing the database access code into calling the unified interface, so that the development difficulty is greatly reduced. And the index is strongly associated with the database access statement, so that the database access is performed through the index according to the specification, and the performance of the database is effectively ensured. Therefore, access to database resources is achieved by calling the structured code module, and SQL writing processes are avoided.
The embodiment of the invention can generate the database access statement based on the custom access element, can adapt to different business systems and different access scenes, and completely realizes customization. The type and the method of the database resource access are configurable, and can be refined to the index granularity, so that the quantity of database resource access sentences is controllable; the custom access elements are strongly associated with the index, and database access is performed through the index according to the specification, so that the performance problem caused by index deletion or non-compliance is greatly reduced; the access to the database resources is realized by calling the structured code module, so that the code writing process is avoided, and the workload and the labor cost are greatly reduced.
Fig. 4 is a schematic diagram of the main flow of a method of generating a database access statement according to one referenceable embodiment of the invention. As another embodiment of the present invention, as shown in fig. 4, the method for generating a database access statement may include:
step 401, each element is obtained from the existing database access statement, and a plurality of elements with variability are screened out as access elements.
In the embodiment of the invention, the principle of access element picking is based on the application scene of the system. Specifically, statistics may be performed on existing database access sentences in the system, the most important elements (for example, 90% of the SQL differences are represented by the elements or the values thereof) are extracted, and then the access elements are arranged and combined, so as to obtain an access model set.
Step 402, each access element is arranged and combined to obtain an access model set.
Firstly, extracting a plurality of access elements based on database definition abstraction, and forming an access model set by permutation and combination of the values of each access element. Wherein the set of access models includes at least one access model. Since the database definition mainly includes a table structure and an index definition, a plurality of access elements can be extracted from the database definition.
As shown in fig. 2, the partial access elements are enumerated:
the access element-query condition column combination refers to different query conditions which can be composed based on columns contained in a specific index, and the precondition of the query conditions is that data can be read in an index matching mode.
The access element two-column operator combination refers to operators used in assigning values to index columns, and various combinations of the operators exist.
The three operation functions of the access element refer to corresponding different database access operations, such as adding a record, inquiring according to conditions, deleting the record, updating the record, and the like.
The access element N is used for being expandable, namely, the extracted requirement and the value thereof are not strictly limited, and the access element N is abstracted by a designer according to specific situations.
And step 403, generating database access templates corresponding to the access models according to the access models.
After each access model is determined, a corresponding database access template may be generated from each access model, respectively.
And step 404, generating a corresponding database standard encapsulation program according to the table name, the index sequence number and the database access template.
For a database table, each index sequence number has a corresponding database standard encapsulation program, and the index sequence numbers and the database standard encapsulation program are mutually associated, so that the index and the finally generated database access statement have strong association, the database access statement is standardized, and the performance problem caused by index deletion or non-compliance is greatly reduced.
And step 405, receiving parameters provided by a user, and referencing the parameters into the database standard encapsulation program so as to generate a database access statement.
After the database standard encapsulation program is determined, the code implementation can be performed on each database standard encapsulation program, the uncertain elements in the implementation are selected by reading the configuration table, and a tool program (the tool program is written by java codes) can generate a final code according to the parameters and the database standard encapsulation program.
Optionally, the parameter includes at least one of a table name, an operation code, an index sequence number, and an access condition value. The user can submit at least one of table name, operation code, index sequence number and access condition value, and the tool program refers the parameters submitted by the user to the corresponding database standard encapsulation program according to the parameters so as to generate a database access statement.
Parameters such as table names, operation codes (selection/update/delete/insert/open_cursor and the like), index sequence numbers, access condition values and the like can be transmitted by calling the database standard encapsulation access interface, and after the database standard encapsulation access interface receives the parameters, some basic compliance checks are carried out, and database standard encapsulation program codes needing to be called are judged to complete corresponding functions.
Because each index sequence number has a corresponding database standard encapsulation program and the index sequence numbers are mutually related, the database access statement after entering the reference is also mutually related with the index sequence number, thereby establishing strong association between index design and the database access statement, namely, all SQL operations must have corresponding index support, otherwise, problems are prompted, and the database access performance problems caused by index design deletion are greatly reduced. Moreover, the developer does not need to write codes any more, but realizes database operation by calling related code modules, so that development complexity is reduced.
In addition, in the embodiment of the present invention, the method for generating the database access statement is described in detail in the above description, so that the description is not repeated here.
Fig. 5 is a schematic diagram of main modules of an apparatus for generating a database access sentence according to an embodiment of the present invention, and as shown in fig. 5, the apparatus 500 for generating a database access sentence includes a combining module 501, a generating module 502, and a joining module 503. The combination module 501 is configured to perform permutation and combination on each access element to obtain an access model set; wherein the set of access models includes at least one access model; the generating module 502 is configured to generate a database standard encapsulation program corresponding to each access model according to each access model; the parameter entering module 503 is configured to receive parameters provided by a user, and enter the parameters into the database standard packaging program, so as to generate a database access statement.
Optionally, the generating module 502 is further configured to:
generating database access templates corresponding to all the access models according to all the access models;
and generating a corresponding database standard encapsulation program according to the table name, the index sequence number and the database access template.
Optionally, the combining module 501 is further configured to:
before the arrangement and combination of the access elements, the elements are obtained from the existing database access sentences, and a plurality of elements with differences are screened out as the access elements.
Optionally, the parameter includes at least one of a table name, an operation code, an index sequence number, and an access condition value.
According to the various embodiments described above, it can be seen that the method and the device for generating the database access statement by arranging and combining the access elements to obtain the access model set, generating the database standard encapsulation program corresponding to each access model according to each access model, and entering the parameters into the database standard encapsulation program, so that the technical means of generating the database access statement is achieved, and the technical problem of high code development difficulty in the prior art is solved. According to the embodiment of the invention, the code writing mode of the developer is changed from writing the database access code into calling the unified interface, so that the development difficulty is greatly reduced. And the index is strongly associated with the database access statement, so that the database access is performed through the index according to the specification, and the performance of the database is effectively ensured. Therefore, access to database resources is achieved by calling the structured code module, and SQL writing processes are avoided.
The embodiment of the invention can generate the database access statement based on the custom access element, can adapt to different business systems and different access scenes, and completely realizes customization. The type and the method of the database resource access are configurable, and can be refined to the index granularity, so that the quantity of database resource access sentences is controllable; the custom access elements are strongly associated with the index, and database access is performed through the index according to the specification, so that the performance problem caused by index deletion or non-compliance is greatly reduced; the access to the database resources is realized by calling the structured code module, so that the code writing process is avoided, and the workload and the labor cost are greatly reduced.
The details of the implementation of the apparatus for generating a database access sentence according to the present invention are already described in the above method for generating a database access sentence, and therefore, the description thereof will not be repeated here.
Fig. 6 illustrates an exemplary system architecture 600 to which a method of generating a database access statement or an apparatus for generating a database access statement of an embodiment of the invention may be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 is used as a medium to provide communication links between the terminal devices 601, 602, 603 and the server 605. The network 604 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 605 via the network 604 using the terminal devices 601, 602, 603 to receive or send messages, etc. Various communication client applications such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only) may be installed on the terminal devices 601, 602, 603.
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 605 may be a server providing various services, such as a background management server (by way of example only) providing support for shopping-type websites browsed by users using terminal devices 601, 602, 603. The background management server may analyze and process the received data such as the article information access request, and feedback the processing result (e.g., the target push information, the article information—only an example) to the terminal device.
It should be noted that, the method for generating a database access statement provided by the embodiment of the present invention is generally executed by the server 605, and accordingly, the device for generating a database access statement is generally disposed in the server 605. The method for generating the database access statement provided by the embodiment of the invention can also be executed by the terminal equipment 601, 602 and 603, and correspondingly, the device for generating the database access statement can be arranged in the terminal equipment 601, 602 and 603.
It should be understood that the number of terminal devices, networks and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, there is illustrated a schematic diagram of a computer system 700 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 7 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, ROM 702, and RAM703 are connected to each other through a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input section 706 including a keyboard, a mouse, and the like; an output portion 707 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 708 including a hard disk or the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. The drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read therefrom is mounted into the storage section 708 as necessary.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 709, and/or installed from the removable medium 711. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 701.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer programs according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a processor includes a combination module, a generation module, and a parameter entry module, where the names of the modules do not constitute a limitation on the module itself in some cases.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include: each access element is arranged and combined to obtain an access model set; wherein the set of access models includes at least one access model; generating database standard encapsulation programs corresponding to all the access models according to all the access models; and receiving parameters provided by a user, and referencing the parameters into the database standard packaging program so as to generate a database access statement.
According to the technical scheme of the embodiment of the invention, the technical means of generating the database access statement is overcome because the access model sets are obtained by arranging and combining the access elements, the database standard encapsulation program corresponding to each access model is generated according to each access model, and the parameters are added into the database standard encapsulation program, so that the technical problem of high code development difficulty in the prior art is solved. According to the embodiment of the invention, the code writing mode of the developer is changed from writing the database access code into calling the unified interface, so that the development difficulty is greatly reduced. And the index is strongly associated with the database access statement, so that the database access is performed through the index according to the specification, and the performance of the database is effectively ensured. Therefore, access to database resources is achieved by calling the structured code module, and SQL writing processes are avoided.
The embodiment of the invention can generate the database access statement based on the custom access element, can adapt to different business systems and different access scenes, and completely realizes customization. The type and the method of the database resource access are configurable, and can be refined to the index granularity, so that the quantity of database resource access sentences is controllable; the custom access elements are strongly associated with the index, and database access is performed through the index according to the specification, so that the performance problem caused by index deletion or non-compliance is greatly reduced; the access to the database resources is realized by calling the structured code module, so that the code writing process is avoided, and the workload and the labor cost are greatly reduced.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (6)

1. A method of generating database access statements, comprising:
each access element is arranged and combined to obtain an access model set; wherein the set of access models includes at least one access model;
generating database standard encapsulation programs corresponding to all the access models according to all the access models;
receiving parameters provided by a user, and referencing the parameters into the database standard packaging program so as to generate a database access statement;
the database standard packaging program corresponding to each access model is generated according to each access model, and the database standard packaging program comprises the following components:
generating database access templates corresponding to all the access models according to all the access models;
generating a corresponding database standard encapsulation program according to the table name, the index sequence number and the database access template;
before the arrangement and combination of the access elements, the method further comprises:
each element is obtained from the existing database access statement, and a plurality of elements with differences are screened out as access elements.
2. The method of claim 1, wherein the parameter comprises at least one of a table name, an opcode, an index number, and an access condition value.
3. An apparatus for generating database access statements, comprising:
the combination module is used for arranging and combining all the access elements to obtain an access model set; wherein the set of access models includes at least one access model;
the generation module is used for generating database standard encapsulation programs corresponding to the access models according to the access models;
the parameter entering module is used for receiving parameters provided by a user, entering the parameters into the database standard packaging program and generating a database access statement;
wherein, the generating module is further used for:
generating database access templates corresponding to all the access models according to all the access models;
generating a corresponding database standard encapsulation program according to the table name, the index sequence number and the database access template;
the combination module is further configured to:
before the arrangement and combination of the access elements, the elements are obtained from the existing database access sentences, and a plurality of elements with differences are screened out as the access elements.
4. The apparatus of claim 3, wherein the parameter comprises at least one of a table name, an opcode, an index number, and an access condition value.
5. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of claim 1 or 2.
6. A computer readable medium on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to claim 1 or 2.
CN201911347583.4A 2019-12-24 2019-12-24 Method and device for generating database access statement Active CN111177183B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911347583.4A CN111177183B (en) 2019-12-24 2019-12-24 Method and device for generating database access statement

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911347583.4A CN111177183B (en) 2019-12-24 2019-12-24 Method and device for generating database access statement

Publications (2)

Publication Number Publication Date
CN111177183A CN111177183A (en) 2020-05-19
CN111177183B true CN111177183B (en) 2023-07-04

Family

ID=70655563

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911347583.4A Active CN111177183B (en) 2019-12-24 2019-12-24 Method and device for generating database access statement

Country Status (1)

Country Link
CN (1) CN111177183B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105589959A (en) * 2015-12-22 2016-05-18 北京京东尚科信息技术有限公司 Form processing method and form processing system
CN109902002A (en) * 2019-02-14 2019-06-18 浙江口碑网络技术有限公司 Generation method and device, storage medium, the computer equipment of combined test use-case
CN110019350A (en) * 2017-07-28 2019-07-16 北京京东尚科信息技术有限公司 Data query method and apparatus based on configuration information

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7590630B2 (en) * 2003-12-15 2009-09-15 Electronic Data System Corporation Managing electronic information
US10558658B2 (en) * 2017-05-16 2020-02-11 Sap Se Propagation of structured query language associations

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105589959A (en) * 2015-12-22 2016-05-18 北京京东尚科信息技术有限公司 Form processing method and form processing system
CN110019350A (en) * 2017-07-28 2019-07-16 北京京东尚科信息技术有限公司 Data query method and apparatus based on configuration information
CN109902002A (en) * 2019-02-14 2019-06-18 浙江口碑网络技术有限公司 Generation method and device, storage medium, the computer equipment of combined test use-case

Also Published As

Publication number Publication date
CN111177183A (en) 2020-05-19

Similar Documents

Publication Publication Date Title
CN110019350B (en) Data query method and device based on configuration information
CN107832045B (en) Method and apparatus for cross programming language interface conversion
US9323729B2 (en) Coordinating the management of the layout and design of portal pages with the management of its associated web content
CN112286513A (en) Visual design method and device based on component metadata
US11200231B2 (en) Remote query optimization in multi data sources
WO2021023149A1 (en) Method and apparatus for dynamically returning message
CN111125064B (en) Method and device for generating database schema definition statement
CN112000734A (en) Big data processing method and device
CN113190517B (en) Data integration method and device, electronic equipment and computer readable medium
CN113448570A (en) Data processing method and device, electronic equipment and storage medium
CN108959294B (en) Method and device for accessing search engine
CN113760948A (en) Data query method and device
CN112905225A (en) Method and device for creating continuous integration tool construction task
CN116483707A (en) Test method, test device, test apparatus, test program, and test program
CN111177183B (en) Method and device for generating database access statement
CN113760240A (en) Method and device for generating data model
CN113762702A (en) Workflow deployment method, device, computer system and readable storage medium
CN113535221A (en) Method and device for managing application version
CN113536748A (en) Method and device for generating chart data
CN112099841A (en) Method and system for generating configuration file
CN112965747B (en) Method, apparatus, device and computer readable medium for mining code loopholes
CN116610706A (en) Data blood-edge analysis method, server and system
CN108984189B (en) Module parsing method and device
CN115964052A (en) Data processing method and device, electronic equipment and computer readable medium
CN116302208A (en) Apollo configuration modification method, apparatus, electronic device and computer readable medium

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: 20220920

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