CN118069723A - Method, device, equipment and medium for converting file format in database - Google Patents

Method, device, equipment and medium for converting file format in database Download PDF

Info

Publication number
CN118069723A
CN118069723A CN202410235196.6A CN202410235196A CN118069723A CN 118069723 A CN118069723 A CN 118069723A CN 202410235196 A CN202410235196 A CN 202410235196A CN 118069723 A CN118069723 A CN 118069723A
Authority
CN
China
Prior art keywords
code
target
target language
block
grammar
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
CN202410235196.6A
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.)
China Construction Bank Corp
CCB Finetech Co Ltd
Original Assignee
China Construction Bank Corp
CCB Finetech Co Ltd
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, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202410235196.6A priority Critical patent/CN118069723A/en
Publication of CN118069723A publication Critical patent/CN118069723A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method, a device, equipment and a medium for converting file formats in a database, and relates to the technical field of big data. One embodiment of the method comprises the following steps: analyzing a storage process according to a storage process name to obtain a variable declaration part, an execution part and an exception handling part, and analyzing the execution part and the exception handling part according to the variable declaration part to obtain an object code; mapping to obtain keywords of a single sentence aiming at the single sentence in the target code, and circularly analyzing the keywords of the target code aiming at the grammar block in the target code; and matching to obtain a target language code block according to the keywords of the single statement and the keywords of the target code, and assembling the target language code block to realize conversion of a file format. This embodiment can shorten the time required for converting the stored procedure to other code.

Description

