CN111090638B - Comparison method and device for transaction functions in database migration - Google Patents

Comparison method and device for transaction functions in database migration Download PDF

Info

Publication number
CN111090638B
CN111090638B CN201911351967.3A CN201911351967A CN111090638B CN 111090638 B CN111090638 B CN 111090638B CN 201911351967 A CN201911351967 A CN 201911351967A CN 111090638 B CN111090638 B CN 111090638B
Authority
CN
China
Prior art keywords
database
transaction
result
stack
execution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911351967.3A
Other languages
Chinese (zh)
Other versions
CN111090638A (en
Inventor
蔡兵克
张泳
孙雨辰
吴利华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN201911351967.3A priority Critical patent/CN111090638B/en
Publication of CN111090638A publication Critical patent/CN111090638A/en
Application granted granted Critical
Publication of CN111090638B publication Critical patent/CN111090638B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/214Database migration support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2358Change logging, detection, and notification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The invention provides a method and a device for comparing transaction functions in database migration, comprising the following steps: generating a result query statement according to a table name of a database table in a database acquired in advance and each field name in the database table; the database comprises: a target database and a source database; the method comprises the steps of obtaining transaction data from a database table, inputting the transaction data into a transaction unit of the database, and obtaining an execution result, wherein the execution result comprises: query results, new results, delete results, and update results; querying an execution result in the target database and the source database respectively by utilizing the result query statement; and comparing the execution results with transaction functions. The application determines whether migration of data and business logic is successful before and after data migration by executing transaction units in each database before and after migration.

Description

Comparison method and device for transaction functions in database migration
Technical Field
The application belongs to the technical field of database migration, and particularly relates to a method and a device for comparing transaction functions in database migration.
Background
At present, in the fields of finance and communication, foreign databases such as ORACLE, DB2 and the like occupy most markets, but with the development of national information technology industry planning and localization strategy, localization information products which are 'independently controllable, safe, reliable and efficient and available' are gradually and comprehensively used by various industry institutions. Application of ORACLE removal and migration of ORACLE databases to domestic databases has become a mainstream trend. In the process of database migration, how to quickly and effectively automatically check whether the logic execution result (transaction function) of the same transaction in an Oracle database is consistent with the logic execution result (transaction function) in a domestic database becomes a great difficulty, and the problem is a basic guarantee in the process of database domestic substitution. The traditional comparison mode is aimed at comparison of the whole database, and the full data comparison is feasible under the condition of smaller data quantity aiming at common application, but is also a weight level comparison, so that the time consumption is high, the consistency of specific transactions is not easy to accurately compare, and the requirements of fine management in software engineering cannot be met. For applications of the short data volume up to the T-level in the finance industry and the communication industry, the traditional mode obviously does not meet the characteristics and business development requirements of the Internet industry.
Disclosure of Invention
The application provides a comparison method of transaction functions in database migration, which at least solves the problem that the prior art cannot achieve transparency and controllability of transaction migration results in the database migration process.
According to one aspect of the present application, there is provided a method for comparing transaction functions in database migration, comprising:
generating a result query statement according to a table name of a database table in a database acquired in advance and each field name in the database table; the database comprises: a target database and a source database;
the method comprises the steps of obtaining transaction data from a database table, inputting the transaction data into a transaction unit of the database, and obtaining an execution result, wherein the execution result comprises: query results, new results, delete results, and update results;
querying an execution result in the target database and the source database respectively by utilizing the result query statement;
and comparing the execution results with transaction functions.
In one embodiment, generating a result query statement according to a table name of a database table in a pre-acquired database and each field name in the database table includes:
and selecting a query reserved word from the query language library, and connecting and combining the query reserved word, the field name and the table name of the database table by using separators to form a result query statement.
In one embodiment, comparing the execution results to the transaction function includes:
pushing stack to save the execution result;
and comparing the execution results in each stack to obtain a comparison result.
In one embodiment, the pushing stack for storing the execution result includes:
calling out an expected value of a preset execution result and pushing the expected value into an expected value stack;
pushing the execution result in the source database into a source database value stack;
pushing the execution result of the target database into a target database value stack.
In an embodiment, comparing execution results in each stack to obtain a comparison result, including:
and comparing whether the values in the expected value stack, the source library value stack and the target library value stack are consistent, if so, the comparison result is successful, otherwise, the comparison result is failed.
According to another aspect of the present application, there is also provided a device for comparing transaction functions in database migration, including:
a result query statement generating unit, configured to generate a result query statement according to a table name of a database table in a database acquired in advance and each field name in the database table; the database comprises: a target database and a source database;
the transaction execution unit is used for acquiring transaction data from the database table and inputting the transaction data into the transaction unit of the database to obtain an execution result, wherein the execution result comprises: query results, new results, delete results, and update results;
the result query unit is used for querying the execution result in the target database and the source database respectively by utilizing the result query statement;
and the comparison unit is used for comparing the execution results with the transaction functions.
In one embodiment, the result query statement generating unit specifically includes:
and the combination module is used for selecting a query reserved word from the query language library, and connecting and combining the query reserved word, the field name and the table name of the database table by using separators to form a result query statement.
In one embodiment, the alignment unit includes:
the push stack storage module is used for carrying out push stack storage on the execution result;
and the push stack comparison module is used for comparing the execution results in each stack to obtain a comparison result.
In one embodiment, the push save module includes:
the expected value pushing module is used for calling out an expected value of a preset execution result and pushing the expected value into an expected value stack;
the source library value stack pushing module is used for pushing the execution result in the source database into the source library value stack;
and the target library value pushing module is used for pushing the execution result of the target database into the target library value stack.
In one embodiment, the push comparison module specifically includes:
and the value comparison module is used for comparing whether the values in the expected value stack, the source library value stack and the target library value stack are consistent, if so, the comparison result is successful, and if not, the comparison result is failed.
According to the method and the device, the execution results of the transaction units in the source database and the target database are verified to verify that the logical relationship between the data is unchanged before and after data migration, so that the problem of consistency comparison of data transaction functions before and after migration of a single transaction is more flexibly, rapidly and efficiently solved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of a comparison method of transaction functions in database migration provided in the present application.
FIG. 2 is a flow chart of comparing transaction functions performed on execution results in an embodiment of the present application.
Fig. 3 is a flowchart of push saving an execution result in the embodiment of the present application.
Fig. 4 is a block diagram of a comparison device for transaction functions in database migration provided in the present application.
Fig. 5 is a block diagram of the structure of the alignment unit in the embodiment of the present application.
Fig. 6 is a block diagram of a push saving module in an embodiment of the present application.
Fig. 7 is a specific implementation of an electronic device in an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
At present, in the fields of finance and communication, foreign databases such as ORACLE, DB2 and the like occupy most markets, but with the development of national information technology industry planning and localization strategy, localization information products which are 'independently controllable, safe, reliable and efficient and available' are gradually and comprehensively used by various industry institutions, so that data are required to be migrated from the foreign databases such as ORACLE, DB2 and the like to the localization databases. The transaction unit is a functional module existing in foreign databases such as ORACLE and DB2, however, in the process of data migration in the databases, the change of the execution logic of the transaction unit (transaction functional module) may occur, which is not easy to find, so how to automatically check out the data of the same transaction in the foreign databases and domestic databases and whether the execution logic sequence is consistent or not quickly and effectively becomes a great difficulty, and most of the current methods using manual comparison enter two or more databases to compare the data respectively, which is low in efficiency and labor-consuming.
Based on the above-mentioned problems, the present application provides a solution, as shown in fig. 1, which is a method for comparing transaction functions in database migration, and specifically includes the following steps:
s101: generating a result query statement according to a table name of a database table in a database acquired in advance and each field name in the database table; the database comprises: a target database and a source database.
Firstly, a user inputs the name of a transaction unit, the name of a database to be tested, a database table required for the current transaction (function), the precondition of the current transaction, a field required for obtaining an execution result after the current transaction is executed in the transaction unit, and an expected value of the execution result after the current transaction is executed in the transaction unit at an input end (such as a PC end or a mobile phone end). In a specific embodiment, the number of the database to be tested input by the user may be plural, and the number of the database tables to be used may be plural, which is not limited herein. The information input by the user can be stored in the format of EXCEL or XML, the user only needs to input the name of a specific database, and professional database connection pool configuration information is not required to be filled.
After the previous work is completed, the background server acquires the table names of the database table and the field names in the database table from the information input by the user to form an SQL query statement for subsequent query.
S102: the method comprises the steps of obtaining transaction data from a database table, inputting the transaction data into a transaction unit of the database, and obtaining an execution result, wherein the execution result comprises: query results, new results, delete results, and update results.
After the step S101 is completed, the transaction unit needs to be checked. The meaning of transaction units is introduced herein, wherein the transaction units are all provided in a database, and the transaction units in the database are provided with independent business logic and have the capability of expressing a complete transaction action. Before checking the transaction unit, firstly, the type of the database input by the user is acquired, then, a corresponding database driver is configured according to the type of the database to drive the database, then, self-test is carried out, and whether the communication connection between the database and the background server is completely ready is checked.
In a specific embodiment, transaction data needed to be used is obtained from a database table, the transaction data is input into respective transaction units of a target database and a source database, and the transaction units are executed to obtain transaction results of the target database and the source database, wherein the executed operations include, but are not limited to: query, add, delete, and update. After the step S102 is performed, the execution results of the transaction units in the target database and the source database may be obtained, where the transaction data input by the transaction units in the target database and the source database are the same, and therefore, under normal conditions, the execution results obtained by the same transaction units in the target database and the source database should be the same.
S103: and querying the execution results in the target database and the source database respectively by utilizing the result query statement.
The execution results obtained by the execution transaction unit are queried from the target database and the source database, respectively, using the result query statement (SQL query statement) obtained in S101.
S104: and comparing the execution results with transaction functions.
After the execution results of the target database and the source database are queried, the execution results are compared, so that the comparison of transaction functions (transaction units) of the databases is realized, the fact that the transaction functions in the databases are free of errors is ensured, and the transaction execution results are consistent before and after data migration.
The execution main body of the flow shown in fig. 1 can be a server, a PC and a mobile terminal, and the method realizes the function of verifying whether the data of the same transaction in the source database and the target database are consistent by operating the transaction unit in the database, and simultaneously realizes the purpose of verifying whether the execution logic sequence of the data is changed before and after the migration of the data.
In one embodiment, generating a result query statement according to a table name of a database table in a pre-acquired database and each field name in the database table includes:
and selecting a query reserved word from the query language library, and connecting and combining the query reserved word, the field name and the table name of the database table by using separators to form a result query statement.
In a specific embodiment, according to the database table NAME ACCOUNT and field NAMEs (including user NAME, identification card number IDENTIFYID, bank card ACCOUNT number card, and AMOUNT amountj) input by the user, an SQL query statement is assembled, and a reserved word is selected from the SQL language library: SELECT and FROM, then concatenate the reserved word, database table name and field name through the class separator of "comma" and "_", to form an SQL query statement as follows:
SELECT NAME,IDENTIFYID,CARDID,AMOUNT FROM ACCOUNT;
in one embodiment, as shown in fig. 2, comparing the execution results to the transaction functions includes:
s201: and pushing and storing the execution result.
After each database executes the transaction unit to obtain the execution result, the execution result is saved. In a specific embodiment, the execution results are saved by pushing stacks, i.e. the execution results are pushed into different stacks by class.
S202: and comparing the execution results in each stack to obtain a comparison result.
And comparing the execution results (numerical values) stored in each stack according to the rules to obtain comparison results.
In one embodiment, as shown in fig. 3, the pushing stack for saving the execution result includes:
s301: and calling out the expected value of the preset execution result and pushing the expected value into an expected value stack.
S302: pushing the execution result in the source database to a source database value stack.
S303: pushing the execution result of the target database into a target database value stack.
In a specific embodiment, the SQL statement is started to query the execution results of the transaction unit in the source database and the target database respectively by a JDBC method (Java DataBase Connectivity, java database connection), the expected value of the execution result input in advance by the user is pushed into an expected value stack, the execution result of the source database is pushed into a source database value stack, and the execution result of the target database is pushed into a target value stack, where the push situation is as follows:
expected value: jim_220256101107_2220104236_2347.3, this expected value user has already given, and the expected value stack is pushed together with the trade name "CheckAccount" after taking out.
Source library value: the query result in the source library is obtained through the query statement and is connected through a connector "_", the SQL query result is Jim_220256101207_2220104236_2347.3, and the query result and the transaction name "CheckAccount" are pushed into the source library value stack together.
Target library value: the SQL query result is Jim_220256101107_2220104236_2347.3 through the execution result of the query statement in the target library and the connection of a connector "_", and the query result and a transaction name "CheckAccount" are pressed into a target library value stack together. After the stack pressing actions of the three stacks are completed, the inquiry of the execution result of the first transaction unit is completed.
And reading the next transaction unit displayed in the input information of the user in turn, and sequentially executing the processes of S201-S202 until the last transaction unit filled in the input file of the client by the user is executed. The step of comparing the results of the execution of the transaction unit is entered.
In an embodiment, comparing execution results in each stack to obtain a comparison result, including:
and comparing whether the values in the expected value stack, the source library value stack and the target library value stack are consistent, if so, the comparison result is successful, otherwise, the comparison result is failed.
In a specific embodiment, the "expected value stack", "source library value stack" and "target library value stack" are traversed respectively, the execution results of the same transaction unit in the three value stacks are compared respectively by using the transaction unit as an index, if the values of the execution results of the same transaction unit in the three stacks are the same, the successful migration of the target library metadata and business logic of the current transaction unit is indicated, and the verification result is written back into the "comparison result" field of the file filled in by the client by the user at the same time, so that the user can check the execution condition of the current batch of transaction units.
According to the comparison method provided by the application, the same transaction unit is executed in different databases to verify whether the data before and after the database migration and the service logic are successfully migrated, so that the blank of verifying the service logic migration result in the conventional database migration is filled.
Based on the same inventive concept, the embodiments of the present application further provide a comparison device for transaction functions in database migration, which may be used to implement the method described in the foregoing embodiments, as described in the following embodiments. The principle of solving the problem by the comparison device of the transaction function in the database migration is similar to that of the comparison method of the transaction function in the database migration, so that the implementation of the comparison device of the transaction function in the database migration can be referred to the implementation of the comparison method of the transaction function in the database migration, and the repetition is omitted. As used below, the term "unit" or "module" may be a combination of software and/or hardware that implements the intended function. While the system described in the following embodiments is preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
As shown in fig. 4, a comparison device for transaction functions in database migration provided in the present application includes:
a result query sentence generating unit 401, configured to generate a result query sentence according to a table name of a database table in a database acquired in advance and each field name in the database table; the database comprises: a target database and a source database;
the transaction execution unit 402 is configured to obtain transaction data from the database table, and input the transaction data into a transaction unit of the database, to obtain an execution result, where the execution result includes: query results, new results, delete results, and update results;
a result query unit 403, configured to query the target database and the source database for an execution result using the result query statement, respectively;
and the comparison unit 404 is used for comparing the execution results to the transaction functions.
In one embodiment, the result query statement generating unit specifically includes:
and the combination module is used for selecting a query reserved word from the query language library, and connecting and combining the query reserved word, the field name and the table name of the database table by using separators to form a result query statement.
In one embodiment, as shown in fig. 5, the alignment unit 404 includes:
the push stack saving module 501 is configured to push stack and save an execution result;
the push stack comparison module 502 is configured to compare execution results in each stack to obtain a comparison result.
In one embodiment, as shown in FIG. 6, the push preservation module 501 includes:
the expected value pushing module 601 is configured to call out an expected value of a preset execution result and push the expected value into an expected value stack;
the source library value pushing module 602 is configured to push an execution result in the source database into a source library value stack;
the target library value pushing module 603 is configured to push an execution result of the target database into a target library value stack.
In one embodiment, the push comparison module specifically includes:
and the value comparison module is used for comparing whether the values in the expected value stack, the source library value stack and the target library value stack are consistent, if so, the comparison result is successful, and if not, the comparison result is failed.
To better illustrate the comparison device (hereinafter referred to as device) of transaction functions in database migration provided in the present application, a specific embodiment is listed here:
the device supports database consistency comparison of multiple databases, supports batch execution of multiple transaction units and supports repeated execution of the transaction units, and has an input end, text types of the support input end are EXCEL and XML, and in the current case, EXCEL is used, and meanwhile, consistency verification of a production non-stop scene to the transaction units is supported.
Checking whether the function of inquiring account information of a user is consistent before and after the transfer of the inquiring transaction unit when the database is transferred from Oracle (foreign database) to PostgreSQL (domestic database), and whether the transaction result is consistent, the transaction unit is named as: and querying an account number.
Firstly, the device provides a text template which is convenient for a user to edit and supports two formats of EXCEL and XML, the device provides configuration of a connection data source, only a specific database name is required to be filled in a given dictionary, professional database connection pool configuration information is not required to be filled, the device selects a specified database in an alternative dictionary according to the user, and the device provides an automatic adaptation data connection pool configuration function. The user fills in the transaction unit name, the database name to be verified related to the current transaction (usually, the value is set as a default value and allows multiple selections) according to the template provided by the device, the database table (supporting multiple tables) associated with the current transaction, the current transaction preconditions (entering parameters), the current transaction focus field (exiting parameters) and the expected execution result (expected value) of the current transaction.
After the information is filled, the verification device is started, and the device client can be installed on any PC. The device is a packaged Java executable jar package and can run cross-platform on a machine with an installed JRE executable environment.
Firstly, the device reads the checked database type, automatically adapts to a corresponding database according to a database dictionary table configured by a user, and configures a connection pool; reading a first record CheckAccount to-be-verified transaction unit in an input end, and acquiring a target database name: after PostgreSQL, the device will automatically route to the appropriate PostgreSQL driver based on this name and then establish the database connection. After the step is completed, the device has the condition of communicating with the target database.
The device assembles SQL query sentences required by the execution of the query unit according to the database table names and field names in the text templates filled by the user.
The device reads the database type (PostgreSQL) in the template, adapts the corresponding database driver, and self-tests whether the database connection is completely ready or not, and the driver provides a test connection state function.
The name of the transaction unit and the query unit are injected into the device to finish the initialization of the device, the connection between the source database and the target database is simultaneously acquired during the initialization, the device starts to execute SQL sentences corresponding to the query unit on the source database and the target database respectively in a JDBC mode after the initialization is successful, the execution result is pushed onto a stack after the execution is finished, the expected value of a user is pushed onto an expected value stack, the execution result of the source database in the execution result of the transaction unit is pushed onto a source database value stack, and the execution result of the target database is pushed onto a target value stack.
The device takes the next transaction unit input by the user in the text template at the input end in turn and executes the next transaction unit in turn until the last transaction unit filled in the input file at the client end is executed by the user, compares whether the execution results in the three stacks are the same, if so, the service logic of the transaction unit is consistent before and after migration, and if the execution results are different, the service logic of the transaction unit is changed before and after migration, and recording and next processing are needed.
The comparison device provided by the application verifies whether the data before and after the database migration and the service logic are successfully migrated by executing the same transaction units in different databases, and fills the blank of verifying the service logic migration result in the current database migration.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The principles and embodiments of the present invention have been described in detail with reference to specific examples, which are provided to facilitate understanding of the method and core ideas of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.
The embodiment of the present application further provides a specific implementation manner of an electronic device capable of implementing all the steps in the method in the foregoing embodiment, and referring to fig. 7, the electronic device specifically includes the following:
a processor (processor) 701, a memory 702, a communication interface (Communications Interface) 703, a bus 704, and a non-volatile memory 705;
wherein, the processor 701, the memory 702, and the communication interface 703 complete communication with each other through the bus 704;
the processor 701 is configured to invoke the computer program in the memory 702 and the nonvolatile storage 705, where the processor executes the computer program to implement all the steps in the method in the foregoing embodiment, for example, the processor executes the computer program to implement the following steps:
s101: generating a result query statement according to a table name of a database table in a database acquired in advance and each field name in the database table; the database comprises: a target database and a source database.
S102: the method comprises the steps of obtaining transaction data from a database table, inputting the transaction data into a transaction unit of the database, and obtaining an execution result, wherein the execution result comprises: query results, new results, delete results, and update results.
S103: and querying the execution results in the target database and the source database respectively by utilizing the result query statement.
S104: and comparing the execution results with transaction functions.
The embodiments of the present application also provide a computer-readable storage medium capable of implementing all the steps of the method in the above embodiments, the computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements all the steps of the method in the above embodiments, for example, the processor implements the following steps when executing the computer program:
s101: generating a result query statement according to a table name of a database table in a database acquired in advance and each field name in the database table; the database comprises: a target database and a source database.
S102: the method comprises the steps of obtaining transaction data from a database table, inputting the transaction data into a transaction unit of the database, and obtaining an execution result, wherein the execution result comprises: query results, new results, delete results, and update results.
S103: and querying the execution results in the target database and the source database respectively by utilizing the result query statement.
S104: and comparing the execution results with transaction functions.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for a hardware+program class embodiment, the description is relatively simple, as it is substantially similar to the method embodiment, as relevant see the partial description of the method embodiment. Although the present description provides method operational steps as described in the examples or flowcharts, more or fewer operational steps may be included based on conventional or non-inventive means. The order of steps recited in the embodiments is merely one way of performing the order of steps and does not represent a unique order of execution. When implemented in an actual device or end product, the instructions may be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment, or even in a distributed data processing environment) as illustrated by the embodiments or by the figures. The terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, it is not excluded that additional identical or equivalent elements may be present in a process, method, article, or apparatus that comprises a described element. For convenience of description, the above devices are described as being functionally divided into various modules, respectively. Of course, when implementing the embodiments of the present disclosure, the functions of each module may be implemented in the same or multiple pieces of software and/or hardware, or a module that implements the same function may be implemented by multiple sub-modules or a combination of sub-units, or the like. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form. The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification embodiments may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present description embodiments may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein. In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction. The foregoing is merely an example of an embodiment of the present disclosure and is not intended to limit the embodiment of the present disclosure. Various modifications and variations of the illustrative embodiments will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, or the like, which is within the spirit and principles of the embodiments of the present specification, should be included in the scope of the claims of the embodiments of the present specification.

