CN114064118A - Code migration method, device, equipment, storage medium and program product - Google Patents

Code migration method, device, equipment, storage medium and program product Download PDF

Info

Publication number
CN114064118A
CN114064118A CN202111404219.4A CN202111404219A CN114064118A CN 114064118 A CN114064118 A CN 114064118A CN 202111404219 A CN202111404219 A CN 202111404219A CN 114064118 A CN114064118 A CN 114064118A
Authority
CN
China
Prior art keywords
path
database
file
mapping table
source
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
CN202111404219.4A
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.)
CCB Finetech Co Ltd
Original Assignee
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 CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202111404219.4A priority Critical patent/CN114064118A/en
Publication of CN114064118A publication Critical patent/CN114064118A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting
    • 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/11File system administration, e.g. details of archiving or snapshots
    • G06F16/119Details of migration of file systems
    • 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

Landscapes

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

Abstract

The application provides a method, a device, equipment, a storage medium and a program product for code migration, which relate to the technical field of computer resource management and comprise the following steps: acquiring a preset path mapping table and a database language mapping table corresponding to a file to be migrated; the path mapping table comprises a mapping relation between a source path and a target path; migrating files under a source path in a source end to a target path of a target end according to a path mapping table; and converting the database configuration file migrated to the target end from the language suitable for the first database to the language suitable for the second database according to the database language mapping table. According to the scheme, the codes to be migrated are automatically migrated by utilizing the preset path mapping table and the database language mapping table corresponding to the files to be migrated, codes do not need to be rewritten, the method is simple, convenient and quick, the code migration efficiency is improved, and the migrated code quality can be guaranteed.

Description

Code migration method, device, equipment, storage medium and program product
Technical Field
The present disclosure relates to the field of computer resource management technologies, and in particular, to a method, an apparatus, a device, a storage medium, and a program product for code migration.
Background
Today, with new technology emerging, systems are also under pressure for continuous iteration at the technical level. Many times, the system needs to perform code migration with substantially no change in the business scenario.
In the prior art, the traditional code migration is to face the syntax of Structured Query Language (SQL) of a database at a code layer and perform rewrite reconstruction on system application program code.
However, this method requires rewriting the code, which is time-consuming and labor-consuming, and the efficiency of code migration is low.
Disclosure of Invention
The present disclosure provides a method, an apparatus, a device, a storage medium, and a program product for code migration, so as to solve the problems that in the prior art, a code needs to be rewritten, which is time-consuming and labor-consuming, and the efficiency of code migration is very low.
According to a first aspect of the present application, there is provided a method of code migration, including:
acquiring a preset path mapping table and a database language mapping table corresponding to a file to be migrated; the path mapping table comprises a mapping relation between a source path and a target path, and the file to be migrated is stored under the source path of the source end; the database language mapping table comprises a mapping relation between a language suitable for a first database and a language suitable for a second database;
migrating the file under the source path in the source end to the target path of the target end according to the path mapping table until the file under the source path in the path mapping table is migrated completely; the files under the source path comprise class files and database configuration files;
and if the file transferred to the target end comprises the database configuration file, converting the database configuration file transferred to the target end from the language suitable for the first database into the language suitable for the second database according to the database language mapping table.
According to a second aspect of the present application, there is provided an apparatus for code migration, comprising:
the system comprises an acquisition unit, a storage unit and a migration unit, wherein the acquisition unit is used for acquiring a preset path mapping table and a database language mapping table corresponding to a file to be migrated; the path mapping table comprises a mapping relation between a source path and a target path, and the file to be migrated is stored under the source path of the source end; the database language mapping table comprises a mapping relation between a language suitable for a first database and a language suitable for a second database;
an application program migration unit, configured to migrate, according to the path mapping table, a file in the source path in the source end to a target path in a target end until the file in the source path included in the path mapping table is migrated; the files under the source path comprise class files and database configuration files;
and the database migration unit is used for converting the database configuration file migrated to the target end from a language suitable for a first database to a language suitable for a second database according to the database language mapping table if the file migrated to the target end comprises the database configuration file.
According to a third aspect of the present application, there is provided an electronic device comprising a memory and a processor; wherein the content of the first and second substances,
the memory for storing a computer program;
the processor is configured to read the computer program stored in the memory, and execute the code migration method according to the first aspect.
According to a fourth aspect of the present application, there is provided a computer-readable storage medium having stored therein computer-executable instructions that, when executed by a processor, implement the method of code migration according to the first aspect.
According to a fifth aspect of the present application, there is provided a computer program product comprising a computer program which, when executed by a processor, performs the method of code migration as described in the first aspect.
The application provides a method, a device, equipment, a storage medium and a program product for code migration, which comprise the following steps: acquiring a preset path mapping table and a database language mapping table corresponding to a file to be migrated; the path mapping table comprises a mapping relation between a source path and a target path, and a file to be migrated is stored under the source path of the source end; the database language mapping table comprises a mapping relation between a language suitable for the first database and a language suitable for the second database; migrating the file under the source path in the source end to the target path of the target end according to the path mapping table until the file under the source path in the path mapping table is migrated completely; the files under the source path comprise class files and database configuration files; and if the file migrated to the target end comprises the database configuration file, converting the database configuration file migrated to the target end from the language suitable for the first database into the language suitable for the second database according to the database language mapping table. According to the code migration method, the device, the equipment, the storage medium and the program product, the codes to be migrated are automatically migrated by utilizing the preset path mapping table and the database language mapping table corresponding to the files to be migrated, codes do not need to be rewritten, simplicity and rapidness are achieved, the code migration efficiency is improved, and the migrated code quality can be guaranteed.
Drawings
FIG. 1 is a flowchart illustrating a method of code migration in accordance with an exemplary embodiment of the present application;
FIG. 2 is a flowchart illustrating a method of primary code migration in accordance with an exemplary embodiment of the present application;
FIG. 3 is a flowchart illustrating a method of subsequent code migration in accordance with an exemplary embodiment of the present application;
FIG. 4 is a block diagram illustrating an apparatus for code migration in accordance with an exemplary embodiment of the present application;
FIG. 5 is a block diagram illustrating an apparatus for code migration in accordance with another exemplary embodiment of the present application;
fig. 6 is a block diagram of an electronic device according to an exemplary embodiment of the present application.
Detailed Description
Today, with new technology emerging, systems are also under pressure for continuous iteration at the technical level. Many times, the system needs to perform code migration with substantially no change in the business scenario. In the prior art, the traditional code migration is to perform rewriting reconstruction on the syntax of SQL and the system application program code at the code level.
However, this method requires rewriting the code, which is time-consuming and labor-consuming, the efficiency of code migration is low, and the quality of the migrated code cannot be controlled.
In order to solve the technical problem, the scheme provided by the application provides a code migration method, the codes to be migrated are automatically migrated by using the preset path mapping table and the database language mapping table corresponding to the files to be migrated, codes do not need to be rewritten, the method is simple, convenient and quick, the code migration efficiency is improved, and the migrated code quality can be ensured.
Fig. 1 is a flowchart illustrating a method for code migration according to an exemplary embodiment of the present application.
As shown in fig. 1, the method for code migration provided by this embodiment includes:
step 101, acquiring a preset path mapping table and a database language mapping table corresponding to a file to be migrated; the path mapping table comprises a mapping relation between a source path and a target path, and a file to be migrated is stored under the source path of the source end; the database language mapping table includes a mapping relationship between a language applicable to the first database and a language applicable to the second database.
The method provided by the present application may be executed by an electronic device with computing capability, for example, a computer or other devices. The electronic equipment can acquire a preset path mapping table and a database language mapping table corresponding to a file to be migrated, and migrate the file to be migrated according to the preset path mapping table and the database language mapping table.
The file to be migrated may include a class file, a configuration file, or a folder under the source path of the source end; the folder may include class files and configuration files. Wherein, one class file can contain one application program of the system. One or more class files may constitute a function of the system.
Specifically, the code migration method provided in this embodiment may be used in an application scenario in which a service scenario is not changed basically, a service logic is not changed, and a program development language is not changed.
For example, the system is originally suitable for distributed logic codes developed by java language, a distributed database oceanbase; the migrated system can be suitable for general centralized logic codes developed by java language, and centralized database oracle. Through migration, the existing business logic can be more conveniently docked with a general centralized system.
The path mapping table may be preset according to a new technology and a service logic, and the path mapping table includes a mapping relationship between a source path and a target path. For example, the source path in the source end has an ncim-web/com/java path, and according to the path mapping table, the target path of the target end corresponding to the source path may be ncim-new/com/ncim/java.
The mapping relationship may be set by a user according to a requirement. For example, a user may determine a storage path of a program code in a target end according to the storage path of the program code in the source end, and further may generate a path mapping table according to the mapping relationship.
Wherein, the database language mapping table can be preset. The database language mapping table includes a mapping relationship between a language applicable to the first database and a language applicable to the second database.
Specifically, the electronic device may convert the language applicable to the first database into the language applicable to the second database according to the database language mapping table. For example, a first database is applied to the source terminal, and a second database is applied to the target terminal, by the method provided by the present disclosure, a configuration file applicable to the first database in the source terminal can be converted into a configuration file applicable to the second database, so that the converted configuration file can be applied to the target terminal.
Step 102, migrating a file under a source path in a source end to a target path of a target end according to a path mapping table until the file under the source path in the path mapping table is migrated; the files under the source path comprise class files and database configuration files.
And the file under the source path in the source end in the path mapping table is the file to be migrated.
The file to be migrated may include a class file, a configuration file, or a folder. Wherein, the class file has a corresponding relation with the configuration file. The configuration file comprises a database configuration file, so that the database configuration file and the class file have a corresponding relation.
Further, if the class file in the file to be migrated has other referenced class files, the other class files may be migrated according to the path mapping table.
In practical application, each file in the source path in the path mapping table may be traversed in the source end, and mapped to the target path corresponding to the target end, for example, if the path mapping table includes the mapping relationship between the source path a and the target path B, the file in the source path a may be mapped to the path B of the target end.
Step 103, if the file migrated to the target includes a database configuration file, converting the database configuration file migrated to the target from a language suitable for the first database to a language suitable for the second database according to the database language mapping table.
Specifically, the electronic device migrates a file under a source path in a source end to a target path of a target end according to a path mapping table; wherein the file under the source path comprises a database configuration file. After the database configuration file is migrated, the electronic device may convert the database configuration file migrated to the target end from the language applicable to the first database to the language applicable to the second database according to the database language mapping table.
Specifically, the code migration method provided in this embodiment may include conversion between standard database language grammars to be suitable for different databases; the standard database language may be SQL, for example. For example, the first database may be oceanbase database developed by SQL; the second database may be an oracle database developed by SQL.
Optionally, the code migration may include an initial code migration and a subsequent code migration. Wherein, the primary code migration refers to the primary code migration of the system; subsequent code migration refers to code migration after the first time by the system, where subsequent code migration may be more than once.
Specifically, after the initial code migration, the source code under the source path of the source end in the path mapping table may modify or add a new class file; the new code under the target path of the corresponding target end may also modify or add a new class file. To enable new code to have new information in the source code, subsequent code migration may occur after the initial code migration, or even multiple subsequent code migrations.
The method for migrating the code comprises the following steps: acquiring a preset path mapping table and a database language mapping table corresponding to a file to be migrated; the path mapping table comprises a mapping relation between a source path and a target path, and a file to be migrated is stored under the source path of the source end; the database language mapping table comprises a mapping relation between a language suitable for the first database and a language suitable for the second database; migrating the file under the source path in the source end to the target path of the target end according to the path mapping table until the file under the source path in the path mapping table is migrated completely; the files under the source path comprise class files and database configuration files; and if the file migrated to the target end comprises the database configuration file, converting the database configuration file migrated to the target end from the language suitable for the first database into the language suitable for the second database according to the database language mapping table. According to the code migration method, the codes to be migrated are automatically migrated by utilizing the preset path mapping table and the database language mapping table corresponding to the files to be migrated, codes do not need to be rewritten, the method is simple, convenient and quick, the code migration efficiency is improved, and the migrated code quality can be guaranteed.
Fig. 2 is a flowchart illustrating a method for primary code migration according to an exemplary embodiment of the present application.
As shown in fig. 2, the method for code migration provided by this embodiment includes:
step 201, acquiring a preset path mapping table and a database language mapping table corresponding to a file to be migrated; the path mapping table comprises a mapping relation between a source path and a target path, and a file to be migrated is stored under the source path of the source end; the database language mapping table includes a mapping relationship between a language applicable to the first database and a language applicable to the second database.
Specifically, step 202 may be executed after step 201, and step 203 may also be executed.
Step 201 is similar to step 101 in implementation manner and principle, and is not described again.
Step 202, if the file under the source path is a class file or a configuration file, the file under the source path is migrated to the target path of the target end until the file under the source path included in the path mapping table is migrated completely.
Wherein, the source path refers to a path of a source end included in the path mapping table.
Specifically, the electronic device may migrate the file in the source path to the target path of the corresponding target end according to the path mapping table.
Specifically, the configuration file in the file under the source path may include a database configuration file; the class file and the configuration file have a corresponding relationship, and therefore, the class file and the database configuration file also have a corresponding relationship.
In practical application, each file in the source path in the path mapping table may be traversed in the source end, and mapped to the target path corresponding to the target end, for example, if the path mapping table includes the mapping relationship between the source path a and the target path B, the file in the source path a may be mapped to the path B of the target end.
Optionally, if all the files in the source path are class files or configuration files, all the files in the source path are migrated to the target path of the target end.
Optionally, if the file under the source path includes a class file or a configuration file, and also includes a folder, the class file and the configuration file under the source path are migrated to the target path of the target end.
Step 203, if the file under the source path is a folder, determining whether the path of the folder belongs to a path mapping table; if the file belongs to the path mapping list, the folder is migrated according to the path mapping list; if not, the folder is migrated to a target path corresponding to the source path in the target end until the file under the source path included in the path mapping table is migrated completely; the files under the source path comprise class files and database configuration files.
Specifically, the file under the source path is a folder, and the folder may include a class file or a configuration file. Wherein the configuration file may comprise a database configuration file; the class file and the configuration file have a corresponding relationship, and therefore, the class file and the database configuration file also have a corresponding relationship.
The path of the folder may be a path under the source end. For example, a source path included in one mapping relation in the path mapping table is ncim-web/com/java; folder a is included under this source path, and the path of folder a can be represented as ncim-web/com/java/a.
Further, whether the path ncim-web/com/java/a under the source end belongs to the path mapping table or not can be determined according to the path mapping table, and if yes, the file in the folder is migrated to a target path corresponding to the source path ncim-web/com/java/a in the target end according to the path mapping table; and if not, migrating the folder to a target path corresponding to the source path ncim-web/com/java in the target end.
Optionally, if the file migrated to the target end includes a class file, determining, according to the content in the class file, another class file referenced by the class file and a source path of the other class file.
For example, it may be determined whether an import statement exists in the class file; and if so, determining other class files referenced by the class files according to the content in the import statement in the class files.
Further, the source path of other class files can be obtained from the import statement in the class file.
It is determined whether the source path of the other class file is included in the path mapping table. If yes, migrating other files in the source end to the target end according to the path mapping table; if not, migrating the other class files in the source end to the position under the path where the class file referencing the other class files is located, and modifying the content in the class file for referencing the other class files according to the path of the other class files in the target end.
For example, the target path of the target end of the class file included in the file to be migrated is ncim-new/com/ncim/java; the import statement exists in the class file, and other class files referenced by the class file can be determined according to the content in the import statement in the class file; the source path of other class files can be obtained from import statements in the class files; determining that the source path of the other class of files is not in the path mapping table according to the path mapping table; then the other files in the source end are migrated to the target path ncim-new/com/ncim/java of the target end.
Specifically, after the other class files are migrated to the target end, the path of the other class files referenced in the import statement in the migrated class files is modified, and the modified path is the target path of the other class files at the target end.
Step 204, if the file migrated to the target includes a database configuration file, converting a first word in the database configuration file migrated to the target into a second word according to a database language mapping table, where the first word is a language suitable for the first database, and the second word is a language suitable for the second database.
Specifically, the syntax of the database language can be transformed according to the database language mapping table to adapt to different databases. For example, the database language may be SQL.
For example, the first database language may be adapted for oceanbase databases and the second database language may be adapted for oracle databases.
Specifically, a first word in a first database language may be translated to a second word in a second database language according to a database language mapping table. And the first words of the language suitable for the first database correspond to the second words of the language suitable for the second database in the database language mapping table one by one.
Fig. 3 is a flowchart illustrating a method of subsequent code migration according to an exemplary embodiment of the present application.
Specifically, after the initial code migration, if the source code of the source end is changed, there may be subsequent code migration as needed. As shown in fig. 3, the method for code migration provided by this embodiment includes:
step 301, determining a target path where the class file is located in the target end.
Specifically, after the initial code migration, the source code of the source end and the target code of the target end may be changed or a new class file may be added.
Specifically, all class files of the target code may be traversed in the target end, and a path of each class file in the target end is determined, that is, a target path where each class file in the target end is located is determined.
Step 302, determining a source path corresponding to the target path according to the path mapping table.
The path mapping table is used in the first code migration.
Specifically, a source path corresponding to a target path of the class file in the target end is determined according to the path mapping table.
Step 303, migrating the same-name class file corresponding to the class file under the source path of the source end to the target path of the target end, so as to cover the original class file under the target path of the target end.
And when the files with the same name are migrated, migrating the configuration files corresponding to the files with the same name at the same time, wherein the configuration files comprise database configuration files.
The same-name class files refer to class files with the same name under a target path in a target end and under a source path in a corresponding source end according to a path mapping table.
Specifically, after the last migration, the class file under the source path in the source end included in the path mapping table may be modified. By the method provided by the embodiment, the modification of the source code in the source end can be conveniently synchronized into the target code of the target end.
And step 304, migrating other class files referenced by the same-name class files according to the path mapping table and the migrated same-name class files.
Optionally, the source path of the other class files referenced by the same-name class file and the other class files may be determined according to the content in the same-name class file after the migration.
For example, it may be determined whether an import statement exists in the class file; and if so, determining other class files referenced by the class files according to the content in the import statement in the class files.
Further, the source path of other class files can be obtained from the import statement in the class file.
Optionally, it is determined whether the path mapping table includes source paths of other class files. If yes, migrating other files in the source end to the target end according to the path mapping table; if not, migrating the other class files in the source end to the position under the path where the class file referencing the other class files is located, and modifying the content in the class file for referencing the other class files according to the path of the other class files in the target end.
For example, after the other class files are migrated to the target end, the path of the other class files referenced in the import statement in the migrated same-name class file is modified, and the modified path is the target path of the other class files at the target end.
Step 305, according to the path mapping table, determining class files with different names under the source path of the source end and the target path of the target end.
If class files are newly added under the source path of the source end included in the path mapping table after the last migration, different named class files can be generated.
Specifically, class files under the source path of the source end included in the path mapping table may be traversed, and compared with class file names under the target path included in the path mapping table, so as to determine class files with different names under the target path of the target end.
And step 306, migrating the class files with different names to the target end according to the path mapping table, and migrating other class files referenced by the class files with different names according to the path mapping table and the migrated class files with different names.
Specifically, if there are configuration files corresponding to different command files under the source path in the source end, the configuration files are also migrated simultaneously with the different command files. Wherein the configuration file may comprise a database configuration file.
Optionally, the source path of the other class files referenced by the different-name class files and the other class files may be determined according to the content in the different-name class files after the migration.
For example, it may be determined whether an import statement exists in the class file; and if so, determining other class files referenced by the class files according to the content in the import statement in the class files.
Further, the source path of other class files can be obtained from the import statement in the class file.
Optionally, it is determined whether the path mapping table includes source paths of other class files. If yes, migrating other files in the source end to the target end according to the path mapping table; if not, migrating the other class files in the source end to the position under the path where the class file referencing the other class files is located, and modifying the content in the class file for referencing the other class files according to the path of the other class files in the target end.
For example, after the other class files are migrated to the target end, the path that refers to the other class files in the import statement in the different named class files after migration is modified, and the path is the target path of the other class files at the target end.
Step 307, converting the first word in the database configuration file migrated to the target into a second word according to the database language mapping table, where the first word is a language suitable for the first database, and the second word is a language suitable for the second database.
Step 307 is similar to step 204 in implementation and principle, and is not described again.
Fig. 4 is a block diagram illustrating an apparatus for code migration according to an exemplary embodiment of the present application.
As shown in fig. 4, the apparatus 400 for code migration provided by the present application includes:
an obtaining unit 410, configured to obtain a preset path mapping table and a database language mapping table corresponding to a file to be migrated; the path mapping table comprises a mapping relation between a source path and a target path, and a file to be migrated is stored under the source path of the source end; the database language mapping table comprises a mapping relation between a language suitable for the first database and a language suitable for the second database;
an application program migration unit 420, configured to migrate, according to the path mapping table, a file in the source path in the source end to the target path in the target end until the file in the source path included in the path mapping table is migrated; the files under the source path comprise class file database configuration files;
the database migration unit 430 is configured to, if the file migrated to the target includes a database configuration file, convert the database configuration file migrated to the target from a language suitable for the first database to a language suitable for the second database according to the database language mapping table.
Fig. 5 is a block diagram of an apparatus for code migration according to another exemplary embodiment of the present application.
As shown in fig. 5, on the basis of the foregoing embodiment, in the apparatus 500 for code migration provided by the present application, the application migration unit 420 includes:
the class file migration module 421 is configured to, if the file in the source path is a class file or a configuration file, migrate the file in the source path to the target path in the target end.
The folder migration module 422 is configured to determine whether a path of a folder belongs to the path mapping table if a file under the source path is a folder; if the file belongs to the path mapping list, the folder is migrated according to the path mapping list; and if not, migrating the folder to a target path corresponding to the source path in the target end.
The application program migration unit 420 is further configured to, if the file migrated to the target end includes a class file, determine, according to content in the class file, another class file referenced by the class file and a source path of the other class file; determining whether a source path of other class files is included in the path mapping table; if yes, migrating other files in the source end to the target end according to the path mapping table; if not, migrating the other class files in the source end to the position under the path where the class file referencing the other class files is located, and modifying the content in the class file for referencing the other class files according to the path of the other class files in the target end.
The database migration unit 430 is specifically configured to convert a first word in the database configuration file migrated to the target into a second word according to the database language mapping table, where the first word is a language suitable for the first database, and the second word is a language suitable for the second database at a single time.
The application program migration unit 420 is further configured to determine a target path where the class file is located in the target end; determining a source path corresponding to the target path according to the path mapping table; migrating the same-name class files corresponding to the class files under the source path of the source end to the target path of the target end so as to cover the original class files under the target path of the target end; and migrating other class files referenced by the same-name class files according to the path mapping table and the migrated same-name class files.
The application program migration unit 420 is further configured to determine, according to the path mapping table, a class file with a name different from that of a class file under the target path of the target end under the source path of the source end; and migrating the class files with different names to a target end according to the path mapping table, and migrating other class files referenced by the class files with different names according to the path mapping table and the migrated class files with different names.
Fig. 6 is a block diagram of an electronic device according to an exemplary embodiment of the present application.
As shown in fig. 6, the electronic device provided in this embodiment includes:
a memory 601;
a processor 602; and
a computer program;
wherein the computer program is stored in the memory 601 and configured to be executed by the processor 602 to implement the method of code migration as any of the above.
The present embodiments also provide a computer-readable storage medium, having stored thereon a computer program,
the computer program is executed by a processor to implement any of the methods of code migration described above.
The present embodiment also provides a computer program product comprising a computer program which, when executed by a processor, implements any of the above-described methods of code migration.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (11)

1. A method of code migration, comprising:
acquiring a preset path mapping table and a database language mapping table corresponding to a file to be migrated; the path mapping table comprises a mapping relation between a source path and a target path, and the file to be migrated is stored under the source path of the source end; the database language mapping table comprises a mapping relation between a language suitable for a first database and a language suitable for a second database;
migrating the file under the source path in the source end to the target path of the target end according to the path mapping table until the file under the source path in the path mapping table is migrated completely; the files under the source path comprise class files and database configuration files;
and if the file transferred to the target end comprises the database configuration file, converting the database configuration file transferred to the target end from the language suitable for the first database into the language suitable for the second database according to the database language mapping table.
2. The method of claim 1, wherein the migrating the file in the source path of the source end to the target path of the target end according to the path mapping table comprises:
and if the file under the source path is a class file or a configuration file, migrating the file under the source path to a target path of the target end.
3. The method of claim 1, wherein the migrating the file in the source path of the source end to the target path of the target end according to the path mapping table comprises: if the file under the source path is a folder, determining whether the path of the folder belongs to the path mapping table; if the file belongs to the path mapping list, the folder is migrated according to the path mapping list;
and if not, migrating the folder to a target path corresponding to the source path in the target end.
4. The method according to claim 2, wherein if the file migrated to the target is a class file, the method further comprises:
determining other class files referenced by the class files and source paths of the other class files according to the contents in the class files;
determining whether a source path of the other class file is included in the path mapping table;
if yes, migrating other files in the source end to a target end according to the path mapping table;
if not, migrating the other class files in the source end to the path where the class file referencing the other class files is located, and modifying the content in the class file for referencing the other class files according to the path of the other class files in the target end.
5. The method according to any one of claims 1-4, wherein said converting the database configuration file migrated to the target from the language applicable to the first database to the language applicable to the second database according to the database language mapping table comprises:
and converting a first word in the database configuration file transferred to the target end into a second word according to the database language mapping table, wherein the first word is a language suitable for a first database, and the second word is a language suitable for a second database.
6. The method of claim 1, further comprising:
determining a target path where the class file is located in the target end;
determining a source path corresponding to the target path according to the path mapping table;
migrating the same-name class files corresponding to the class files under the source path of the source end to the target path of the target end so as to cover the original class files under the target path of the target end;
and migrating other class files referenced by the same-name class files according to the path mapping table and the migrated same-name class files.
7. The method of claim 1, further comprising:
according to the path mapping table, determining class files with different names under a source path of the source end and a target path of the target end;
and migrating the class files with different names to the target end according to the path mapping table, and migrating other class files referenced by the class files with different names according to the path mapping table and the migrated class files with different names.
8. An apparatus for code migration, comprising:
the system comprises an acquisition unit, a storage unit and a migration unit, wherein the acquisition unit is used for acquiring a preset path mapping table and a database language mapping table corresponding to a file to be migrated; the path mapping table comprises a mapping relation between a source path and a target path, and the file to be migrated is stored under the source path of the source end; the database language mapping table comprises a mapping relation between a language suitable for a first database and a language suitable for a second database;
an application program migration unit, configured to migrate, according to the path mapping table, a file in the source path in the source end to a target path in a target end until the file in the source path included in the path mapping table is migrated; the files under the source path comprise class files and database configuration files;
and the database migration unit is used for converting the database configuration file migrated to the target end from a language suitable for a first database to a language suitable for a second database according to the database language mapping table if the file migrated to the target end comprises the database configuration file.
9. An electronic device comprising a memory and a processor; wherein the content of the first and second substances,
the memory for storing a computer program;
the processor is used for reading the computer program stored in the memory and executing the method of any one of the preceding claims 1-7 according to the computer program in the memory.
10. A computer-readable storage medium having computer-executable instructions stored thereon which, when executed by a processor, implement the method of any one of claims 1-7.
11. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, carries out the method of any one of the preceding claims 1-7.
CN202111404219.4A 2021-11-24 2021-11-24 Code migration method, device, equipment, storage medium and program product Pending CN114064118A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111404219.4A CN114064118A (en) 2021-11-24 2021-11-24 Code migration method, device, equipment, storage medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111404219.4A CN114064118A (en) 2021-11-24 2021-11-24 Code migration method, device, equipment, storage medium and program product

Publications (1)

Publication Number Publication Date
CN114064118A true CN114064118A (en) 2022-02-18

Family

ID=80275844

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111404219.4A Pending CN114064118A (en) 2021-11-24 2021-11-24 Code migration method, device, equipment, storage medium and program product

Country Status (1)

Country Link
CN (1) CN114064118A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7484033B1 (en) 2023-10-25 2024-05-16 株式会社インフォース Method, program and information processing device for changing a database management system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7484033B1 (en) 2023-10-25 2024-05-16 株式会社インフォース Method, program and information processing device for changing a database management system

Similar Documents

Publication Publication Date Title
US9792284B2 (en) System, method and computer program product for multilingual content management
CN107122368B (en) Data verification method and device and electronic equipment
US20230161758A1 (en) Distributed Database System and Data Processing Method
CN105205053A (en) Method and system for analyzing database incremental logs
CN110019111B (en) Data processing method, data processing device, storage medium and processor
CN107016016B (en) Data processing method and device
US10248736B1 (en) Data loader and mapper tool
CN106951231B (en) Computer software development method and device
CN110727482B (en) Interface updating method and device
CN110851511A (en) Data synchronization method and device
CN115599764A (en) Method, device and medium for migrating table data
CN114064118A (en) Code migration method, device, equipment, storage medium and program product
US20210342378A1 (en) External storage of unstructured database objects
CN109977317B (en) Data query method and device
CN109068286B (en) Information analysis method, medium and equipment
CN110941471A (en) Method and device for internationalizing basic data of software system
US20190384825A1 (en) Method and device for data protection and computer readable storage medium
CN115658391A (en) Backup recovery method of WAL mechanism based on QianBase MPP database
CN111414226A (en) Method and system for establishing task sandbox
CN115586872A (en) Container mirror image management method, device, equipment and storage medium
CN111241070B (en) Data migration device, method, system and storage medium of cross-CPU architecture
CN114925142A (en) Multi-type database compatibility method, device, equipment and medium of ORM framework
CN112699129A (en) Data processing system, method and device
CN110222105B (en) Data summarization processing method and device
CN115617773A (en) Data migration method, device and system

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