Method, device, equipment and medium for converting file format in database
Technical Field
The present invention relates to the field of big data technologies, and in particular, to a method, an apparatus, a device, and a medium for converting a file format in a database.
Background
Currently, the digital wave trend promotes the integration of digital economy and entity economy, and in the information technology application innovation, i.e. the credit creation process, more enterprises realize the importance of data platforms to business growth and innovation.
The Oracle database is used in many cases during the use of the database. The storage process of the Oracle database is a SQL statement set used for completing specific functions in a large database system and is stored in the database.
In the process of implementing the present invention, the inventor finds that at least the following problems exist in the prior art: the conversion of the stored procedures of the Oracle database into other codes takes a long time to realize.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, apparatus, device, and computer readable medium for converting a file format in a database, which can reduce the time required for converting a storage process into other codes.
To achieve the above object, according to one aspect of the embodiments of the present invention, there is provided a method of converting a file format in a database, including:
Analyzing a storage process according to a storage process name to obtain a variable declaration part, an execution part and an exception handling part, and analyzing the execution part and the exception handling part according to the variable declaration part to obtain an object code;
Mapping to obtain keywords of a single sentence aiming at the single sentence in the target code, and circularly analyzing the keywords of the target code aiming at the grammar block in the target code;
And matching to obtain a target language code block according to the keywords of the single statement and the keywords of the target code, and assembling the target language code block to realize conversion of a file format.
The analyzing the stored procedure according to the stored procedure name to obtain a variable declaration part, an execution part and an exception handling part, and analyzing the execution part and the exception handling part according to the variable declaration part to obtain an object code, comprising:
analyzing the storage process according to the name of the storage process to obtain the keyword information of the storage process, and identifying a variable declaration part, an execution part and an exception handling part by using the keyword information;
And analyzing the execution part and the exception processing part according to the variable declaration part to obtain target codes.
Before the stored procedure is analyzed according to the name of the stored procedure to obtain the variable declaration part, the execution part and the exception handling part, the method further comprises the following steps:
And configuring a database connection string according to the stored procedure name to derive a stored procedure file according to the stored procedure name, wherein the stored procedure file comprises the stored procedure.
The analyzing the executing part and the exception handling part according to the variable declaration part to obtain an object code, comprising:
According to the variable declaration part, analyzing codes of the execution part to obtain a single statement of the execution part and a grammar block of the execution part;
According to the variable declaration part, analyzing codes of the exception handling part to obtain a single statement of the exception handling part and a grammar block of the exception handling part;
The single statement of the execution part and the single statement of the exception handling part are taken as single statements in the target code, and the grammar block of the execution part and the grammar block of the exception handling part are taken as grammar blocks in the target code, wherein the target code comprises the single statement in the target code and the grammar block in the target code.
The mapping, for a single statement in the target code, a keyword of the single statement, and circularly analyzing, for a grammar block in the target code, the keyword of the target code, including:
mapping to obtain keywords of a single sentence aiming at the single sentence in the target code;
and circularly analyzing the grammar blocks in the target code into the keywords of the target code, and recording the times of the keywords of the target code.
The matching according to the keywords of the single sentence and the keywords of the target code to obtain a target language code block, and assembling the target language code block to realize the conversion of the file format, including:
obtaining a target language sentence code block according to the keyword matching of the single sentence, and obtaining a target language grammar code block according to the keyword matching of the target code;
and sequentially assembling the target language sentence code blocks and the contents of the target language grammar code blocks to obtain files in a target language format so as to realize conversion of the file format.
The step of sequentially assembling the target language sentence code blocks and the contents of the target language grammar code blocks to obtain files in a target language format so as to realize conversion of the file format, wherein the step of sequentially assembling the files in the target language format comprises the following steps:
Converting the input parameters in the variable declaration section into variables in the target language format;
And sequentially assembling the target language format variable, the target language sentence code block and the content of the target language grammar code block to obtain a file in the target language format so as to realize conversion of the file format.
According to a second aspect of an embodiment of the present invention, there is provided an apparatus for converting a file format in a database, including:
The analysis module is used for analyzing the storage process according to the name of the storage process to obtain a variable declaration part, an execution part and an exception handling part, and analyzing the execution part and the exception handling part according to the variable declaration part to obtain a target code;
The mapping module is used for mapping a single statement in the target code to obtain a keyword of the single statement, and circularly analyzing the grammar block in the target code into the keyword of the target code;
And the conversion module is used for obtaining a target language code block by matching according to the keywords of the single statement and the keywords of the target code, and assembling the target language code block to realize the conversion of the file format.
According to a third aspect of an embodiment of the present invention, there is provided an electronic device for converting a file format in a database, 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 as described above.
According to a fourth aspect of embodiments of the present invention, there is provided a computer readable medium having stored thereon a computer program which when executed by a processor implements a method as described above.
According to a fifth aspect of embodiments of the present invention, there is provided a computer program product comprising a computer program which, when executed by a processor, implements a method as provided by embodiments of the present invention.
One embodiment of the above invention has the following advantages or benefits: analyzing a storage process according to a storage process name to obtain a variable declaration part, an execution part and an exception handling part, and analyzing the execution part and the exception handling part according to the variable declaration part to obtain an object code; mapping to obtain keywords of a single sentence aiming at the single sentence in the target code, and circularly analyzing the keywords of the target code aiming at the grammar block in the target code; and matching to obtain a target language code block according to the keywords of the single statement and the keywords of the target code, and assembling the target language code block to realize conversion of a file format. By splitting the stored procedure into multiple parts and then converting each part into a target language code block to convert the file format, the time taken for converting the stored procedure to other code can be 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 flow diagram of a method for converting file formats in a database according to an embodiment of the present invention;
FIG. 2 is a flow diagram of the resolution execution portion and exception handling portion getting object code according to an embodiment of the present invention;
FIG. 3 is a flow diagram of a parse execution portion and an exception handling portion according to a variable declaration portion according to an embodiment of the present invention;
FIG. 4 is a flow diagram of processing a single statement and grammar block in accordance with an embodiment of the invention;
FIG. 5 is a flow diagram of matching resulting target language code blocks according to an embodiment of the present invention;
FIG. 6 is a flow diagram of assembling target language code blocks according to an embodiment of the invention;
FIG. 7 is a schematic diagram of the main structure of an apparatus for converting file formats in a database according to an embodiment of the present invention;
FIG. 8 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
fig. 9 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 application will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present application 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 application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness. The technical scheme of the application obtains, stores, uses, processes and the like the data, which all meet the relevant regulations of national laws and regulations.
At present, the storage process of the Oracle original database is converted into the storage sentences of other databases, and some databases do not support the storage process, so that the scheme has limited use scenarios.
And secondly, the storage process of the Oracle database is converted into a java file, so that code files of other languages cannot be generated, and the method is not flexible and universal. The java file is not flexible enough to realize the storage process, and is very complex to realize for the complex storage process. Such as: in some application scenarios, java implemented by Oracle code on one line may be implemented by writing hundreds of lines, and complexity increases dramatically.
Therefore, converting the stored procedures of the Oracle database into other codes takes a long time to realize.
In order to solve the technical problem that the time consumption for realizing the conversion of the storage process of the Oracle database into other codes is long, the following technical scheme in the embodiment of the invention can be adopted.
Referring to fig. 1, fig. 1 is a schematic flow chart of a method for converting a file format in a database according to an embodiment of the present invention, and a storage process is parsed to obtain a plurality of parts, and each part is converted into a target language code block based on the part, so as to further realize the conversion of the file format. As shown in fig. 1 and 100, the method specifically comprises the following steps:
S101, analyzing the storage process according to the name of the storage process to obtain a variable declaration part, an execution part and an exception handling part, and analyzing the execution part and the exception handling part according to the variable declaration part to obtain the target code.
In the embodiment of the invention, other codes are converted aiming at the storage process of the Oracle database, and the storage process can be analyzed according to the name of the storage process to obtain a variable declaration part, an execution part and an exception handling part. Then, according to the variable declaration section, the execution section and the exception handling section are parsed to obtain the object code.
In one embodiment of the invention, the storage process needs to be acquired before it is parsed. The database connection string is configured according to the stored procedure name to derive a stored procedure file according to the stored procedure name, the stored procedure file comprising the stored procedure.
Specifically, the conversion file format is implemented according to the stored procedure name and the target language. As one example, a convert file format request is received, the convert file format request including a stored procedure name and a target language. Such as: the target language includes: groovy code, python code, and java code.
The stored procedure name identifies the stored procedure by which the stored procedure can be obtained. Specifically, the database connection string is configured according to the stored procedure name to derive a stored procedure file according to the stored procedure name, the stored procedure file including the stored procedure.
As one example, the stored procedure file includes a proc file. The proc file is stored in a designated directory, and the proc file of the stored process file is loaded in an offline state, read according to a line and stored in a list array. Thus, after proc files are acquired from the list array, the storage process can be analyzed.
Referring to fig. 2 and 200, fig. 2 is a schematic flow chart of the object code obtained by the parsing executing part and the exception handling part according to an embodiment of the present invention. The method specifically comprises the following steps:
s201, analyzing the storage process according to the name of the storage process to obtain the keyword information of the storage process, and identifying a variable declaration part, an execution part and an exception handling part by using the keyword information.
And analyzing the storage process according to the name of the storage process, so that the keyword information of the storage process can be obtained. The key information of the stored procedure identifies SQL statements belonging to different parts. Then, the variable declaration section, the execution section, and the exception handling section can be identified using the keyword information.
The variable declaration section includes definition variables and variable taking values. The execution portion includes storing process body content and SQL collections. The exception handling portion includes a SQL collection that stores process exception handling.
S202, analyzing the execution part and the exception handling part according to the variable declaration part to obtain the target code.
After knowing the variable declaration section, the execution section, and the exception handling section, the object code can be obtained by parsing the execution section and the exception handling section by the variable declaration section.
Referring to fig. 3, 300, fig. 3 is a schematic flow diagram of an execution part and an exception handling part according to a variable declaration part according to an embodiment of the present invention. The method specifically comprises the following steps:
S301, analyzing codes of the execution part according to the variable declaration part to obtain a single statement of the execution part and a grammar block of the execution part.
In the embodiment of the present invention, in order to increase the speed of the analysis executing section and the abnormality processing section, the executing section is analyzed and the abnormality processing section is analyzed, respectively.
Specifically, the code of the execution portion may be parsed according to the variable declaration portion, resulting in a single statement of the execution portion and a grammar block of the execution portion.
As one example, a single statement includes update, delete, merge, select, insert, and a select into type portion. The syntax blocks include a loop syntax block, a case syntax block, cursor syntax block, a while syntax block, and an if syntax block. Wherein the grammar blocks may be combined and/or nested for use to form new grammar blocks.
S302, analyzing codes of the exception handling part according to the variable declaration part to obtain a single statement of the exception handling part and a grammar block of the exception handling part.
In one embodiment of the present invention, the code of the exception handling portion may be parsed according to the variable declaration portion to obtain a single statement of the exception handling portion and a grammar block of the exception handling portion.
The execution unit and the exception processing unit analyze the data respectively, and the analysis processes can be executed in parallel or sequentially.
S303, taking a single statement of the execution part and a single statement of the exception handling part as single statements in the target code, and taking a grammar block of the execution part and a grammar block of the exception handling part as grammar blocks in the target code, wherein the target code comprises the single statement in the target code and the grammar blocks in the target code.
After determining the single statement of the execution section and the single statement of the exception processing section, the single statement of the execution section and the single statement of the exception processing section are taken as single statements in the object code. After knowing the grammar blocks of the execution part and the grammar blocks of the exception handling part, the grammar blocks of the execution part and the grammar blocks of the exception handling part are taken as grammar blocks in the target code. The object code includes a single statement in the object code and a grammar block in the object code.
In the embodiment of fig. 3, the execution section and the exception handling section are parsed in terms of the variable declaration section, respectively, thereby increasing the speed of obtaining the object code.
S102, mapping to obtain keywords of a single statement aiming at the single statement in the target code, and circularly analyzing the grammar blocks in the target code into the keywords of the target code.
In embodiments of the present invention, corresponding processing may be employed for a single statement and grammar block. For a single statement in the target code, mapping to obtain the keywords of the single statement, and circularly analyzing the keywords of the target code for the grammar blocks in the target code.
Referring to fig. 4, 400, fig. 4 is a schematic flow diagram of processing a single statement and grammar block in accordance with an embodiment of the invention. The method specifically comprises the following steps:
S401, mapping to obtain keywords of a single statement aiming at the single statement in the target code.
For a single statement in the object code, the keywords of the single statement can be obtained through mapping. As one example, by presetting a correspondence between two sets, one set includes a single sentence and the other set includes a keyword. And mapping to obtain the keywords of the single statement through the corresponding relation.
S402, circularly analyzing the grammar blocks in the target code into the keywords of the target code, and recording the times of the keywords of the target code.
For the grammar blocks in the target code, the keywords of the target code are analyzed in a circulating way. And records the number of times of the key word of the object code. As one example, a key of the object code is obtained by loop parsing, and the number of times of the key is recorded. Such as: and the keyword a is obtained 5 times after the grammar block is circularly analyzed.
In the embodiment of FIG. 4, for a single statement and grammar block in the object code, the keywords of the single statement and the keywords of the object code are parsed.
S103, matching to obtain a target language code block according to the keywords of the single statement and the keywords of the target code, and assembling the target language code block to realize conversion of the file format.
After the keywords of the single statement and the keywords of the target codes are determined, the target language code blocks can be obtained by matching according to the keywords of the single statement and the keywords of the target codes. The target language code blocks are then assembled to obtain a file of the target language.
Referring to fig. 5, 500, fig. 5 is a schematic flow chart of matching the target language code blocks according to an embodiment of the present invention. The method specifically comprises the following steps:
s501, obtaining a target language sentence code block according to the keyword matching of the single sentence, and obtaining a target language grammar code block according to the keyword matching of the target code.
And carrying out matching processing on each keyword to obtain the target language code module. Specifically, a target language sentence code block is obtained according to the keyword matching of a single sentence, and a target language grammar code block is obtained according to the frequency matching of the keyword of the target code and the keyword of the target code.
S502, sequentially assembling the files in the target language format according to the contents of the target language sentence code blocks and the target language grammar code blocks so as to realize conversion of the file format.
After the target language sentence code block and the target language grammar code block are determined, the files in the target language format can be obtained by sequentially assembling according to the contents of the target language sentence code block and the target language grammar code block so as to realize the conversion of the file format.
Referring to fig. 6, fig. 6 is a flow chart illustrating assembly of target language code blocks according to an embodiment of the present invention. The method specifically comprises the following steps:
s601, converting the input parameters in the variable declaration part into variables in a target language format.
In an embodiment of the present invention, it is contemplated that the variable declaration portion includes defining variables and variable values. The input parameters in the variable declaration section can be directly converted into variables in the target language format. Wherein the input parameters in the variable declaration section include defining variables and variable values.
As one example, the input parameters in the variable declaration section are directly taken as variables in the target language format.
Wherein the variables in the target language format belong to the variable declarations of the target language.
S602, sequentially assembling the target language format variable, the target language sentence code block and the content of the target language grammar code block to obtain a file in the target language format so as to realize conversion of the file format.
Variables in the target language format belong to the variable declaration of the target language. The contents to which the target language sentence code block and the target language grammar code block belong are determined, that is, the target language sentence code block and the target language grammar code block included in the execution portion are determined. And determining a target language sentence code block and a target language grammar code block included in the variable declaration section.
As an example, the current content is determined according to the original content of the target language sentence code block and the target language grammar code block. Such as: the target language sentence code block previously belongs to the execution portion, and the content to which the target language sentence code block currently belongs is determined to comprise the execution portion. The target language sentence code block belongs to an exception handling part before, and the content to which the target language sentence code block belongs currently is determined to comprise the exception handling part.
According to the variable of the target language format, the target language sentence code block and the content of the target language grammar code block, sequentially loading the variable declaration part, the execution part and the exception processing part to obtain the file of the target language format so as to realize the conversion of the file format.
In the embodiment of FIG. 6, files in the target language format are assembled sequentially to effect conversion of the file format
In the embodiment of the invention, a storage process is analyzed according to a storage process name to obtain a variable declaration part, an execution part and an exception handling part, and the execution part and the exception handling part are analyzed according to the variable declaration part to obtain an object code; mapping to obtain keywords of a single sentence aiming at the single sentence in the target code, and circularly analyzing the keywords of the target code aiming at the grammar block in the target code; and matching to obtain a target language code block according to the keywords of the single statement and the keywords of the target code, and assembling the target language code block to realize conversion of a file format. By splitting the stored procedure into multiple parts and then converting each part into a target language code block to convert the file format, the time taken for converting the stored procedure to other code can be reduced.
By adopting the technical scheme in the embodiment of the invention, the stored process can be converted into a plurality of flexible executable codes, such as: groovy code, python code, java code, etc., minimizes the modification of the storage process while solving the execution performance problem.
Referring to fig. 7, fig. 7 is a schematic diagram of the main structure of an apparatus for converting a file format in a database according to an embodiment of the present invention, where the apparatus for converting a file format in a database may implement a method for converting a file format in a database, as shown in fig. 7 and 700, the apparatus for converting a file format in a database specifically includes:
The parsing module 701 is configured to parse a storage procedure according to a name of the storage procedure to obtain a variable declaration portion, an execution portion, and an exception handling portion, and parse the execution portion and the exception handling portion according to the variable declaration portion to obtain a target code;
a mapping module 702, configured to map, for a single statement in the target code, a keyword of the single statement, and circularly parse, for a grammar block in the target code, the keyword of the target code;
the conversion module 703 is configured to match the keywords of the single sentence with the keywords of the target code to obtain a target language code block, and assemble the target language code block to implement conversion of the file format.
In one embodiment of the present invention, the parsing module 701 is specifically configured to parse the storage process according to the name of the storage process to obtain key information of the storage process, and identify a variable declaration portion, an execution portion and an exception handling portion by using the key information;
And analyzing the execution part and the exception processing part according to the variable declaration part to obtain target codes.
In one embodiment of the present invention, the parsing module 701 is further configured to configure a database connection string according to the stored procedure name, so as to derive a stored procedure file according to the stored procedure name, where the stored procedure file includes the stored procedure.
In one embodiment of the present invention, the parsing module 701 is specifically configured to parse the code of the execution portion according to the variable declaration portion, so as to obtain a single statement of the execution portion and a grammar block of the execution portion;
According to the variable declaration part, analyzing codes of the exception handling part to obtain a single statement of the exception handling part and a grammar block of the exception handling part;
The single statement of the execution part and the single statement of the exception handling part are taken as single statements in the target code, and the grammar block of the execution part and the grammar block of the exception handling part are taken as grammar blocks in the target code, wherein the target code comprises the single statement in the target code and the grammar block in the target code.
In one embodiment of the present invention, the mapping module 702 is specifically configured to map, for a single statement in the object code, a keyword of the single statement;
and circularly analyzing the grammar blocks in the target code into the keywords of the target code, and recording the times of the keywords of the target code.
In one embodiment of the present invention, the conversion module 703 is specifically configured to obtain a target language sentence code block according to the keyword matching of the single sentence, and obtain a target language grammar code block according to the keyword matching of the target code;
and sequentially assembling the target language sentence code blocks and the contents of the target language grammar code blocks to obtain files in a target language format so as to realize conversion of the file format.
In one embodiment of the present invention, the conversion module 703 is specifically configured to convert the input parameters in the variable declaration portion into the variables in the target language format;
And sequentially assembling the target language format variable, the target language sentence code block and the content of the target language grammar code block to obtain a file in the target language format so as to realize conversion of the file format.
Fig. 8 illustrates an exemplary system architecture 800 of a method of converting a file format in a database or an apparatus for converting a file format in a database to which embodiments of the present invention may be applied.
As shown in fig. 8, a system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. The network 804 serves as a medium for providing communication links between the terminal devices 801, 802, 803 and the server 805. The network 804 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 805 through the network 804 using the terminal devices 801, 802, 803 to receive or send messages or the like. 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 801, 802, 803.
The terminal devices 801, 802, 803 may be a variety of 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 805 may be a server providing various services, such as a background management server (by way of example only) that provides support for shopping-type websites browsed by users using the terminal devices 801, 802, 803. The background management server may analyze and process the received data such as the product information query request, and feedback the processing result (e.g., the target push information, the product information—only an example) to the terminal device.
It should be noted that, the method for converting the file format in the database provided by the embodiment of the present invention is generally executed by the server 805, and accordingly, the device for converting the file format in the database is generally disposed in the server 805.
It should be understood that the number of terminal devices, networks and servers in fig. 8 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
A computer program product according to an embodiment of the present invention includes a computer program that, when executed by a processor, implements a method for converting a file format in a database according to an embodiment of the present invention.
Referring now to FIG. 9, there is illustrated a schematic diagram of a computer system 900 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 9 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. 9, the computer system 900 includes a Central Processing Unit (CPU) 901, which can execute various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 902 or a program loaded from a storage section 908 into a Random Access Memory (RAM) 903. In the RAM 903, various programs and data necessary for the operation of the system 900 are also stored. The CPU 901, ROM 902, and RAM 903 are connected to each other through a bus 904. An input/output (I/O) interface 905 is also connected to the bus 904.
The following components are connected to the I/O interface 905: an input section 906 including a keyboard, a mouse, and the like; an output portion 907 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage portion 908 including a hard disk or the like; and a communication section 909 including a network interface card such as a LAN card, a modem, or the like. The communication section 909 performs communication processing via a network such as the internet. The drive 910 is also connected to the I/O interface 905 as needed. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on the drive 910 so that a computer program read out therefrom is installed into the storage section 908 as needed.
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 product 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 the network via the communication portion 909 and/or installed from the removable medium 911. 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) 901.
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 program products 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 parsing module, a mapping module, and a conversion module. The names of these modules do not constitute a limitation on the module itself in some cases, and for example, the parsing module may also be described as "for parsing a stored procedure according to a stored procedure name, obtaining a variable declaration section, an execution section, and an exception handling section, and parsing the execution section and the exception handling section according to the variable declaration section, obtaining an object code".
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:
Analyzing a storage process according to a storage process name to obtain a variable declaration part, an execution part and an exception handling part, and analyzing the execution part and the exception handling part according to the variable declaration part to obtain an object code;
Mapping to obtain keywords of a single sentence aiming at the single sentence in the target code, and circularly analyzing the keywords of the target code aiming at the grammar block in the target code;
And matching to obtain a target language code block according to the keywords of the single statement and the keywords of the target code, and assembling the target language code block to realize conversion of a file format.
According to the technical scheme of the embodiment of the invention, a storage process is analyzed according to the name of the storage process to obtain a variable declaration part, an execution part and an exception handling part, and the execution part and the exception handling part are analyzed according to the variable declaration part to obtain an object code; mapping to obtain keywords of a single sentence aiming at the single sentence in the target code, and circularly analyzing the keywords of the target code aiming at the grammar block in the target code; and matching to obtain a target language code block according to the keywords of the single statement and the keywords of the target code, and assembling the target language code block to realize conversion of a file format. By splitting the stored procedure into multiple parts and then converting each part into a target language code block to convert the file format, the time taken for converting the stored procedure to other code can be 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.
In the technical scheme of the invention, the aspects of acquisition, analysis, use, transmission, storage and the like of the related user personal information all meet the requirements of related laws and regulations, are used for legal and reasonable purposes, are not shared, leaked or sold outside the aspects of legal use and the like, and are subjected to supervision and management of a supervision department. Necessary measures should be taken for the personal information of the user to prevent illegal access to such personal information data, ensure that personnel having access to the personal information data comply with the regulations of the relevant laws and regulations, and ensure the personal information of the user. Once these user personal information data are no longer needed, the risk should be minimized by limiting or even prohibiting the data collection and/or deletion.
User privacy is protected, when applicable, by de-identifying the data, including in some related applications, such as by removing a particular identifier (e.g., date of birth, etc.), controlling the amount or specificity of stored data (e.g., collecting location data at a city level rather than at a specific address level), controlling how the data is stored, and/or other methods.