Claims (12)

1. A method for comparing transaction functions in database migration, comprising:
generating a result query statement according to a table name of a database table in a database acquired in advance and each field name in the database table; the database comprises: a target database and a source database;
obtaining transaction data from the database table, and inputting the transaction data into a transaction unit of the database to obtain an execution result, wherein the execution result comprises: query results, new results, delete results, and update results;
querying the execution result in the target database and the source database respectively by utilizing the result query statement;
and comparing the execution results with transaction functions.
2. The method for comparing transaction functions according to claim 1, wherein the generating a result query statement according to the table name of the database table in the pre-acquired database and each field name in the database table includes:
and selecting a query reserved word from a query language library, and connecting and combining the query reserved word, the field name and the table name of the database table into the result query statement by using a separator.
3. The method for comparing transaction functions according to claim 1, wherein the step of comparing the execution results includes:
pushing stack to save the execution result;
and comparing the execution results in each stack to obtain a comparison result.
4. A method for comparing transaction functions according to claim 3, wherein said pushing the execution result to save includes:
calling out an expected value of a preset execution result and pushing the expected value into an expected value stack;
pushing the execution result in the source database into a source library value stack;
pushing the execution result of the target database to a target library value stack.
5. The method for comparing transaction functions according to claim 4, wherein comparing execution results in each stack to obtain a comparison result comprises:
comparing whether the values in the expected value stack, the source library value stack and the target library value stack are consistent, if so, the comparison result is successful, otherwise, the comparison result is failed.
6. A comparison device for transaction functions in database migration, comprising:
a result query statement generating unit, configured to generate a result query statement according to a table name of a database table in a database acquired in advance and each field name in the database table; the database comprises: a target database and a source database;
the transaction execution unit is used for acquiring transaction data from the database table and inputting the transaction data into the transaction unit of the database to obtain an execution result, and the execution result comprises: query results, new results, delete results, and update results;
the result query unit is used for querying the execution result in the target database and the source database respectively by utilizing the result query statement;
and the comparison unit is used for comparing the execution results with the transaction functions.
7. The transaction function comparison device according to claim 6, wherein the result query statement generation unit specifically includes:
and the combination module is used for selecting a query reserved word from a query language library, and connecting and combining the query reserved word, the field name and the table name of the database table into the result query statement by using a separator.
8. The transaction function contrast device according to claim 6, wherein the contrast unit includes:
the push stack storage module is used for carrying out push stack storage on the execution result;
and the push stack comparison module is used for comparing the execution results in each stack to obtain a comparison result.
9. The transaction function contrast device of claim 8, wherein the push preservation module comprises:
the expected value pushing module is used for calling out an expected value of a preset execution result and pushing the expected value into an expected value stack;
the source library value stack pushing module is used for pushing the execution result in the source database into a source library value stack;
and the target database value pushing module is used for pushing the execution result of the target database into a target database value stack.
10. The transaction function comparison device of claim 9, wherein the push stack comparison module specifically comprises:
and the value comparison module is used for comparing whether the values in the expected value stack, the source library value stack and the target library value stack are consistent, if so, the comparison result is successful, and if not, the comparison result is failed.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements a method for comparing transaction functions according to any of claims 1 to 5 when executing the program.
12. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements a method for comparing transaction functions according to any of claims 1 to 5.
CN201911351967.3A 2019-12-25 2019-12-25 Comparison method and device for transaction functions in database migration Active CN111090638B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911351967.3A CN111090638B (en) 2019-12-25 2019-12-25 Comparison method and device for transaction functions in database migration

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911351967.3A CN111090638B (en) 2019-12-25 2019-12-25 Comparison method and device for transaction functions in database migration

