CN115309404A - File generation method and device, electronic equipment and storage medium - Google Patents

File generation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115309404A
CN115309404A CN202210997492.0A CN202210997492A CN115309404A CN 115309404 A CN115309404 A CN 115309404A CN 202210997492 A CN202210997492 A CN 202210997492A CN 115309404 A CN115309404 A CN 115309404A
Authority
CN
China
Prior art keywords
information
query information
table name
determining
target
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.)
Pending
Application number
CN202210997492.0A
Other languages
Chinese (zh)
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202210997492.0A priority Critical patent/CN115309404A/en
Publication of CN115309404A publication Critical patent/CN115309404A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • 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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • 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/245Query processing
    • G06F16/2455Query execution
    • G06F16/24564Applying rules; Deductive queries
    • 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/25Integrating or interfacing systems involving database management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure provides a file generation method, a file generation device, electronic equipment and a storage medium. Can be applied to the technical field of computers. The file generation method comprises the following steps: determining structured query information from source program code of a business layer; pre-compiling the structured query information to generate query information for calling a database interface; compiling query information for calling a database interface to generate target query information for accessing a data access layer interface; determining table name information from the structured query information, wherein the table name information is used for representing access routing information; and generating a target file based on the target query information and the table name information for accessing the data access layer interface.

Description