Claims (11)

1. A method of converting a file format in a database, comprising:
Analyzing a storage process according to a storage process name to obtain a variable declaration part, an execution part and an exception handling part, and analyzing the execution part and the exception handling part according to the variable declaration part to obtain an object code;
Mapping to obtain keywords of a single sentence aiming at the single sentence in the target code, and circularly analyzing the keywords of the target code aiming at the grammar block in the target code;
And matching to obtain a target language code block according to the keywords of the single statement and the keywords of the target code, and assembling the target language code block to realize conversion of a file format.
2. The method for converting a file format in a database according to claim 1, wherein said parsing a stored procedure according to a stored procedure name to obtain a variable declaration section, an execution section, and an exception handling section, and parsing said execution section and said exception handling section according to said variable declaration section to obtain an object code, comprising:
analyzing the storage process according to the name of the storage process to obtain the keyword information of the storage process, and identifying a variable declaration part, an execution part and an exception handling part by using the keyword information;
And analyzing the execution part and the exception processing part according to the variable declaration part to obtain target codes.
3. The method for converting a file format in a database according to claim 1, wherein before parsing the stored procedure according to the stored procedure name to obtain the variable declaration section, the execution section, and the exception handling section, further comprising:
And configuring a database connection string according to the stored procedure name to derive a stored procedure file according to the stored procedure name, wherein the stored procedure file comprises the stored procedure.
4. The method for converting a file format in a database according to claim 2, wherein said parsing said executing section and said exception handling section according to said variable declaration section to obtain object code comprises:
According to the variable declaration part, analyzing codes of the execution part to obtain a single statement of the execution part and a grammar block of the execution part;
According to the variable declaration part, analyzing codes of the exception handling part to obtain a single statement of the exception handling part and a grammar block of the exception handling part;
The single statement of the execution part and the single statement of the exception handling part are taken as single statements in the target code, and the grammar block of the execution part and the grammar block of the exception handling part are taken as grammar blocks in the target code, wherein the target code comprises the single statement in the target code and the grammar block in the target code.
5. The method for converting a file format in a database according to claim 1, wherein the mapping, for a single statement in the object code, to obtain a keyword of the single statement circularly resolves, for a grammar block in the object code, the keyword of the object code, including:
mapping to obtain keywords of a single sentence aiming at the single sentence in the target code;
and circularly analyzing the grammar blocks in the target code into the keywords of the target code, and recording the times of the keywords of the target code.
6. The method for converting file format in database according to claim 1, wherein the matching of the keywords according to the single sentence and the keywords of the target code to obtain a target language code block, and assembling the target language code block to realize the conversion of file format, comprises:
obtaining a target language sentence code block according to the keyword matching of the single sentence, and obtaining a target language grammar code block according to the keyword matching of the target code;
and sequentially assembling the target language sentence code blocks and the contents of the target language grammar code blocks to obtain files in a target language format so as to realize conversion of the file format.
7. The method for converting a file format in a database according to claim 6, wherein the sequentially assembling the files in the target language format according to the contents of the target language sentence code block and the target language grammar code block to achieve the conversion of the file format comprises:
Converting the input parameters in the variable declaration section into variables in the target language format;
And sequentially assembling the target language format variable, the target language sentence code block and the content of the target language grammar code block to obtain a file in the target language format so as to realize conversion of the file format.
8. An apparatus for converting a file format in a database, comprising:
The analysis module is used for analyzing the storage process according to the name of the storage process to obtain a variable declaration part, an execution part and an exception handling part, and analyzing the execution part and the exception handling part according to the variable declaration part to obtain a target code;
The mapping module is used for mapping a single statement in the target code to obtain a keyword of the single statement, and circularly analyzing the grammar block in the target code into the keyword of the target code;
And the conversion module is used for obtaining a target language code block by matching according to the keywords of the single statement and the keywords of the target code, and assembling the target language code block to realize the conversion of the file format.
9. An electronic device for converting a file format in a database, comprising:
One or more processors;
Storage means for storing one or more programs,
When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-7.
10. 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 any of claims 1-7.
11. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any of claims 1-7.
CN202410235196.6A 2024-03-01 2024-03-01 Method, device, equipment and medium for converting file format in database Pending CN118069723A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410235196.6A CN118069723A (en) 2024-03-01 2024-03-01 Method, device, equipment and medium for converting file format in database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410235196.6A CN118069723A (en) 2024-03-01 2024-03-01 Method, device, equipment and medium for converting file format in database