Publications (2)

Publication Number Publication Date
CN111090638A CN111090638A (en) 2020-05-01
CN111090638B true CN111090638B (en) 2023-07-04

Family

ID=70397095

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911351967.3A Active CN111090638B (en) 2019-12-25 2019-12-25 Comparison method and device for transaction functions in database migration

Country Status (1)

Country Link
CN (1) CN111090638B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111767270A (en) * 2020-06-28 2020-10-13 平安普惠企业管理有限公司 Data migration method, device, server and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011258002A (en) * 2010-06-09 2011-12-22 Inforce Co Ltd Data conversion method, apparatus thereof, and program thereof
CN103440273A (en) * 2013-08-06 2013-12-11 北京航空航天大学 Data cross-platform migration method and device
CN106970920A (en) * 2016-01-14 2017-07-21 阿里巴巴集团控股有限公司 A kind of method and apparatus for database data migration
CN110209650A (en) * 2019-05-05 2019-09-06 苏宁易购集团股份有限公司 The regular moving method of data, device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011258002A (en) * 2010-06-09 2011-12-22 Inforce Co Ltd Data conversion method, apparatus thereof, and program thereof
CN103440273A (en) * 2013-08-06 2013-12-11 北京航空航天大学 Data cross-platform migration method and device
CN106970920A (en) * 2016-01-14 2017-07-21 阿里巴巴集团控股有限公司 A kind of method and apparatus for database data migration
CN110209650A (en) * 2019-05-05 2019-09-06 苏宁易购集团股份有限公司 The regular moving method of data, device, computer equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
宋春红 ; 王佳斌 ; 郑力新 ; .一种MySQL到HBase的迁移策略的研究与实现.微型机与应用.2015,第35卷(第13期),第82-89页. *
熊军军 ; .Informix向Oracle迁移的关键技术研究.计算机工程.2012,第38卷(第14期),第52-55页. *

Also Published As

Publication number Publication date
CN111090638A (en) 2020-05-01

Similar Documents

Publication Publication Date Title
US7676492B2 (en) Migration of database using serialized objects
US9372671B2 (en) Modeling and code generation for SQL-based data transformations
US20170236130A1 (en) Emulating Manual System of Filing Using Electronic Document and Electronic File
CN104133772A (en) Automatic test data generation method
CN109992508A (en) Test exemple automation generation method, device and electronic equipment
CN110990274B (en) Data processing method, device and system for generating test cases
WO2016026328A1 (en) Information processing method and device and computer storage medium
CN107301070A (en) A kind of upgrade method and terminal
CN110599341A (en) Transaction calling method and system
CN111399828A (en) Model-driven logic device modeling method and terminal
CN111367894B (en) Data comparison method and device based on database migration
CN111090638B (en) Comparison method and device for transaction functions in database migration
CN110287120B (en) Unit test system and test method
CN111125067A (en) Data maintenance method and device
US10540151B1 (en) Graphical customization of a firmware-provided user interface (UI)
CN111143463B (en) Construction method and device of bank data warehouse based on topic model
WO2021031110A1 (en) Configuration file generation method and device, and storage medium
CN110309145A (en) A kind of tables of data method of adjustment, tables of data creation method and device
CN112181951B (en) Heterogeneous database data migration method, device and equipment
CN113901025A (en) Database management method, device, equipment and storage medium
CN115018621A (en) Contract changing method, device, equipment and medium
CN115292165A (en) Test method and device, electronic device and storage medium
CN112732367A (en) Event flow processing method, device and equipment and readable storage medium
CN110597862A (en) Data entry method, equipment and system based on information system
CN109815129A (en) Test method, device, terminal and the storage medium of securities finance application software

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
GR01 Patent grant
GR01 Patent grant