File generation method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a file generation method, an apparatus, an electronic device, a storage medium, and a computer program product.
Background
Most of online systems are designed years ago, generally have no data access layer, and need to directly use the service layer to access the database, which causes a great deal of change to the service layer under the condition of data deployment change in the database, so that the flexibility of service research and development is poor, the workload of research and development personnel is increased, and the risk of errors is high. It is therefore desirable to introduce a data access layer to optimize the architecture of an online system.
In implementing the disclosed concept, the inventors found that there are at least the following problems in the related art: in the related art, the construction method of the data access layer needs to be realized by modifying the program code of the business layer, the workload is large, and the processing flow of the business layer is easily damaged.
Disclosure of Invention
In view of the above, the present disclosure provides a file generation method, apparatus, electronic device, storage medium, and computer program product.
One aspect of the present disclosure provides a file generation method, including:
determining structured query information from source program codes of a business layer;
pre-compiling the structured query information to generate query information for calling a database interface;
compiling query information for calling a database interface to generate target query information for accessing a data access layer interface;
determining table name information from the structured query information, wherein the table name information is used for representing access routing information; and
and generating a target file based on the target query information and the table name information for accessing the data access layer interface.
According to an embodiment of the present disclosure, wherein determining table name information from the structured query information includes:
determining a query type of the structured query information; and
and determining table name information from the structured query information according to an extraction rule matched with the query type.
According to an embodiment of the present disclosure, determining table name information from the structured query information according to an extraction rule matching the query type includes:
determining a target field from the structured query information based on the query type; and
based on the target field, table name information is determined from the structured query information.
According to the embodiment of the present disclosure, generating a target file based on target query information and table name information for accessing a data access layer interface includes:
determining a storage location matched with the table name information based on the table name information;
generating a data routing parameter table based on the storage position, wherein the data routing parameter table comprises data access mode information matched with the storage position;
packaging target query information and a data routing parameter table for accessing a data access layer interface to generate a temporary file; and
and linking the temporary file with the middleware to generate a target file.
According to an embodiment of the present disclosure, the file generation method further includes:
determining format information of first communication information related to a service layer from the structured query information;
determining format information of second communication information related to the calling database interface;
and mapping the format information of the first communication information and the format information of the second communication information to generate a communication mapping table so as to generate a target file based on target query information, the communication mapping table and table name information for accessing the data access layer interface.
According to an embodiment of the present disclosure, the file generation method further includes:
determining an application program interface instruction from source program codes of a business layer; and
and converting the application program interface command to generate service calling information for calling the middleware system interface so as to generate a target file based on the target query information, the communication mapping table, the service calling information and the table name information for accessing the data access layer interface.
Another aspect of the present disclosure provides a file generating apparatus including:
the first determining module is used for determining the structured query information from the source program code of the service layer;
the first generation module is used for pre-compiling the structured query information to generate query information for calling a database interface;
the second generation module is used for compiling query information for calling the database interface and generating target query information for accessing the data access layer interface;
the second determining module is used for determining table name information from the structured query information, wherein the table name information is used for representing the access routing information; and
and the third generation module is used for generating a target file based on the target query information and the table name information for accessing the data access layer interface.
Another aspect of the present disclosure provides an electronic device including: one or more processors; a memory for storing one or more instructions, wherein the one or more instructions, when executed by the one or more processors, cause the one or more processors to implement the method as described above.
Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, cause the processor to implement the method as described above.
Another aspect of the disclosure provides a computer program product comprising computer executable instructions for implementing the method as described above when executed.
According to the embodiment of the disclosure, structured query information is determined from source program codes of a business layer; pre-compiling the structured query information to generate query information for calling a database interface; compiling query information for calling a database interface to generate target query information for accessing a data access layer interface; determining table name information representing access routing information from the structured query information; and generating a target file based on target query information and table name information for accessing the data access layer interface, generating target query information for accessing the data access layer interface by compiling the query information for calling the database interface, so that the data access interface is converted into the data access layer interface, and generating the target file based on the target query information and table name information for the data access layer interface, so that the generated target file can call data in the database through access routing information by using the data access layer interface to realize loose coupling of the database and the service layer, thereby at least partially overcoming the technical problems that in the related art, a construction method of the data access layer needs to be realized by manually modifying the data in the service layer, the traffic is large, and the labor cost is high.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates an exemplary system architecture to which the file generation methods and apparatus may be applied, according to an embodiment of the present disclosure;
FIG. 2 schematically shows a flow diagram of a file generation method according to an embodiment of the present disclosure;
FIG. 3 schematically shows a flow diagram of a file generation method according to yet another embodiment of the present disclosure;
FIG. 4 schematically shows a schematic diagram of a file generation method according to yet another embodiment of the present disclosure;
FIG. 5 schematically shows a block diagram of a file generation apparatus according to an embodiment of the present disclosure; and
FIG. 6 schematically illustrates a block diagram of a computer system suitable for implementing the file generation method described above, in accordance with an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs, unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction should be interpreted in the sense one having ordinary skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B, a and C, B and C, and/or A, B, C, etc.). Where a convention analogous to "A, B or at least one of C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B or C" would include, but not be limited to, systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
In the related art, in a large online system, a layered architecture design is mostly adopted, wherein a business layer can access a database through a data access layer, when the deployment of the database is changed (for example, a certain table data is loaded into a cache database), program codes of the business layer need to be modified through data access operations related to manual carding analysis, and then, a Structured Query Language (SQL) for accessing the database is manually changed into an interface of the data access layer. Most of the service layers are developed and designed for years ago, the number of related programs is large, the processing flow of service logic is easy to damage by directly modifying the service layers, and the influence range is large.
In view of this, embodiments of the present disclosure provide a file generation method. The method comprises determining structured query information from source program code of a business layer; pre-compiling the structured query information to generate query information for calling a database interface; compiling query information for calling a database interface to generate target query information for accessing a data access layer interface; determining table name information from the structured query information, wherein the table name information is used for representing access routing information; and generating a target file based on the target query information and the table name information for accessing the data access layer interface.
According to the embodiment of the disclosure, the query information for calling the database interface is compiled to generate the target query information for accessing the data access layer interface, so that the data access interface is converted into the data access layer interface, and in addition, the target file is generated based on the target query information and the table name information of the data access layer interface, so that the generated target file can call the data in the database by accessing the routing information through the data access layer interface to realize the loose coupling of the database and the service layer, so that the technical problems that in the related art, the construction method of the data access layer needs to be realized by manually modifying the data in the service layer, the traffic is large, and the labor cost is high are at least partially overcome.
Fig. 1 schematically illustrates an exemplary system architecture 100 to which the file generation methods and apparatus may be applied, according to an embodiment of the present disclosure. It should be noted that fig. 1 is only an example of a system architecture to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
As shown in fig. 1, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. Network 104 is the medium used to provide communication links between terminal devices 101, 102, 103 and server 105. Network 104 may include various connection types, such as wired and/or wireless communication links, and so forth.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have installed thereon various communication client applications, such as a shopping-like application, a web browser application, a search-like application, an instant messaging tool, a mailbox client, and/or social platform software, etc. (by way of example only).
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (for example only) providing support for websites browsed by users using the terminal devices 101, 102, 103. The backend management server may analyze and process the received data such as the user request, and feed back a processing result (for example, a web page, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that the file generation method provided by the embodiment of the present disclosure may be generally executed by the server 105. Accordingly, the file generation apparatus provided by the embodiment of the present disclosure may be generally disposed in the server 105. The file generation method provided by the embodiment of the present disclosure may also be executed by a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the file generation apparatus provided by the embodiment of the present disclosure may also be disposed in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105.
For example, the structured query information may be originally stored in server 105. Then, the server 105 may locally execute the file generation method provided by the embodiment of the present disclosure, or send the structured query information to another server or a server cluster, and the other server or the server cluster receiving the structured query information executes the file generation method provided by the embodiment of the present disclosure.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
FIG. 2 schematically shows a flow diagram of a file generation method according to an embodiment of the disclosure.
As shown in fig. 2, the method includes operations S201 to S205.
In operation S201, structured query information is determined from source program code of a business layer.
According to an embodiment of the present disclosure, the business layer may be a layer structure for processing a transaction business in an online system, and the transaction business may be a withdrawal transaction, a deposit transaction, and the like of a user.
According to an embodiment of the present disclosure, the source program code of the business layer may be written by SQL (Structured Query Language) statements.
According to an embodiment of the present disclosure, the structured query information may be an SQL statement in the source program code.
In operation S202, the structured query information is pre-compiled to generate query information for invoking a database interface.
According to an embodiment of the present disclosure, the database interface may be a data interface of a database in an online system.
According to the embodiment of the present disclosure, the SQL statement in the source program code cannot be directly run, and may be precompiled by using a Common Business organized Language (COBOL) to generate query information for invoking a database interface.
According to the embodiment of the disclosure, the source program code may include information related to the calling of the database interface, so that query information for calling the database interface may be obtained after the source program code is compiled.
In operation S203, query information for calling the database interface is compiled, and target query information for accessing the data access layer interface is generated.
According to an embodiment of the present disclosure, query information for invoking a database interface may be compiled. For example, query information for invoking a database interface is formatted to generate target query information for accessing a data access layer interface.
In operation S204, table name information is determined from the structured query information, wherein the table name information is used to characterize the access routing information.
According to an embodiment of the present disclosure, table name information may be included in the structured query information, and thus the table name information may be determined from the structured query information. The table name information may include database interface information, and/or data storage location information, etc. associated with the table, so that access routing information may be determined based on the table name information.
In operation S205, a target file is generated based on target query information and table name information for accessing the data access layer interface.
According to the embodiment of the disclosure, the interface of the data access layer can be determined according to the target query information for accessing the interface of the data access layer, and the interface for accessing the database can be determined according to the table name information, so that the generated target file can call the data in the database by using the data access layer and the table name information.
According to the embodiment of the disclosure, the query information for calling the database interface is compiled to generate the target query information for accessing the data access layer interface, so that the data access interface is converted into the data access layer interface, and in addition, the target file is generated based on the target query information and the table name information of the data access layer interface, so that the generated target file can call the data in the database by accessing the routing information through the data access layer interface to realize the loose coupling of the database and the service layer, so that the technical problems that in the related art, the construction method of the data access layer needs to be realized by manually modifying the data in the service layer, the traffic is large, and the labor cost is high are at least partially overcome.
According to an embodiment of the present disclosure, determining table name information from structured query information includes:
determining a query type of the structured query information; and
and determining table name information from the structured query information according to an extraction rule matched with the query type.
According to an embodiment of the present disclosure, the query type of the structured query information may be various, and may be, for example, a find (Select) statement query type, a Delete (Delete) statement query type, an Update (Update) statement query type, an Insert (Insert) statement query type, and the like.
According to the embodiment of the disclosure, different query types can correspond to different extraction rules, and table name information is determined from the structured query information according to the extraction rules matched with the query types.
According to the embodiment of the disclosure, the table name information can be accurately determined from the structured query information through the extraction rule matched with the query type of the structured query information.
According to the embodiment of the disclosure, determining table name information from structured query information according to an extraction rule matched with a query type includes:
determining a target field from the structured query information based on the query type; and
based on the target field, table name information is determined from the structured query information.
According to an embodiment of the present disclosure, the extraction rule may extract different target fields according to structured query information of different query types. For example, the extraction rule matching the query type of the Select statement may be to use the first field after the keyword From in the Select statement as a target field, the extraction rule matching the query type of the Delete statement may be to use the first field after the keyword From in the Delete statement as a target field, and the extraction rule matching the query type of the Update statement may be to use the first field after the keyword Update in the Update statement as a target field, or may set other extraction rules that meet the requirements as needed.
According to an embodiment of the present disclosure, the target field may be a field associated with table name information, from which table name information in the structured query information may be determined.
According to the embodiment of the disclosure, the query type of the structured query information is used for determining the extraction rule based on the query type, and different multiple query types correspond to multiple extraction rules one to one, so that the application range is wide and the determined table name information is accurate.
According to the embodiment of the disclosure, generating a target file based on target query information and table name information for accessing a data access layer interface includes:
determining a storage location matched with the table name information based on the table name information;
generating a data routing parameter table based on the storage position, wherein the data routing parameter table comprises data access mode information matched with the storage position;
packaging target query information and a data routing parameter table for accessing a data access layer interface to generate a temporary file; and
and linking the temporary file with the middleware to generate a target file.
According to the embodiment of the present disclosure, the storage location matching the table name information can be determined by the table name information. For example, the table name information is a, and the storage location is a cache in the online system; the table name information is B, and the storage position is a local database in the online system; the table name information is C, and the storage position is a different-place database in the online system.
According to an embodiment of the present disclosure, the data routing parameter table may include a storage location matching the table name information, and data access manner information matching the storage location. For example, the storage location matched with the table name information is a local database, and the data access mode information matched with the storage location is a local calling database interface; the storage position matched with the table name information is a different-place database, and the data access mode information matched with the storage position is a partition database interface; the storage position matched with the table name information is a cache, and the data access mode information matched with the storage position is a local calling cache interface.
According to the embodiment of the disclosure, only the target query Information for accessing the data access layer interface may be encapsulated, and then linked with a middleware (CICS) to generate a target file.
According to the embodiment of the disclosure, the data routing parameter table is generated based on the storage position, so that the target file comprises records of different various storage positions, and the service layer can call various data corresponding to the various storage positions one by one through the database access layer generated by the target file. In addition, the temporary file and the middleware are linked to generate an object file, so that the reconstruction of program compiling operation is realized, and the completion of the function of embedding data access layer packaging is realized.
According to an embodiment of the present disclosure, the file generation method further includes:
determining format information of first communication information related to a service layer from the structured query information;
determining format information of second communication information related to the calling database interface;
and mapping the format information of the first communication information and the format information of the second communication information to generate a communication mapping table so as to generate a target file based on target query information, the communication mapping table and table name information for accessing the data access layer interface.
According to an embodiment of the disclosure, the format information of the first communication information related to the business layer may be a format of an SQL statement in the structured query information.
According to an embodiment of the present disclosure, the format information of the second communication information may be format information of a property file (PLIST) variable generated from basic information, input variable information (SQL-PVAR-LIST), output variable information (SQL-AVAR-LIST), and the like in the SQL statement.
According to the embodiment of the disclosure, the basic information in the SQL statement may include information such as a program name and a SQL statement type, and the storage length is 64 bytes.
According to an embodiment of the present disclosure, the SQL-PVAR-LIST may be composed of an SQL descriptor Header (SQLDA Header) containing the number of input variables and the length of a Header, and an SQL entry (SQLVAR entries) containing description information of each input variable (variable type, variable length, and storage location of the variable, i.e., 12-level variable SQLVAR-BASE in PLIST) which takes 44 bytes.
According to the embodiment of the disclosure, the format information of SQL-AVAR-LIST and the format information of SQL-PVAR-LIST may be similar, please refer to the description of the format information of SQL-AVAR-LIST, and the description thereof is omitted here.
According to embodiments of the present disclosure, in the case where a constant is input in an SQL statement, the PLIST variable will not generate SQLVAR entries.
According to the embodiment of the disclosure, the format information of the first communication information and the format information of the second communication information can be better converted through the communication mapping table, so that the butt joint of different formats between the service layer and the database is realized through the target file, and the flexibility of service processing is improved.
According to an embodiment of the present disclosure, the file generation method further includes:
determining an application program interface instruction from source program codes of a business layer; and
and converting the application program interface instruction to generate service calling information for calling the middleware system interface so as to generate a target file based on target query information, a communication mapping table, service calling information and table name information for accessing the data access layer interface.
According to an embodiment of the disclosure, the Application Program Interface instruction may be obtained through an Application Program Interface (API) instruction of the CICS in the source Program code.
According to the embodiment of the disclosure, the application program interface instruction can be converted into the service calling information for calling the middleware system interface in a compiling mode, so that the target file can be generated according to the target query information, the communication mapping table, the service calling information and the table name information for accessing the data access layer interface.
FIG. 3 schematically shows a flow chart of a file generation method according to yet another embodiment of the present disclosure.
As shown in fig. 3, the method includes operations S301 to S310.
In operation S301, structured query information is determined from source program code of a business layer.
In operation S302, the structured query information is pre-compiled, and query information for calling a database interface is generated.
In operation S303, an application program interface instruction is determined from source program code of the service layer.
In operation S304, the application program interface instruction is converted to generate service call information for calling the middleware system interface.
In operation S305, query information for calling a database interface is compiled, and target query information for accessing a data access layer interface is generated.
In operation S306, table name information is determined from the structured query information, wherein the table name information is used to characterize the access routing information.
In operation S307, based on the table name information, a storage location matching the table name information is determined.
In operation S308, a data routing parameter table is generated based on the storage location, wherein the data routing parameter table includes data access manner information matched with the storage location.
In operation S309, service invocation information for invoking the middleware system interface, target query information for accessing the data access layer interface, and the data routing parameter table are encapsulated, and a temporary file is generated.
In operation S310, the temporary file is linked with the middleware to generate a target file.
According to the embodiment of the disclosure, the structured query information can be pre-compiled by the compiling and embedding module to generate the query information for calling the database interface, and the query information for calling the database interface is compiled to generate the target query information for accessing the data access layer interface.
According to an embodiment of the present disclosure, table name information of the structured query information may be determined by a table name resolution module. The table name analysis module can determine a target field from the structured query information according to the query type of the structured query information, and determine the table name information of the structured query information based on the target field.
According to an embodiment of the present disclosure, the temporary file may be generated by a packaging module. The encapsulation module can encapsulate service call information for calling the middleware system interface, target query information for accessing the data access layer interface and the data routing parameter table, thereby generating a temporary file.
According to the embodiment of the disclosure, the temporary file and the middleware are linked to generate the target file, so that the data in the database can be called by accessing the routing information through the data access layer interface to realize loose coupling of the database and the service layer.
Fig. 4 schematically shows a schematic diagram of a file generation method according to yet another embodiment of the present disclosure.
As shown in FIG. 4, the structured query information in the source program code of the business layer may be an SQL statement. And generating query information for calling a database interface after the structured query information is precompiled.
And taking the format information in the structured query information as first communication information, and taking the format information of a property file (PLIST) variable as second communication information. And mapping the format information of the first communication information and the format information of the second communication information to generate a communication mapping table. And compiling the query information for calling the database interface to generate target query information for accessing the data access layer interface.
The contents of the SQL statement may be the value of the output BAL field of TB123 table by the query conditions ZON and SAV. The target field TB123 can be determined by the query type of the SQL statement, the table name information TB123 can be determined based on the target field TB123, and the storage location of the SQL statement can be determined based on the table name information TB123, thereby generating a data routing parameter table. And packaging the target query information for accessing the data access layer interface and the data routing parameter table to generate a temporary file, and linking the temporary file with the middleware to generate a target file.
Fig. 5 schematically shows a block diagram of a file generation apparatus according to an embodiment of the present disclosure.
As shown in fig. 5, the file generating apparatus 500 includes a first determining module 510, a first generating module 520, a second generating module 530, a second determining module 540, and a third generating module 550.
A first determining module 510, configured to determine structured query information from source program code of a business layer;
a first generating module 520, configured to perform pre-compiling on the structured query information, and generate query information for invoking a database interface;
a second generating module 530, configured to compile query information for invoking a database interface, and generate target query information for accessing a data access layer interface;
a second determining module 540, configured to determine table name information from the structured query information, where the table name information is used to represent the access route information; and
a third generating module 550, configured to generate a target file based on the target query information and the table name information for accessing the data access layer interface.
According to the embodiment of the disclosure, the query information for calling the database interface is compiled to generate the target query information for accessing the data access layer interface, so that the data access interface is converted into the data access layer interface, and in addition, the target file is generated based on the target query information and the table name information of the data access layer interface, so that the generated target file can call the data in the database by accessing the routing information through the data access layer interface to realize the loose coupling of the database and the service layer, so that the technical problems that in the related art, the construction method of the data access layer needs to be realized by manually modifying the data in the service layer, the traffic is large, and the labor cost is high are at least partially overcome.
According to an embodiment of the present disclosure, the second determining module 540 for determining the table name information from the structured query information includes:
the first determining unit is used for determining the query type of the structured query information; and
and the second determining unit is used for determining the table name information from the structured query information according to the extraction rule matched with the query type.
According to an embodiment of the present disclosure, the second determining unit, configured to determine the table name information from the structured query information according to the extraction rule matching the query type, includes:
the first determining subunit is used for determining a target field from the structured query information based on the query type; and
and the second determining subunit is used for determining the table name information from the structured query information based on the target field.
According to an embodiment of the present disclosure, the third generating module 550 for generating the target file based on the target query information and the table name information for accessing the data access layer interface includes:
a first generating unit configured to determine a storage location matching the table name information based on the table name information;
the second generation unit is used for generating a data routing parameter table based on the storage position, wherein the data routing parameter table comprises data access mode information matched with the storage position;
a third generating unit, configured to encapsulate target query information and a data routing parameter table for accessing a data access layer interface, and generate a temporary file; and
and the fourth generation unit is used for linking the temporary file with the middleware to generate a target file.
According to an embodiment of the present disclosure, the file generating apparatus 500 further includes:
the third determining module is used for determining format information of the first communication information related to the service layer from the structured query information;
the fourth determining module is used for determining format information of second communication information related to the calling database interface;
and the fourth generation module is used for mapping the format information of the first communication information and the format information of the second communication information to generate a communication mapping table so as to generate a target file based on the target query information, the communication mapping table and the table name information for accessing the data access layer interface.
According to an embodiment of the present disclosure, the file generating apparatus 500 further includes:
a fifth determining module, configured to determine an application program interface instruction from a source program code of the service layer; and
and the fifth generation module is used for converting the application program interface instruction and generating service calling information for calling the middleware system interface so as to generate a target file based on the target query information, the communication mapping table, the service calling information and the table name information for accessing the data access layer interface.
Any number of modules, sub-modules, units, sub-units, or at least part of the functionality of any number thereof according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure may be implemented by being split into a plurality of modules. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least partially as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or by any other reasonable means of hardware or firmware for integrating or packaging a circuit, or by any one of or a suitable combination of any of software, hardware, and firmware. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the disclosure may be at least partially implemented as a computer program module, which when executed may perform the corresponding functions.
For example, any plurality of the first determining module 510, the first generating module 520, the second generating module 530, the second determining module 540 and the third generating module 550 may be combined and implemented in one module/unit/sub-unit, or any one of the modules/units/sub-units may be split into a plurality of modules/units/sub-units. Alternatively, at least part of the functionality of one or more of these modules/units/sub-units may be combined with at least part of the functionality of other modules/units/sub-units and implemented in one module/unit/sub-unit. According to an embodiment of the present disclosure, at least one of the first determining module 510, the first generating module 520, the second generating module 530, the second determining module 540 and the third generating module 550 may be implemented at least partially as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware by any other reasonable manner of integrating or packaging a circuit, or implemented in any one of three implementations of software, hardware and firmware, or in a suitable combination of any of them. Alternatively, at least one of the first determining module 510, the first generating module 520, the second generating module 530, the second determining module 540 and the third generating module 550 may be at least partially implemented as a computer program module, which when executed, may perform a corresponding function.
It should be noted that, the file generation apparatus part in the embodiment of the present disclosure corresponds to the file generation method part in the embodiment of the present disclosure, and the description of the file generation apparatus specifically refers to the file generation method part, which is not described herein again.
FIG. 6 schematically illustrates a block diagram of a computer system suitable for implementing the file generation method described above, in accordance with an embodiment of the present disclosure. The computer system illustrated in FIG. 6 is only one example and should not impose any limitations on the scope of use or functionality of embodiments of the disclosure.
As shown in fig. 6, a computer system 600 according to an embodiment of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. Processor 601 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 601 may also include onboard memory for caching purposes. The processor 601 may comprise a single processing unit or a plurality of processing units for performing the different actions of the method flows according to embodiments of the present disclosure.
In the RAM 603, various programs and data necessary for the operation of the system 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. The processor 601 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM 602 and/or RAM 603. It is to be noted that the programs may also be stored in one or more memories other than the ROM 602 and RAM 603. The processor 601 may also perform various operations of the method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the present disclosure, system 600 may also include an input/output (I/O) interface 605, input/output (I/O) interface 605 also connected to bus 604. The system 600 may also include one or more of the following components connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
According to embodiments of the present disclosure, method flows according to embodiments of the present disclosure may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program, when executed by the processor 601, performs the above-described functions defined in the system of the embodiments of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples may include, but are not limited to: 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), 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 present disclosure, 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.
For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM 602 and/or RAM 603 described above and/or one or more memories other than the ROM 602 and RAM 603.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method provided by embodiments of the present disclosure, when the computer program product is run on an electronic device, the program code being configured to cause the electronic device to carry out the file generation method provided by embodiments of the present disclosure.
The computer program, when executed by the processor 601, performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure. The above described systems, devices, modules, units, etc. may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed in the form of a signal on a network medium, downloaded and installed through the communication section 609, and/or installed from the removable medium 611. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, python, the "C" language, or the like. The program code may execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. 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. Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure are described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (10)

1. A file generation method, comprising:
determining structured query information from source program code of a business layer;
pre-compiling the structured query information to generate query information for calling a database interface;
compiling the query information for calling the database interface to generate target query information for accessing the data access layer interface;
determining table name information from the structured query information, wherein the table name information is used for representing access routing information; and
and generating a target file based on the target query information for accessing the data access layer interface and the table name information.
2. The method of claim 1, wherein said determining table name information from said structured query information comprises:
determining a query type of the structured query information; and
and determining the table name information from the structured query information according to an extraction rule matched with the query type.
3. The method of claim 2, wherein said determining said table name information from said structured query information according to an extraction rule matching said query type comprises:
determining a target field from the structured query information based on the query type; and
determining the table name information from the structured query information based on the target field.
4. The method of claim 1, wherein generating a target file based on the target query information for accessing the data access layer interface and the table name information comprises:
determining a storage location matched with the table name information based on the table name information;
generating a data routing parameter table based on the storage position, wherein the data routing parameter table comprises data access mode information matched with the storage position;
packaging the target query information for accessing the data access layer interface and the data routing parameter table to generate a temporary file; and
and linking the temporary file with the middleware to generate a target file.
5. The method of claim 1, further comprising:
determining format information of first communication information related to the service layer from the structured query information;
determining format information of second communication information related to the calling database interface;
and mapping the format information of the first communication information and the format information of the second communication information to generate a communication mapping table so as to generate a target file based on the target query information for accessing the data access layer interface, the communication mapping table and the table name information.
6. The method of claim 5, further comprising:
determining an application program interface instruction from source program codes of a business layer; and
and converting the application program interface instruction to generate service calling information for calling a middleware system interface so as to generate a target file based on the target query information for accessing the data access layer interface, the communication mapping table, the service calling information and the table name information.
7. A file generation apparatus comprising:
the first determining module is used for determining the structured query information from the source program code of the service layer;
the first generation module is used for pre-compiling the structured query information to generate query information for calling a database interface;
the second generation module is used for compiling the query information for calling the database interface and generating target query information for accessing the data access layer interface;
the second determining module is used for determining table name information from the structured query information, wherein the table name information is used for representing access routing information; and
and the third generation module is used for generating a target file based on the target query information for accessing the data access layer interface and the table name information.
8. An electronic device, comprising:
one or more processors;
a memory to store one or more instructions that,
wherein the one or more instructions, when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
9. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to carry out the method of any one of claims 1 to 6.
10. A computer program product comprising computer executable instructions for implementing the method of any one of claims 1 to 6 when executed.
CN202210997492.0A 2022-08-19 2022-08-19 File generation method and device, electronic equipment and storage medium Pending CN115309404A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210997492.0A CN115309404A (en) 2022-08-19 2022-08-19 File generation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210997492.0A CN115309404A (en) 2022-08-19 2022-08-19 File generation method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115309404A true CN115309404A (en) 2022-11-08

Family

ID=83863510

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210997492.0A Pending CN115309404A (en) 2022-08-19 2022-08-19 File generation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115309404A (en)

Similar Documents

Publication Publication Date Title
CN111221521A (en) Method and device for generating log code, computer system and readable storage medium
CN113419740B (en) Program data stream analysis method and device, electronic equipment and readable storage medium
CN112463729A (en) Data file storage method and device, electronic equipment and medium
CN110109983B (en) Method and device for operating Redis database
CN115982491A (en) Page updating method and device, electronic equipment and computer readable storage medium
CN113515271B (en) Service code generation method and device, electronic equipment and readable storage medium
CN113176907A (en) Interface data calling method and device, computer system and readable storage medium
CN111177089A (en) Method and device for generating log processing code, computer system and storage medium
CN113535565B (en) Interface use case generation method, device, equipment and medium
CN112988604B (en) Object testing method, testing system, electronic device and readable storage medium
CN114780361A (en) Log generation method, device, computer system and readable storage medium
CN115309404A (en) File generation method and device, electronic equipment and storage medium
CN113760262A (en) Task processing method, device, computer system and computer readable storage medium
CN114677114A (en) Approval process generation method and device based on graph dragging
CN113064987A (en) Data processing method, apparatus, electronic device, medium, and program product
CN113032256A (en) Automatic test method, device, computer system and readable storage medium
CN117395314A (en) Request processing method, request processing device, electronic equipment and storage medium
CN115357653A (en) Data processing method and device, electronic equipment and storage medium
CN118210778A (en) Database operation method, apparatus, device, storage medium, and program product
CN116820566A (en) Data processing method, device, electronic equipment and storage medium
CN114385170A (en) Form generation method, device, equipment, medium and program product
CN116627536A (en) Application deployment method and device, electronic equipment and storage medium
CN114237624A (en) Go language-based error processing method, device, equipment, medium and product
CN116821158A (en) Structured query statement generation method and device, electronic equipment and storage medium
CN114817314A (en) Data processing method and device, electronic equipment and storage 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