Publications (1)

Publication Number Publication Date
CN118069723A true CN118069723A (en) 2024-05-24

Family

ID=91110674

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410235196.6A Pending CN118069723A (en) 2024-03-01 2024-03-01 Method, device, equipment and medium for converting file format in database

Country Status (1)

Country Link
CN (1) CN118069723A (en)

Similar Documents

Publication Publication Date Title
CN109492053B (en) Method and device for accessing data
CN109522341B (en) Method, device and equipment for realizing SQL-based streaming data processing engine
CN107203574B (en) Aggregation of data management and data analysis
CN113760948A (en) Data query method and device
CN110858202A (en) Method and device for generating where clause in database query statement
US10726004B2 (en) Enterprise integration processing for mainframe COBOL programs
CN108959294B (en) Method and device for accessing search engine
CN113419740A (en) Program data stream analysis method and device, electronic device and readable storage medium
US10657188B2 (en) Representational state transfer resource collection management
CN116775613A (en) Data migration method, device, electronic equipment and computer readable medium
CN113468529B (en) Data searching method and device
CN116010461A (en) Data blood relationship analysis method and device, storage medium and electronic equipment
CN118069723A (en) Method, device, equipment and medium for converting file format in database
CN113704222A (en) Method and device for processing service request
CN113779018A (en) Data processing method and device
CN113127416A (en) Data query method and device
CN111427938B (en) Data transfer method and device
CN115994151B (en) Data request changing method, device, electronic equipment and computer readable medium
CN113900895B (en) Information processing method, information processing apparatus, storage medium, and electronic device
CN112965946B (en) Method, device, equipment and computer readable medium for processing document
CN115563183B (en) Query method, query device and program product
CN110807089B (en) Question answering method and device and electronic equipment
CN113760943A (en) Business report processing method and device
CN115964052A (en) Data processing method and device, electronic equipment and computer readable medium
CN118132082A (en) Method, apparatus, device and computer readable medium for processing bill

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination