CN109634984A - A kind of data source configuration is converted into the method and system of SQL - Google Patents

A kind of data source configuration is converted into the method and system of SQL Download PDF

Info

Publication number
CN109634984A
CN109634984A CN201811527037.4A CN201811527037A CN109634984A CN 109634984 A CN109634984 A CN 109634984A CN 201811527037 A CN201811527037 A CN 201811527037A CN 109634984 A CN109634984 A CN 109634984A
Authority
CN
China
Prior art keywords
data
source
sql
data source
configuration
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
CN201811527037.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.)
Bank of China Ltd
Original Assignee
Bank of China 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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN201811527037.4A priority Critical patent/CN109634984A/en
Publication of CN109634984A publication Critical patent/CN109634984A/en
Pending legal-status Critical Current

Links

Landscapes

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

Abstract

The invention discloses the method and system that a kind of configuration of data source is converted into SQL, configuration information is read from SQL data source allocation list, the configuration item in the configuration information includes: data source ID, source data field name, source data table name, target data field name, target data table name, screening conditions, complete SQL statement and data action type can be performed;It is then based on data manipulation type, rule, the corresponding whole SQL statements of Lai Shengcheng data source ID are assembled using SQL corresponding with data manipulation type.Since the present invention uses identical SQL assembling rule for identical data manipulation type (namely business function is identical), therefore, when business function is identical and data processing difference, without developing set of system again, namely source code is without changing, it only needs to modify the data in data source configuration information, to eliminated significantly because of all code bring troublesome operations in exploitation new system and test system newly developed.

Description

A kind of data source configuration is converted into the method and system of SQL
Technical field
The present invention relates to field of computer technology, more specifically, being related to a kind of method that data source configuration is converted into SQL And system.
Background technique
In overseas in most of country's remittance clearing operation, the business processing flow being related to is roughly the same, but due to Database structure design used in country variant remittance fund clearing business, reading data and memory requirement are inconsistent, because This results in the need for covering different systems for settling account for country variant remittance fund clearing business development more.
In system for settling account development process, it need to be customized according to the demand of different systems for settling account, database institute is read and write in customization SQL (Structured Query Language, the structured query language) sentence needed, and SQL statement is hard-coded in code In.Since these SQL statements can not be used by other systems, lead to, developer identical even if business function Have to abandon having tested the system completed and put into operation, and develops set of system again and test all codes.
Summary of the invention
In view of this, the present invention discloses the method and system that a kind of configuration of data source is converted into SQL, work as business function to realize Can identical and data processing difference when, without developing set of system namely source code again without changing, it is only necessary to modify data source Data in configuration information, to saved significantly because all code bands come in exploitation new system and test system newly developed Troublesome operation.
A kind of method that data source configuration is converted into SQL, comprising:
Configuration information is read from pre-set SQL data source allocation list, the configuration item in the configuration information includes: number According to source ID, source data field name, source data table name, target data field name, target data table name, screening conditions, can be performed Whole SQL statement and data action type;
It is regular using SQL corresponding with data manipulation type assembling according to the data manipulation type, described in generation The corresponding whole SQL statements of data source ID.
Optionally, described to be grasped according to the data when the data manipulation type is that SQL query records data source configuration Make type, rule is assembled using SQL corresponding with the data manipulation type, generates the corresponding whole SQL of the data source ID Sentence specifically includes:
When the data source ID is one, it is successively read according to the sequence of each configuration item in the configuration information each A configuration item;
Judge whether the screening conditions are arranged;
If it is, using the source data table name and the screening conditions as assembling condition, by the source data table name All SQL statements that the identical field of identical and described screening conditions is assembled on the same SQL statement, and assembling is obtained The sequencing for the configuration combined according to source data table name described in the configuration information and the screening conditions is successively Arrangement, obtains one group of SQL query statement;
If it is not, then only using the source data table name as assembling condition, by the identical field groups of the source data table name It is attached on the same SQL statement, and all SQL statements that assembling is obtained are according to source data table described in the configuration information The configuration sequence of name is arranged successively, and obtains one group of SQL query statement.
Optionally, further includes:
When the data source ID is multiple, according to each data source ID put in order and each data source ID in it is each The sequence of a configuration item is successively read each configuration item;
Judge whether the screening conditions are arranged;
If it is, using the data source ID, the source data table name and the screening conditions as assembling condition, by institute State that data source ID is identical, the source data table name is identical and the identical field of the screening conditions is assembled into the same SQL statement On, and by the obtained all SQL statements of assembling according to data source ID described in the configuration information, the source data table name and The sequencing for the configuration that the screening conditions are combined is arranged successively, and obtains one group of SQL query statement;
If it is not, then using the data source ID and the source data table name as assembling condition, by the data source ID phase All SQL statements for being assembled on the same SQL statement with field identical with the source data table name, and assembling being obtained The sequencing for the configuration combined according to data source ID described in the configuration information and the source data table name is successively Arrangement, obtains one group of SQL query statement.
Optionally, described to be grasped according to the data when the data manipulation type is that the newly-increased record data source of SQL configures Make type, rule is assembled using SQL corresponding with the data manipulation type, generates the corresponding whole SQL of the data source ID Sentence specifically includes:
When the data source ID is one, it is successively read according to the sequence of each configuration item in the data source ID each A configuration item;
The identical field of the target matrix name is assembled on the same SQL statement, and is owned what assembling obtained SQL statement be arranged successively according to the configuration sequence of target data table name described in the configuration information, it is newly-increased to obtain one group of SQL Record sentence.
Optionally, further includes:
When the data source ID is multiple, according to each data source ID put in order and each data source ID in it is each The sequence of a configuration item is successively read each configuration item;
The data source ID and the identical field of the target matrix name are assembled on the same SQL statement, and will Obtained all SQL statements are assembled to exist according to data source ID described in the configuration information and target data table name combination The sequencing of configuration together is arranged successively, and obtains the newly-increased record sentence of one group of SQL.
Optionally, described to be grasped according to the data when the data manipulation type is that SQL more new record data source configures Make type, rule is assembled using SQL corresponding with the data manipulation type, generates the corresponding whole SQL of the data source ID Sentence specifically includes:
When the data source ID is one, it is successively read according to the sequence of each configuration item in the configuration information each A configuration item;
Judge whether the screening conditions are arranged;
If it is, using the target data table name and the screening conditions as assembling condition, by the target data All SQL that table name is identical and the identical field of the screening conditions is assembled on the same SQL statement, and assembling is obtained The configuration that sentence is combined according to target data table name described in the configuration information and the screening conditions it is successive suitable Sequence is arranged successively, and obtains one group of SQL more new record sentence;
If it is not, then only using the target matrix name as assembling condition, by the identical word of the target matrix name Section is assembled on the same SQL statement, and all SQL statements that assembling is obtained are according to target described in the configuration information The configuration sequence of data table name is arranged successively, and is obtained one group of SQL and is updated sentence.
Optionally, further includes:
When the data source ID is multiple, according to each data source ID put in order and each data source ID in it is each The sequence of a configuration item is successively read each configuration item;
Judge whether the screening conditions are arranged;
If it is, using the data source ID, the target data table name and the screening conditions as assembling condition, it will The data source ID is identical, the target matrix name is identical and the identical field of the screening conditions is assembled into the same SQL On sentence, and all SQL statements that assembling is obtained are according to data source ID described in the configuration information, the target data The sequencing for the configuration that table name and the screening conditions are combined is arranged successively, and obtains one group of SQL more new record sentence;
If it is not, then using the data source ID and the target matrix name as assembling condition, by the data source ID All SQL that the identical field of identical and described target matrix name is assembled on the same SQL statement, and assembling is obtained The configuration that sentence is combined according to data source ID described in the configuration information and the target data table name it is successive suitable Sequence is arranged successively, and obtains one group of SQL more new record sentence.
Optionally, further includes:
If source data and target data are not set, and have been separately configured complete S QL sentence in the configuration information, then press According to the sequence of the configuration of data source ID described in the configuration information, the complete S QL sentence is successively chosen, and will be described complete SQL statement is placed on the last execution of all SQL statements ultimately generated, wherein the source data includes: the source data word Source data table name described in Duan Minghe, the target data includes: the target data field name and the target data table name.
Optionally, further includes:
When the data source ID is multiple, if being configured with identical target data in different data source ID, according to Each data source ID's puts in order, and the ID value for operating the target data in current data source is covered the current data source ID Previous data source ID operate the value of the target data, wherein the target data includes: target data field name and mesh Mark data table name.
A kind of system that data source configuration is converted into SQL, comprising:
Information reading unit, for reading configuration information, the configuration information from pre-set SQL data source allocation list In configuration item include: data source ID, source data field name, source data table name, target data field name, target data table name, Complete SQL statement and data action type can be performed in screening conditions;
SQL statement generation unit is used for according to the data manipulation type, using corresponding with the data manipulation type SQL assembling rule generates the corresponding whole SQL statements of the data source ID.
Optionally, the SQL statement generation unit specifically includes:
First reading subunit, for being SQL query record data source configuration when the data manipulation type, and when described When data source ID is one, each configuration item is successively read according to the sequence of each configuration item in the configuration information;
First judgment sub-unit, for judging whether the screening conditions are arranged;
First assembling subelement, in the case where first judgment sub-unit is judged as YES, by the source data Table name and the screening conditions are as assembling condition, by the source data table name is identical and the identical field groups of the screening conditions It is attached on the same SQL statement, and all SQL statements that assembling is obtained are according to source data table described in the configuration information The sequencing for the configuration that name and the screening conditions are combined is arranged successively, and obtains one group of SQL query statement;
Second assembling subelement, in the case where first judgment sub-unit is judged as NO, only by the source number According to table name as assembling condition, the identical field of the source data table name is assembled on the same SQL statement, and will be assembled To all SQL statements be arranged successively according to the configuration sequence of source data table name described in the configuration information, obtain one group SQL query statement.
Optionally, further includes:
Second reading subunit, for being that SQL query records data source configuration, and the number when the data manipulation type According to source ID be it is multiple when, according to each data source ID put in order and each data source ID in each configuration item sequence according to Secondary each configuration item of reading;
Second judgment sub-unit, for judging whether the screening conditions are arranged;
Third assembles subelement, in the case where second judgment sub-unit is judged as YES, by the data source ID, the source data table name and the screening conditions are as assembling condition, identical, the described source data table name by the data source ID All SQL statements that the identical field of identical and described screening conditions is assembled on the same SQL statement, and assembling is obtained The configuration combined according to data source ID described in the configuration information, the source data table name and the screening conditions Sequencing is arranged successively, and obtains one group of SQL query statement;
4th assembling subelement, in the case where second judgment sub-unit is judged as NO, by the data source ID and the source data table name are as assembling condition, by the identical field groups of the identical and described source data table name of the data source ID It is attached on the same SQL statement, and all SQL statements that assembling is obtained are according to data source ID described in the configuration information The sequencing for the configuration combined with the source data table name is arranged successively, and obtains one group of SQL query statement.
Optionally, the SQL statement generation unit specifically includes:
Third reading subunit, for recording data source configuration, and the number when the data manipulation type is that SQL is newly-increased According to source ID be one when, be successively read each configuration item according to the sequence of each configuration item in the data source ID;
5th assembling subelement, for the identical field of the target matrix name to be assembled into the same SQL statement, And all SQL statements that assembling obtains successively are arranged according to the configuration sequence of target data table name described in the configuration information Column obtain the newly-increased record sentence of one group of SQL.
Optionally, further includes:
4th reading subunit, for recording data source configuration, and the number when the data manipulation type is that SQL is newly-increased According to source ID be it is multiple when, according to each data source ID put in order and each data source ID in each configuration item sequence according to Secondary each configuration item of reading;
6th assembling subelement, for the identical field of the target matrix name to be assembled into the same SQL statement, And all SQL statements for obtaining assembling are according to data source ID described in the configuration information and the target data table name group The sequencing for the configuration being combined is arranged successively, and obtains the newly-increased record sentence of one group of SQL.
Optionally, the SQL statement generation unit specifically includes:
5th reading subunit, for being that SQL more new record data source configures when the data manipulation type, and the number According to source ID be one when, be successively read each configuration item according to the sequence of each configuration item in the configuration information;
Third judgment sub-unit, for judging whether the screening conditions are arranged;
7th assembling subelement, in the case where the third judgment sub-unit is judged as YES, by the number of targets According to table name and the screening conditions as assembling condition, by the target matrix name is identical and the identical word of the screening conditions Section is assembled on the same SQL statement, and all SQL statements that assembling is obtained are according to target described in the configuration information The sequencing for the configuration that data table name and the screening conditions are combined is arranged successively, and obtains one group of SQL more new record Sentence;
8th assembling subelement, in the case where the third judgment sub-unit is judged as NO, only by the target The identical field of the target matrix name is assembled on the same SQL statement by tables of data name as assembling condition, and by group It fills obtained all SQL statements to be arranged successively according to the configuration sequence of target data table name described in the configuration information, obtain Sentence is updated to one group of SQL.
Optionally, further includes:
6th reading subunit, for being that SQL more new record data source configures when the data manipulation type, and the number According to source ID be it is multiple when, according to each data source ID put in order and each data source ID in each configuration item sequence according to Secondary each configuration item of reading;
4th judgment sub-unit, for judging whether the screening conditions are arranged;
9th assembling subelement, in the case where the 4th judgment sub-unit is judged as YES, by the data source ID, the target data table name and the screening conditions are as assembling condition, identical, the described target data by the data source ID All SQL that table name is identical and the identical field of the screening conditions is assembled on the same SQL statement, and assembling is obtained Sentence is combined according to data source ID described in the configuration information, the target data table name and the screening conditions The sequencing of configuration is arranged successively, and obtains one group of SQL more new record sentence;
Tenth assembling subelement, in the case where the 4th judgment sub-unit is judged as NO, by the data source ID and the target matrix name are as assembling condition, by the identical word of the identical and described target matrix name of the data source ID Section is assembled on the same SQL statement, and all SQL statements that assembling is obtained are according to data described in the configuration information The sequencing for the configuration that source ID and the target data table name are combined is arranged successively, and obtains one group of SQL more new record Sentence.
Optionally, further includes:
Direct selection unit, if it is not set for source data and target data, and be separately configured in the configuration information Complete S QL sentence, the then sequence configured according to data source ID described in the configuration information, successively chooses the complete S QL Sentence, and the complete S QL sentence is placed on to the last execution of all SQL statements ultimately generated, wherein the source data It include: the source data field name and the source data table name, the target data includes: the target data field name and institute State target data table name.
Optionally, further includes:
Capping unit is used for when the data source ID is multiple, if being configured with identical mesh in different data source ID Data are marked, then putting in order according to each data source ID, the ID value for operating the target data in current data source is covered into institute The previous data source ID for stating current data source ID operates the value of the target data, wherein the target data includes: target Data field name and target data table name.
From above-mentioned technical solution it is found that the invention discloses the method and system that a kind of configuration of data source is converted into SQL, Read configuration information from SQL data source allocation list, the configuration item in the configuration information include: data source ID, source data field name, Target data field name, target data table name, screening conditions, complete SQL statement and data manipulation can be performed in source data table name Type;It is then based on data manipulation type, rule, Lai Shengcheng data source ID are assembled using SQL corresponding with data manipulation type Corresponding whole SQL statement.Since the present invention uses phase for identical data manipulation type (namely business function is identical) With SQL assemble rule, therefore, when business function is identical and when data processing difference, without developing set of system again, namely Source code is without changing, it is only necessary to the data in data source configuration information is modified, to eliminated significantly because developing new system And all code bring troublesome operations in test system newly developed.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The embodiment of invention for those of ordinary skill in the art without creative efforts, can also basis Disclosed attached drawing obtains other attached drawings.
Fig. 1 is the method flow diagram that a kind of data source configuration disclosed by the embodiments of the present invention is converted into SQL;
Fig. 2 is disclosed by the embodiments of the present invention a kind of when data manipulation type is SQL query record data source configuration, root According to data manipulation type, rule is assembled using SQL corresponding with data manipulation type, generates the corresponding whole SQL of data source ID The method flow diagram of sentence;
Fig. 3 is that a kind of data manipulation type disclosed by the embodiments of the present invention is reading when SQL query record data source configures Configuration information schematic diagram;
Fig. 4 is disclosed by the embodiments of the present invention a kind of when data manipulation type is that the newly-increased record data source of SQL configures, root According to data manipulation type, rule is assembled using SQL corresponding with data manipulation type, generates the corresponding whole SQL of data source ID The method flow diagram of sentence;
Fig. 5 is that a kind of data manipulation type disclosed by the embodiments of the present invention is reading when the newly-increased record data source of SQL configures Configuration information schematic diagram;
Fig. 6 is disclosed by the embodiments of the present invention a kind of when data manipulation type is the configuration of SQL more new record data source, root According to data manipulation type, rule is assembled using SQL corresponding with data manipulation type, generates the corresponding whole SQL of data source ID The method flow diagram of sentence;
Fig. 7 is that a kind of data manipulation type disclosed by the embodiments of the present invention is reading when SQL more new record data source configures Configuration information schematic diagram;
Fig. 8 is the system structure diagram that a kind of data source configuration disclosed by the embodiments of the present invention is converted into SQL.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
The embodiment of the invention discloses the method and system that a kind of configuration of data source is converted into SQL, configure from SQL data source Table reads configuration information, and the configuration item in the configuration information includes: data source ID, source data field name, source data table name, target Target data table name, screening conditions, complete SQL statement and data action type can be performed in data field name;It is then based on number According to action type, rule, the corresponding whole SQL language of Lai Shengcheng data source ID are assembled using SQL corresponding with data manipulation type Sentence.Since the present invention uses identical SQL assembling rule for identical data manipulation type (namely business function is identical), Therefore, when business function is identical and when data processing difference, without developing set of system namely source code again without changing, only Need to modify the data in data source configuration information, to eliminated significantly because of exploitation new system and test system newly developed All code bring troublesome operations in system.Further, when data processing when something goes wrong, equally only need to modify data source and match It sets, without recompilating program or restarting system, and can come into force immediately, therefore greatly reduce developer in processing number Workload when according to the problem.
Referring to Fig. 1, a kind of configuration of data source disclosed in one embodiment of the invention is converted into the method flow diagram of SQL, the party Method comprising steps of
Step S101, configuration information is read from pre-set SQL data source allocation list;
It is recorded in SQL data source allocation list used in the system for settling account that with good grounds preset configuration rule is configured all SQL operation information.
Configuration item in SQL data source allocation list includes: data source ID, source data field name, source data table name, number of targets According to field name, target data table name, screening conditions (i.e. where screening conditions), complete SQL statement and data manipulation can be performed Type.
Wherein, a data source ID includes one group of SQL configuration item, and one group of SQL configuration item includes one or more SQL language Sentence.
Data manipulation type includes: Q:SQL inquiry record data source configuration;The newly-increased record data source configuration of I:SQL;U: The configuration of SQL more new record data source.
It should be noted that the variable name used in source code (non-SQL literary name section name) needs in SQL data source allocation list It is identified with " [] ".
The present embodiment from the configuration information that SQL data source allocation list is read specifically also include: data source ID, source data field Source data table name, target data field name, target data table name, screening conditions, complete SQL statement and data can be performed in name Action type.
It should be strongly noted that the content in the different corresponding configuration informations of data manipulation type may be different, than Such as, when data manipulation type is that the newly-increased record data source of SQL configures, source data table name content is then " sky ", data manipulation type When recording data source configuration for SQL query, source data table name content is not " sky ".
Based on SQL data source allocation list, data source configuration is converted into the assembling principle of SQL are as follows: source data (includes: source Data field name and source data table name) and target data (including: target data field name and target data table name) only exist one Kind unidirectional relationship will be put into target data from source data literary name section reading value and be held that is, when source data is database table field In capable program variable;Conversely, when source data is program variable, by the value of program variable storage (newly-increased/insert or more Newly/update) into database table field pointed by target data, executable SQL statement is assembled based on mentioned above principle.
Step S102, according to data manipulation type, rule is assembled using SQL corresponding with data manipulation type, generates number According to the corresponding whole SQL statements of source ID.
The present invention be directed to identical data manipulation type, use identical SQL assembling rule, when business function it is identical and When data processing difference, without developing set of system namely source code again without changing, it is only necessary to modify data source configuration information In data.
Wherein, in the case where possessing where screening conditions, the SQL statement of generation will splice where sieve at sentence end Select condition;In the configuration information of reading, if not configuring source data and target data, and complete S QL sentence is separately configured (also should include the source data of signature requirement and the relevant information of target data in complete S QL sentence), then can directly execute Complete S QL sentence, without splicing.
It, can be to each configuration item in configuration information in order to reduce the number of executions of SQL statement to improve execution efficiency It is grouped classification and is assembled into SQL statement, to reduce database I/O (Input/Output, input/output), optimize database Operation.
In summary, data source disclosed by the invention configures the method for being converted into SQL, reads from SQL data source allocation list Configuration information, the configuration item in the configuration information includes: data source ID, source data field name, source data table name, target data word Target data table name, screening conditions, complete SQL statement and data action type can be performed in section name;It is then based on data manipulation Type assembles rule, the corresponding whole SQL statements of Lai Shengcheng data source ID using SQL corresponding with data manipulation type.Due to The present invention uses identical SQL assembling rule for identical data manipulation type (namely business function is identical), therefore, when Business function is identical and when data processing difference, without developing set of system namely source code again without changing, it is only necessary to modify Data in data source configuration information, to eliminated significantly because owning in exploitation new system and test system newly developed Code bring troublesome operation.Further, when data processing when something goes wrong, equally only need to modify data source configuration, be not necessarily to It recompilates program or restarts system, and can come into force immediately, therefore greatly reduce developer and occur in processing data The problem of when workload.
For convenience of understanding, the method for being converted into SQL is configured the following detailed description of data source, specific as follows:
Referring to fig. 2, one kind disclosed in one embodiment of the invention is configured when data manipulation type records data source for SQL query When, according to data manipulation type, rule is assembled using SQL corresponding with data manipulation type, it is corresponding complete to generate data source ID The method flow diagram of portion's SQL statement, the method comprising the steps of:
Step S201, judge that data source ID is for one or multiple;
Step S202, it when data source ID is one, is successively read often according to the sequence of configuration item each in configuration information One configuration item;
Specifically, referring to Fig. 3, a kind of data manipulation type disclosed in one embodiment of the invention is that SQL query records data The configuration information schematic diagram that source is read when configuring, when data source ID is 00001, according to the sequence of configuration item shown in Fig. 3, i.e., (i.e. where screens item for source data field name, source data table name, target data field name, target data table name, screening conditions Part), complete SQL statement and data action type can be performed, be successively read each configuration item.
Step S203, judge whether screening conditions are arranged, if so, S204 is thened follow the steps, if not, thening follow the steps S205;
It should be noted that whether screening conditions, which are arranged, refers to whether the set content of screening conditions is empty.
Step S204, using source data table name and screening conditions as assembling condition, one group of SQL query statement is obtained;
Specifically, using source data table name and screening conditions as assembling condition, by source data table name is identical and screening conditions Identical field is assembled on the same SQL statement, and all SQL statements that assembling is obtained are according to source number in configuration information The sequencing for the configuration combined according to table name and screening conditions is arranged successively, and obtains one group of SQL query statement;
By database syntax be oracle grammer for, come illustrate assembling obtain SQL query statement when, each configuration item according to It is secondary to put in order, specific as follows:
Select+ source data field name group (being assigned to same group of data sheet field name, multiple to be separated with English comma)+ From+ source data table name+into+ target data field name group (it is assigned to the variable name in same group of source code, it is multiple to use English Literary comma separates)+where+where screening conditions
Wherein, it when the configuration content of where screening conditions is not sky, needs to splice where screening conditions entire SQL query statement end.
Step S205, one group of SQL query statement only is obtained using source data table name as assembling condition.
Specifically, only the identical field of source data table name is assembled into same using source data table name as assembling condition On SQL statement, and all SQL statements that assembling obtains successively are arranged according to the configuration sequence of source data table name in configuration information Column, obtain one group of SQL query statement.
Wherein, when where screening conditions are not set, then where screening is not spliced at the end of entire SQL query statement Condition.
Step S206, when data source ID be it is multiple when, according to each data source ID put in order and each data source The sequence of each configuration item is successively read each configuration item in ID;
Step S207, judge whether screening conditions are arranged, if so, S208 is thened follow the steps, if not, thening follow the steps S209;
Step S208, using data source ID, source data table name and screening conditions as assembling condition, one group of SQL query is obtained Sentence;
Specifically, using data source ID, source data table name and screening conditions as assembling condition, the identical, source by data source ID Tables of data name is identical and the identical field of screening conditions is assembled on the same SQL statement, and all SQL that assembling is obtained Sentence is successive suitable according to the configuration for combining data source ID, source data table name and screening conditions in the configuration information Sequence is arranged successively, and obtains one group of SQL query statement.
Step S209, using data source ID and source data table name as assembling condition, one group of SQL query statement is obtained.
Specifically, using data source ID and source data table name as assembling condition, by data source ID is identical and source data table name Identical field is assembled on the same SQL statement, and all SQL statements that assembling is obtained are according in the configuration information The sequencing for the configuration that data source ID and source data table name are combined is arranged successively, and obtains one group of SQL query statement.
It should be noted that when there are multiple data source ID, if being configured with identical target in different data source ID Data, then putting in order according to each data source ID, the ID value for operating the target data in current data source is covered current The value of the previous data source ID operation target data of data source ID, wherein target data includes: target data field name and mesh Mark data table name.
Embodiment according to Fig.2, it is last available as next group of SQL is looked into after handling the data in Fig. 3 Ask sentence:
1、select FROM_ACCT,TO_ACCT into
[FROM_ACCT_DATA], [TO_ACCT_DATA] from OUTWARD_CTRL where TRAN_ID= [TRAN_ID]
2、select CURRENCY,TRAN_TYPE into
[CURRENCY_DATA], [TRAN_TYPE_DATA] from OUTWARD_CTRL where TRAN_ID1= [TRAN_ID]
3、select‘1’into[TRAN_FLAG_DATA]from dual
4、select to_char(sysdate,'yyyy-MM-dd HH24:mi:ss')into
[TRAN_TIME_DATA]from dual
In summary, the present invention is that SQL query records data source configuration for data manipulation type, is used identical SQL assembling rule, therefore, when business function is that SQL query records data source configuration, if when data processing difference, without weight Set of system newly developed namely source code are without changing, it is only necessary to the data in data source configuration information are modified, thus significantly It eliminates because of all code bring troublesome operations in exploitation new system and test system newly developed.Further, at data Reason when something goes wrong, equally only needs to modify data source configuration, without recompilating program or restarting system, and can be instant It comes into force, therefore greatly reduces workload of the developer when handling the data problem.
Referring to fig. 4, one kind disclosed in one embodiment of the invention records data source configuration when data manipulation type is that SQL is newly-increased When, according to data manipulation type, rule is assembled using SQL corresponding with data manipulation type, it is corresponding complete to generate data source ID The method flow diagram of portion's SQL statement, the method comprising the steps of:
Step S301, judge that data source ID is for one or multiple;
Step S302, it when data source ID is one, is successively read often according to the sequence of each configuration item in data source ID One configuration item;
Specifically, referring to Fig. 5, a kind of data manipulation type disclosed in one embodiment of the invention is the newly-increased record data of SQL The configuration information schematic diagram that source is read when configuring, when data source ID is 00001, according to the sequence of configuration item shown in fig. 5, i.e., (i.e. where screens item for source data field name, source data table name, target data field name, target data table name, screening conditions Part), complete SQL statement and data action type can be performed, be successively read each configuration item.
Step S303, using target matrix name as assembling condition, the newly-increased record sentence of one group of SQL is obtained;
Specifically, the institute that the identical field of target matrix name is assembled on the same SQL statement, and assembling is obtained Some SQL statements are arranged successively according to the configuration sequence of target data table name in the configuration information, obtain the newly-increased note of one group of SQL Record sentence.
By database syntax be oracle grammer for, come illustrate assembling obtain SQL query statement when, each configuration item according to It is secondary to put in order, specific as follows:
Insert into+ target data table name+(+target data field name group (is assigned to same group of data sheet field Name, multiple to be separated with English comma)+)+values+ (+source data field name (it is assigned to the variable name in same group of source code, It is multiple to be separated with English comma)+)
Step S304, when data source ID be it is multiple when, according to each data source ID put in order and each data source The sequence of each configuration item is successively read each configuration item in ID;
Step S305, using target matrix name as assembling condition, the newly-increased record sentence of one group of SQL is obtained.
Specifically, data source ID and the identical field of target matrix name are assembled on the same SQL statement, and by group Fill the elder generation for the configuration that obtained all SQL statements are combined according to data source ID in configuration information and target data table name It is sequentially arranged successively afterwards, obtains the newly-increased record sentence of one group of SQL.
It should be noted that if not configuring source data and target data, and being separately configured in the configuration information of reading Complete S QL sentence (in complete S QL sentence also should the source data comprising signature requirement and target data relevant information), then Complete S QL sentence can be directly executed, and is placed on the last execution of all SQL statements ultimately generated.
It is according to Fig.4, the step of, last available as next group of SQL is newly-increased after handling the data in Fig. 5 Record sentence:
1、insert into OUTWARD_CTRL
(FROM_ACCT,TO_ACCT,CURRENCY,TRAN_TYPE)values
([FROM_ACCT_DATA],[TO_ACCT_DATA],[CURRENCY_DATA],'00')
2、insert into OUTWARD_CTRL(tran_flag)values
([TRAN_FLAG_DATA])
In summary, the present invention is the newly-increased record data source configuration of SQL for data manipulation type, is used identical SQL assembling rule, therefore, when business function, which is that SQL is newly-increased, records data source configuration, if when data processing difference, without weight Set of system newly developed namely source code are without changing, it is only necessary to the data in data source configuration information are modified, thus significantly It eliminates because of all code bring troublesome operations in exploitation new system and test system newly developed.Further, at data Reason when something goes wrong, equally only needs to modify data source configuration, without recompilating program or restarting system, and can be instant It comes into force, therefore greatly reduces workload of the developer when handling the data problem.
Referring to Fig. 6, one kind disclosed in one embodiment of the invention is the configuration of SQL more new record data source when data manipulation type When, according to data manipulation type, rule is assembled using SQL corresponding with data manipulation type, it is corresponding complete to generate data source ID The method flow diagram of portion's SQL statement, the method comprising the steps of:
Step S401, judge that data source ID is for one or multiple;
Step S402, it when data source ID is one, is successively read according to the sequence of each configuration item in the configuration information Take each configuration item;
Specifically, referring to Fig. 7, a kind of data manipulation type disclosed in one embodiment of the invention is SQL more new recorded data The configuration information schematic diagram that source is read when configuring, when data source ID is 00001, according to the sequence of configuration item shown in Fig. 7, i.e., (i.e. where screens item for source data field name, source data table name, target data field name, target data table name, screening conditions Part), complete SQL statement and data action type can be performed, be successively read each configuration item.
Step S403, judge whether screening conditions are arranged, if so, S404 is thened follow the steps, if not, thening follow the steps S405;
Step S404, using target data table name and screening conditions as assembling condition, one group of SQL more new record language is obtained Sentence;
Specifically, using target data table name and screening conditions as assembling condition, by the target matrix name it is identical and The identical field of the screening conditions is assembled on the same SQL statement, and all SQL statements that assembling is obtained are according to institute The sequencing for stating the configuration that target data table name and screening conditions are combined in configuration information is arranged successively, and obtains one group SQL more new record sentence.
By database syntax be oracle grammer for, come illustrate assembling obtain SQL update sentence when, each configuration item according to It is secondary to put in order, specific as follows:
Update+ target data table name+set+ target data field name=source data field name be (same configuration record Target data field name and source data field name are spliced into assignment statement with "=", and multiple groups assignment statement is then spliced in a plurality of configuration, Separated with English comma)+where+where screening conditions
Step S405, it only obtains one group of SQL using target matrix name as assembling condition and updates sentence.
Specifically, only the identical field of target matrix name is assembled into together using target matrix name as assembling condition On one SQL statement, and all SQL statements that assembling is obtained are according to the configuration of target data table name in the configuration information Sequence is arranged successively, and is obtained one group of SQL and is updated sentence.
It should be noted that not splicing at the end of entire SQL query statement then when where screening conditions are not set Where screening conditions.
Step S406, when data source ID be it is multiple when, according to each data source ID put in order and each data source The sequence of each configuration item is successively read each configuration item in ID;
Step S407, judge whether screening conditions are arranged, if so, S408 is thened follow the steps, if not, thening follow the steps S409;
Step S408, using data source ID, target data table name and screening conditions as assembling condition, one group of SQL is obtained more New record sentence;
Specifically, using data source ID, target data table name and screening conditions as assembling condition, by the data source ID phase The identical field of identical with, the target matrix name and described screening conditions is assembled on the same SQL statement, and will assembling Obtained all SQL statements are according to data source ID, target data table name and screening conditions combination in the configuration information one The sequencing of the configuration risen is arranged successively, and obtains one group of SQL more new record sentence.
Step S409, using data source ID and target matrix name as assembling condition, one group of SQL more new record language is obtained Sentence.
Specifically, using data source ID and target matrix name as assembling condition, the data source ID is identical and described The identical field of target matrix name is assembled on the same SQL statement, and all SQL statements that assembling is obtained are according to institute The sequencing for stating the configuration that data source ID and target data table name are combined in configuration information is arranged successively, and obtains one group SQL more new record sentence.
It should be noted that when there are multiple data source ID, if being configured with identical target in different data source ID Data, then putting in order according to each data source ID, the ID value for operating the target data in current data source is covered current The value of the previous data source ID operation target data of data source ID, wherein target data includes: target data field name and mesh Mark data table name.
Embodiment according to figure 6, after handling the data in Fig. 7, last available such as next group of SQL is more New record sentence:
1、update OUTWARD_CTRL set
FROM_ACCT=[FROM_ACCT_DATA], TO_ACCT=[TO_ACCT_DATA] whereTRAN_ID= [TRAN_ID]
2、update OUTWARD_CTRL set
CURRENCY=[CURRENCY_DATA], TRAN_TYPE='01'where
TRAN_ID1=[TRAN_ID]
3, update OUTWARD_CTRL set tran_flag=[TRAN_FLAG_DATA] whereTRAN_ID= [TRAN_ID]
In summary, the present invention is the configuration of SQL more new record data source for data manipulation type, is used identical SQL assembling rule, therefore, when business function is that SQL more new record data source configures, if when data processing difference, without weight Set of system newly developed namely source code are without changing, it is only necessary to the data in data source configuration information are modified, thus significantly It eliminates because of all code bring troublesome operations in exploitation new system and test system newly developed.Further, at data Reason when something goes wrong, equally only needs to modify data source configuration, without recompilating program or restarting system, and can be instant It comes into force, therefore greatly reduces workload of the developer when handling the data problem.
It should be noted that for above-mentioned each embodiment, if source data and target data are not set, and configuration information In complete S QL sentence has been separately configured, then according in configuration information data source ID configure sequence, successively choose complete S QL language Sentence, and complete S QL sentence is placed on to the last execution of all SQL statements ultimately generated, wherein source data includes: source number According to field name and source data table name, target data includes: target data field name and target data table name.
In above-mentioned each embodiment, when data source ID is multiple, if being configured with identical mesh in different data source ID Data are marked, then putting in order according to each data source ID, the ID value covering for operating the target data in current data source is worked as Preceding data source ID previous data source ID operation target data value, wherein target data includes: target data field name and Target data table name.
In practical applications, rule is assembled according to above-mentioned data source configuration method and SQL, develops program using any language The conversion between data source configuration and SQL statement may be implemented.
For Added Business process, the incidence relation allocation list of Added Business process and data source ID can configure as follows:
Process ID (unique identifying number of process), data source ID (can configure multiple, separated with English comma)
When using any language exploitation operation system program, the incidence relation of Added Business process and data source ID is read Allocation list executes its corresponding one group of data source ID when calling each process, and after being finished, used variable will be assigned Value (query pattern) or Database field value will be modified (newly-increased or renewal model).The assignment processing of variable (band []) by Different programming languages are respectively realized.
Corresponding with above method embodiment, the invention also discloses a kind of data sources to configure the system for being converted into SQL.
Referring to Fig. 8, a kind of configuration of data source disclosed in one embodiment of the invention is converted into the system structure diagram of SQL, The system includes:
Information reading unit 501, for reading configuration information, the configuration from pre-set SQL data source allocation list Configuration item in information includes: data source ID, source data field name, source data table name, target data field name, target matrix Screening conditions, complete SQL statement and data action type can be performed in name;
It is recorded in SQL data source allocation list used in the system for settling account that with good grounds preset configuration rule is configured all SQL operation information.
Configuration item in SQL data source allocation list includes: data source ID, source data field name, source data table name, number of targets According to field name, target data table name, screening conditions (i.e. where screening conditions), complete SQL statement and data manipulation can be performed Type.
Wherein, a data source ID includes one group of SQL configuration item, and one group of SQL configuration item includes one or more SQL language Sentence.
Data manipulation type includes: Q:SQL inquiry record data source configuration;The newly-increased record data source configuration of I:SQL;U: The configuration of SQL more new record data source.
It should be noted that the variable name used in source code (non-SQL literary name section name) needs in SQL data source allocation list It is identified with " [] ".
SQL statement generation unit 502, for according to the data manipulation type, using with the data manipulation type pair The SQL assembling rule answered generates the corresponding whole SQL statements of the data source ID.
The present invention be directed to identical data manipulation type, use identical SQL assembling rule, when business function it is identical and When data processing difference, without developing set of system namely source code again without changing, it is only necessary to modify data source configuration information In data.
Wherein, in the case where possessing where screening conditions, the SQL statement of generation will splice where sieve at sentence end Select condition;In the configuration information of reading, if not configuring source data and target data, and complete S QL sentence is separately configured (also should include the source data of signature requirement and the relevant information of target data in complete S QL sentence), then can directly execute Complete S QL sentence, without splicing.
It, can be to each configuration item in configuration information in order to reduce the number of executions of SQL statement to improve execution efficiency It is grouped classification and is assembled into SQL statement, to reduce database I/O (Input/Output, input/output), optimize database Operation.
In summary, data source disclosed by the invention configures the system for being converted into SQL, reads from SQL data source allocation list Configuration information, the configuration item in the configuration information includes: data source ID, source data field name, source data table name, target data word Target data table name, screening conditions, complete SQL statement and data action type can be performed in section name;It is then based on data manipulation Type assembles rule, the corresponding whole SQL statements of Lai Shengcheng data source ID using SQL corresponding with data manipulation type.Due to The present invention uses identical SQL assembling rule for identical data manipulation type (namely business function is identical), therefore, when Business function is identical and when data processing difference, without developing set of system namely source code again without changing, it is only necessary to modify Data in data source configuration information, to eliminated significantly because owning in exploitation new system and test system newly developed Code bring troublesome operation.Further, when data processing when something goes wrong, equally only need to modify data source configuration, be not necessarily to It recompilates program or restarts system, and can come into force immediately, therefore greatly reduce developer and occur in processing data The problem of when workload.
For convenience of understanding, the process of SQL is converted into the following detailed description of data source configuration.
(1) if data manipulation type is that SQL query records data source configuration
SQL statement generation unit 502 specifically includes:
First reading subunit, for being SQL query record data source configuration when the data manipulation type, and when described When data source ID is one, each configuration item is successively read according to the sequence of each configuration item in the configuration information;
First judgment sub-unit, for judging whether the screening conditions are arranged;
First assembling subelement, in the case where first judgment sub-unit is judged as YES, by the source data Table name and the screening conditions are as assembling condition, by the source data table name is identical and the identical field groups of the screening conditions It is attached on the same SQL statement, and all SQL statements that assembling is obtained are according to source data table described in the configuration information The sequencing for the configuration that name and the screening conditions are combined is arranged successively, and obtains one group of SQL query statement;
Second assembling subelement, in the case where first judgment sub-unit is judged as NO, only by the source number According to table name as assembling condition, the identical field of the source data table name is assembled on the same SQL statement, and will be assembled To all SQL statements be arranged successively according to the configuration sequence of source data table name described in the configuration information, obtain one group SQL query statement;
Second reading subunit, for being that SQL query records data source configuration, and the number when the data manipulation type According to source ID be it is multiple when, according to each data source ID put in order and each data source ID in each configuration item sequence according to Secondary each configuration item of reading;
Second judgment sub-unit, for judging whether the screening conditions are arranged;
Third assembles subelement, in the case where second judgment sub-unit is judged as YES, by the data source ID, the source data table name and the screening conditions are as assembling condition, identical, the described source data table name by the data source ID All SQL statements that the identical field of identical and described screening conditions is assembled on the same SQL statement, and assembling is obtained The configuration combined according to data source ID described in the configuration information, the source data table name and the screening conditions Sequencing is arranged successively, and obtains one group of SQL query statement;
4th assembling subelement, in the case where second judgment sub-unit is judged as NO, by the data source ID and the source data table name are as assembling condition, by the identical field groups of the identical and described source data table name of the data source ID It is attached on the same SQL statement, and all SQL statements that assembling is obtained are according to data source ID described in the configuration information The sequencing for the configuration combined with the source data table name is arranged successively, and obtains one group of SQL query statement.
It should be noted that when data manipulation type is that SQL query records data source configuration, SQL statement generation unit 502 concrete operating principle refers to embodiment of the method corresponding part, and details are not described herein again.
In summary, the present invention is that SQL query records data source configuration for data manipulation type, is used identical SQL assembling rule, therefore, when business function is that SQL query records data source configuration, if when data processing difference, without weight Set of system newly developed namely source code are without changing, it is only necessary to the data in data source configuration information are modified, thus significantly It eliminates because of all code bring troublesome operations in exploitation new system and test system newly developed.Further, at data Reason when something goes wrong, equally only needs to modify data source configuration, without recompilating program or restarting system, and can be instant It comes into force, therefore greatly reduces workload of the developer when handling the data problem.
(2) if data manipulation type is the newly-increased record data source configuration of SQL
SQL statement generation unit 502 specifically includes:
Third reading subunit, for recording data source configuration, and the number when the data manipulation type is that SQL is newly-increased According to source ID be one when, be successively read each configuration item according to the sequence of each configuration item in the data source ID;
5th assembling subelement, for the identical field of the target matrix name to be assembled into the same SQL statement, And all SQL statements that assembling obtains successively are arranged according to the configuration sequence of target data table name described in the configuration information Column obtain the newly-increased record sentence of one group of SQL;
4th reading subunit, for recording data source configuration, and the number when the data manipulation type is that SQL is newly-increased According to source ID be it is multiple when, according to each data source ID put in order and each data source ID in each configuration item sequence according to Secondary each configuration item of reading;
6th assembling subelement, for the identical field of the target matrix name to be assembled into the same SQL statement, And all SQL statements for obtaining assembling are according to data source ID described in the configuration information and the target data table name group The sequencing for the configuration being combined is arranged successively, and obtains the newly-increased record sentence of one group of SQL.
It should be noted that when data manipulation type is that the newly-increased record data source of SQL configures, SQL statement generation unit 502 concrete operating principle refers to embodiment of the method corresponding part, and details are not described herein again.
In summary, the present invention is the newly-increased record data source configuration of SQL for data manipulation type, is used identical SQL assembling rule, therefore, when business function, which is that SQL is newly-increased, records data source configuration, if when data processing difference, without weight Set of system newly developed namely source code are without changing, it is only necessary to the data in data source configuration information are modified, thus significantly It eliminates because of all code bring troublesome operations in exploitation new system and test system newly developed.Further, at data Reason when something goes wrong, equally only needs to modify data source configuration, without recompilating program or restarting system, and can be instant It comes into force, therefore greatly reduces workload of the developer when handling the data problem.
(3) if data manipulation type is the configuration of SQL more new record data source
SQL statement generation unit 502 specifically includes:
5th reading subunit, for being that SQL more new record data source configures when the data manipulation type, and the number According to source ID be one when, be successively read each configuration item according to the sequence of each configuration item in the configuration information;
Third judgment sub-unit, for judging whether the screening conditions are arranged;
7th assembling subelement, in the case where the third judgment sub-unit is judged as YES, by the number of targets According to table name and the screening conditions as assembling condition, by the target matrix name is identical and the identical word of the screening conditions Section is assembled on the same SQL statement, and all SQL statements that assembling is obtained are according to target described in the configuration information The sequencing for the configuration that data table name and the screening conditions are combined is arranged successively, and obtains one group of SQL more new record Sentence;
8th assembling subelement, in the case where the third judgment sub-unit is judged as NO, only by the target The identical field of the target matrix name is assembled on the same SQL statement by tables of data name as assembling condition, and by group It fills obtained all SQL statements to be arranged successively according to the configuration sequence of target data table name described in the configuration information, obtain Sentence is updated to one group of SQL;
6th reading subunit, for being that SQL more new record data source configures when the data manipulation type, and the number According to source ID be it is multiple when, according to each data source ID put in order and each data source ID in each configuration item sequence according to Secondary each configuration item of reading;
4th judgment sub-unit, for judging whether the screening conditions are arranged;
9th assembling subelement, in the case where the 4th judgment sub-unit is judged as YES, by the data source ID, the target data table name and the screening conditions are as assembling condition, identical, the described target data by the data source ID All SQL that table name is identical and the identical field of the screening conditions is assembled on the same SQL statement, and assembling is obtained Sentence is combined according to data source ID described in the configuration information, the target data table name and the screening conditions The sequencing of configuration is arranged successively, and obtains one group of SQL more new record sentence;
Tenth assembling subelement, in the case where the 4th judgment sub-unit is judged as NO, by the data source ID and the target matrix name are as assembling condition, by the identical word of the identical and described target matrix name of the data source ID Section is assembled on the same SQL statement, and all SQL statements that assembling is obtained are according to data described in the configuration information The sequencing for the configuration that source ID and the target data table name are combined is arranged successively, and obtains one group of SQL more new record Sentence.
It should be noted that when data manipulation type is that SQL more new record data source configures, SQL statement generation unit 502 concrete operating principle refers to embodiment of the method corresponding part, and details are not described herein again.
In summary, the present invention is the configuration of SQL more new record data source for data manipulation type, is used identical SQL assembling rule, therefore, when business function is that SQL more new record data source configures, if when data processing difference, without weight Set of system newly developed namely source code are without changing, it is only necessary to the data in data source configuration information are modified, thus significantly It eliminates because of all code bring troublesome operations in exploitation new system and test system newly developed.Further, at data Reason when something goes wrong, equally only needs to modify data source configuration, without recompilating program or restarting system, and can be instant It comes into force, therefore greatly reduces workload of the developer when handling the data problem.
In order to further optimize the above embodiments, the system that data source configuration is converted into SQL can also include:
Direct selection unit, if it is not set for source data and target data, and be separately configured in the configuration information Complete S QL sentence, the then sequence configured according to data source ID in the configuration information, successively chooses the complete S QL sentence, And the complete S QL sentence is placed on to the last execution of all SQL statements ultimately generated, wherein the source data includes: The source data field name and the source data table name, the target data includes: the target data field name and the mesh Mark data table name.
In order to further optimize the above embodiments, the system that data source configuration is converted into SQL can also include:
Capping unit is used for when the data source ID is multiple, if being configured with identical mesh in different data source ID Data are marked, then putting in order according to each data source ID, the ID value for operating the target data in current data source is covered into institute The previous data source ID for stating current data source ID operates the value of the target data, wherein the target data includes: target Data field name and target data table name.
Finally, it is to be noted that, herein, relational terms such as first and second and the like be used merely to by One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation Between there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant meaning Covering non-exclusive inclusion, so that the process, method, article or equipment for including a series of elements not only includes that A little elements, but also including other elements that are not explicitly listed, or further include for this process, method, article or The intrinsic element of equipment.In the absence of more restrictions, the element limited by sentence "including a ...", is not arranged Except there is also other identical elements in the process, method, article or apparatus that includes the element.
Each embodiment in this specification is described in a progressive manner, the highlights of each of the examples are with other The difference of embodiment, the same or similar parts in each embodiment may refer to each other.
The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, as defined herein General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, of the invention It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one The widest scope of cause.

Claims (18)

1. a kind of data source configures the method for being converted into SQL characterized by comprising
Configuration information is read from pre-set SQL data source allocation list, the configuration item in the configuration information includes: data source ID, it source data field name, source data table name, target data field name, target data table name, screening conditions, can be performed completely SQL statement and data action type;
According to the data manipulation type, rule is assembled using SQL corresponding with the data manipulation type, generates the data The corresponding whole SQL statements of source ID.
2. the method according to claim 1, wherein when the data manipulation type is that SQL query records data It is described according to the data manipulation type when source configures, rule is assembled using SQL corresponding with the data manipulation type, it is raw At the corresponding whole SQL statements of the data source ID, specifically include:
When the data source ID is one, each is successively read according to the sequence of each configuration item in the configuration information and is matched Set item;
Judge whether the screening conditions are arranged;
If it is, using the source data table name and the screening conditions as assembling condition, the source data table name is identical And the identical field of the screening conditions all SQL statements for being assembled on the same SQL statement, and assembling being obtained according to The sequencing for the configuration that source data table name described in the configuration information and the screening conditions are combined is arranged successively, Obtain one group of SQL query statement;
If it is not, then only the identical field of the source data table name is assembled into using the source data table name as assembling condition On the same SQL statement, and all SQL statements that assembling is obtained are according to source data table name described in the configuration information Configuration sequence is arranged successively, and obtains one group of SQL query statement.
3. according to the method described in claim 2, it is characterized by further comprising:
When the data source ID is multiple, according to each data source ID put in order and each data source ID in each match The sequence for setting item is successively read each configuration item;
Judge whether the screening conditions are arranged;
If it is, using the data source ID, the source data table name and the screening conditions as assembling condition, by the number Identical according to source ID, the described source data table name is identical and the identical field of the screening conditions is assembled on the same SQL statement, and By the obtained all SQL statements of assembling according to data source ID described in the configuration information, the source data table name and described The sequencing for the configuration that screening conditions are combined is arranged successively, and obtains one group of SQL query statement;
If it is not, then using the data source ID and the source data table name as assembling condition, by the data source ID it is identical and All SQL statements that the identical field of the source data table name is assembled on the same SQL statement, and assembling is obtained according to The sequencing for the configuration that data source ID described in the configuration information and the source data table name are combined is arranged successively, Obtain one group of SQL query statement.
4. the method according to claim 1, wherein when the data manipulation type is the newly-increased record data of SQL It is described according to the data manipulation type when source configures, rule is assembled using SQL corresponding with the data manipulation type, it is raw At the corresponding whole SQL statements of the data source ID, specifically include:
When the data source ID is one, each is successively read according to the sequence of each configuration item in the data source ID and is matched Set item;
All SQL that the identical field of the target matrix name is assembled on the same SQL statement, and assembling is obtained Sentence is arranged successively according to the configuration sequence of target data table name described in the configuration information, obtains the newly-increased record of one group of SQL Sentence.
5. according to the method described in claim 4, it is characterized by further comprising:
When the data source ID is multiple, according to each data source ID put in order and each data source ID in each match The sequence for setting item is successively read each configuration item;
The data source ID and the identical field of the target matrix name are assembled on the same SQL statement, and will assembling Obtained all SQL statements are combined according to data source ID described in the configuration information and the target data table name The sequencing of configuration be arranged successively, obtain the newly-increased record sentence of one group of SQL.
6. the method according to claim 1, wherein when the data manipulation type is SQL more new recorded data It is described according to the data manipulation type when source configures, rule is assembled using SQL corresponding with the data manipulation type, it is raw At the corresponding whole SQL statements of the data source ID, specifically include:
When the data source ID is one, each is successively read according to the sequence of each configuration item in the configuration information and is matched Set item;
Judge whether the screening conditions are arranged;
If it is, using the target data table name and the screening conditions as assembling condition, by the target data table name All SQL statements that the identical field of identical and described screening conditions is assembled on the same SQL statement, and assembling is obtained The sequencing for the configuration combined according to target data table name described in the configuration information and the screening conditions according to Secondary arrangement obtains one group of SQL more new record sentence;
If it is not, then only using the target matrix name as assembling condition, by the identical field groups of the target matrix name It is attached on the same SQL statement, and all SQL statements that assembling is obtained are according to target data described in the configuration information The configuration sequence of table name is arranged successively, and is obtained one group of SQL and is updated sentence.
7. according to the method described in claim 6, it is characterized by further comprising:
When the data source ID is multiple, according to each data source ID put in order and each data source ID in each match The sequence for setting item is successively read each configuration item;
Judge whether the screening conditions are arranged;
If it is, using the data source ID, the target data table name and the screening conditions as assembling condition, it will be described Data source ID is identical, the target matrix name is identical and the identical field of the screening conditions is assembled into the same SQL statement On, and all SQL statements that assembling is obtained are according to data source ID described in the configuration information, the target data table name The sequencing for the configuration combined with the screening conditions is arranged successively, and obtains one group of SQL more new record sentence;
If it is not, then using the data source ID and the target matrix name as assembling condition, the data source ID is identical Field identical with the target matrix name is assembled on the same SQL statement, and all SQL statements that assembling is obtained The sequencing for the configuration combined according to data source ID described in the configuration information and the target data table name according to Secondary arrangement obtains one group of SQL more new record sentence.
8. the method according to claim 1, wherein further include:
If source data and target data are not set, and have been separately configured complete S QL sentence in the configuration information, then according to institute The sequence for stating the configuration of data source ID described in configuration information, successively chooses the complete S QL sentence, and by the complete S QL language Sentence is placed on the last execution of all SQL statements ultimately generated, wherein the source data includes: the source data field name With the source data table name, the target data includes: the target data field name and the target data table name.
9. the method according to claim 1, wherein further include:
When the data source ID is multiple, if identical target data is configured in different data source ID, according to each Data source ID's puts in order, before the ID value for operating the target data in current data source is covered the current data source ID One data source ID operates the value of the target data, wherein the target data includes: target data field name and number of targets According to table name.
10. a kind of data source configures the system for being converted into SQL characterized by comprising
Information reading unit, for from pre-set SQL data source allocation list reading configuration information, the configuration information Configuration item includes: data source ID, source data field name, source data table name, target data field name, target data table name, screening Complete SQL statement and data action type can be performed in condition;
SQL statement generation unit is used for according to the data manipulation type, using SQL corresponding with the data manipulation type Assembling rule generates the corresponding whole SQL statements of the data source ID.
11. system according to claim 10, which is characterized in that the SQL statement generation unit specifically includes:
First reading subunit, for being that SQL query records data source configuration, and works as the data when the data manipulation type When source ID is one, each configuration item is successively read according to the sequence of each configuration item in the configuration information;
First judgment sub-unit, for judging whether the screening conditions are arranged;
First assembling subelement, in the case where first judgment sub-unit is judged as YES, by the source data table name It is the source data table name is identical and the identical field of the screening conditions is assembled into the screening conditions as assembling condition On the same SQL statement, and by the obtained all SQL statements of assembling according to source data table name described in the configuration information and The sequencing for the configuration that the screening conditions are combined is arranged successively, and obtains one group of SQL query statement;
Second assembling subelement, in the case where first judgment sub-unit is judged as NO, only by the source data table Name is used as assembling condition, and the identical field of the source data table name is assembled on the same SQL statement, and assembling is obtained All SQL statements are arranged successively according to the configuration sequence of source data table name described in the configuration information, are obtained one group of SQL and are looked into Ask sentence.
12. system according to claim 11, which is characterized in that further include:
Second reading subunit, for being that SQL query records data source configuration, and the data source when the data manipulation type When ID is multiple, according to each data source ID put in order and each data source ID in the sequence of each configuration item successively read Take each configuration item;
Second judgment sub-unit, for judging whether the screening conditions are arranged;
Third assembles subelement, in the case where second judgment sub-unit is judged as YES, by the data source ID, institute Source data table name and the screening conditions are stated as assembling condition, it is the data source ID is identical, the source data table name is identical And the identical field of the screening conditions all SQL statements for being assembled on the same SQL statement, and assembling being obtained according to The configuration that data source ID described in the configuration information, the source data table name and the screening conditions are combined it is successive Sequence is arranged successively, and obtains one group of SQL query statement;
4th assembling subelement, in the case where second judgment sub-unit is judged as NO, by the data source ID and The identical field of the identical and described source data table name of the data source ID is assembled by the source data table name as assembling condition On the same SQL statement, and all SQL statements that assembling is obtained are according to data source ID described in the configuration information and institute The sequencing for stating the configuration that source data table name is combined is arranged successively, and obtains one group of SQL query statement.
13. system according to claim 10, which is characterized in that the SQL statement generation unit specifically includes:
Third reading subunit, for recording data source configuration, and the data source when the data manipulation type is that SQL is newly-increased When ID is one, each configuration item is successively read according to the sequence of each configuration item in the data source ID;
5th assembling subelement, for the identical field of the target matrix name to be assembled into the same SQL statement, and will Obtained all SQL statements are assembled to be arranged successively according to the configuration sequence of target data table name described in the configuration information, Obtain the newly-increased record sentence of one group of SQL.
14. system according to claim 13, which is characterized in that further include:
4th reading subunit, for recording data source configuration, and the data source when the data manipulation type is that SQL is newly-increased When ID is multiple, according to each data source ID put in order and each data source ID in the sequence of each configuration item successively read Take each configuration item;
6th assembling subelement, for the identical field of the target matrix name to be assembled into the same SQL statement, and will Obtained all SQL statements are assembled to exist according to data source ID described in the configuration information and target data table name combination The sequencing of configuration together is arranged successively, and obtains the newly-increased record sentence of one group of SQL.
15. system according to claim 10, which is characterized in that the SQL statement generation unit specifically includes:
5th reading subunit, for being that SQL more new record data source configures when the data manipulation type, and the data source When ID is one, each configuration item is successively read according to the sequence of each configuration item in the configuration information;
Third judgment sub-unit, for judging whether the screening conditions are arranged;
7th assembling subelement, in the case where the third judgment sub-unit is judged as YES, by the target matrix Name and the screening conditions are as assembling condition, by the target matrix name is identical and the identical field groups of the screening conditions It is attached on the same SQL statement, and all SQL statements that assembling is obtained are according to target data described in the configuration information The sequencing for the configuration that table name and the screening conditions are combined is arranged successively, and obtains one group of SQL more new record sentence;
8th assembling subelement, in the case where the third judgment sub-unit is judged as NO, only by the target data The identical field of the target matrix name is assembled on the same SQL statement by table name as assembling condition, and will be assembled To all SQL statements be arranged successively according to the configuration sequence of target data table name described in the configuration information, obtain one Group SQL updates sentence.
16. system according to claim 15, which is characterized in that further include:
6th reading subunit, for being that SQL more new record data source configures when the data manipulation type, and the data source When ID is multiple, according to each data source ID put in order and each data source ID in the sequence of each configuration item successively read Take each configuration item;
4th judgment sub-unit, for judging whether the screening conditions are arranged;
9th assembling subelement, in the case where the 4th judgment sub-unit is judged as YES, by the data source ID, institute Target data table name and the screening conditions are stated as assembling condition, identical, the described target data table name by the data source ID All SQL statements that the identical field of identical and described screening conditions is assembled on the same SQL statement, and assembling is obtained The configuration combined according to data source ID described in the configuration information, the target data table name and the screening conditions Sequencing be arranged successively, obtain one group of SQL more new record sentence;
Tenth assembling subelement, in the case where the 4th judgment sub-unit is judged as NO, by the data source ID and The target matrix name is as assembling condition, by the identical field groups of the identical and described target matrix name of the data source ID It is attached on the same SQL statement, and all SQL statements that assembling is obtained are according to data source ID described in the configuration information The sequencing for the configuration combined with the target data table name is arranged successively, and obtains one group of SQL more new record sentence.
17. system according to claim 10, which is characterized in that further include:
Direct selection unit, if it is not set for source data and target data, and be separately configured in the configuration information complete Whole SQL statement, the then sequence configured according to data source ID described in the configuration information, successively chooses the complete S QL sentence, And the complete S QL sentence is placed on to the last execution of all SQL statements ultimately generated, wherein the source data includes: The source data field name and the source data table name, the target data includes: the target data field name and the mesh Mark data table name.
18. system according to claim 10, which is characterized in that further include:
Capping unit is used for when the data source ID is multiple, if being configured with identical number of targets in different data source ID According to then putting in order according to each data source ID, current data source ID is operated and is worked as described in the value covering of the target data The previous data source ID of preceding data source ID operates the value of the target data, wherein the target data includes: target data Field name and target data table name.
CN201811527037.4A 2018-12-13 2018-12-13 A kind of data source configuration is converted into the method and system of SQL Pending CN109634984A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811527037.4A CN109634984A (en) 2018-12-13 2018-12-13 A kind of data source configuration is converted into the method and system of SQL

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811527037.4A CN109634984A (en) 2018-12-13 2018-12-13 A kind of data source configuration is converted into the method and system of SQL

Publications (1)

Publication Number Publication Date
CN109634984A true CN109634984A (en) 2019-04-16

Family

ID=66073642

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811527037.4A Pending CN109634984A (en) 2018-12-13 2018-12-13 A kind of data source configuration is converted into the method and system of SQL

Country Status (1)

Country Link
CN (1) CN109634984A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110134687A (en) * 2019-05-13 2019-08-16 福建南威软件有限公司 A kind of method and system changing control inventory element by the dynamic increasing of literary name section
CN112508346A (en) * 2020-11-17 2021-03-16 四川新网银行股份有限公司 Method for realizing indexed business data auditing
CN112883073A (en) * 2021-03-22 2021-06-01 北京同邦卓益科技有限公司 Data screening method, device, equipment, readable storage medium and product
CN113449221A (en) * 2021-03-22 2021-09-28 北京新氧科技有限公司 Page screening method and device, terminal equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104199675A (en) * 2014-09-26 2014-12-10 佛山市恒南微科技有限公司 System capable of quick system development based on database parameter utilization
CN105787052A (en) * 2016-02-26 2016-07-20 广州品唯软件有限公司 Data processing model building method and data screening method based on data processing model
US20170124140A1 (en) * 2015-03-09 2017-05-04 Vinyl Development LLC Source Independent Query Language
CN107506442A (en) * 2017-08-24 2017-12-22 中国银行股份有限公司 The modeling method and device of a kind of model
CN107633016A (en) * 2017-08-23 2018-01-26 阿里巴巴集团控股有限公司 Data processing method and device and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104199675A (en) * 2014-09-26 2014-12-10 佛山市恒南微科技有限公司 System capable of quick system development based on database parameter utilization
US20170124140A1 (en) * 2015-03-09 2017-05-04 Vinyl Development LLC Source Independent Query Language
CN105787052A (en) * 2016-02-26 2016-07-20 广州品唯软件有限公司 Data processing model building method and data screening method based on data processing model
CN107633016A (en) * 2017-08-23 2018-01-26 阿里巴巴集团控股有限公司 Data processing method and device and electronic equipment
CN107506442A (en) * 2017-08-24 2017-12-22 中国银行股份有限公司 The modeling method and device of a kind of model

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110134687A (en) * 2019-05-13 2019-08-16 福建南威软件有限公司 A kind of method and system changing control inventory element by the dynamic increasing of literary name section
CN112508346A (en) * 2020-11-17 2021-03-16 四川新网银行股份有限公司 Method for realizing indexed business data auditing
CN112508346B (en) * 2020-11-17 2022-06-24 四川新网银行股份有限公司 Method for realizing indexed business data auditing
CN112883073A (en) * 2021-03-22 2021-06-01 北京同邦卓益科技有限公司 Data screening method, device, equipment, readable storage medium and product
CN113449221A (en) * 2021-03-22 2021-09-28 北京新氧科技有限公司 Page screening method and device, terminal equipment and storage medium
CN113449221B (en) * 2021-03-22 2023-09-01 北京新氧科技有限公司 Page screening method and device, terminal equipment and storage medium
CN112883073B (en) * 2021-03-22 2024-04-05 北京同邦卓益科技有限公司 Data screening method, device, equipment, readable storage medium and product

Similar Documents

Publication Publication Date Title
CN109634984A (en) A kind of data source configuration is converted into the method and system of SQL
CN102722372B (en) Method and system for automatically generating codes through classification and configuration
CN101593111B (en) Service component, method and system for developing application software based on service component
CN104536811A (en) HIVE task based task scheduling method and device
JP6667931B2 (en) Method and device for recognizing time information from audio information
US9081626B2 (en) Method and apparatus for converting software
CN102567413B (en) System and method for data filtering
CN101551760A (en) Representation of data transformation processes for parallelization
CN103995698A (en) Application form agile development method and system oriented to business
CN105653630A (en) Data migration method and apparatus for distributed database
CN111767144B (en) Transaction route determination method, device, equipment and system for transaction data
CN110990396B (en) Data storage method, device and storage medium
CN112181402B (en) Business processing method and device of business system, storage medium and electronic equipment
CN105005543A (en) Interface generation apparatus and method
CN104679500A (en) Automatic generation realizing method and device for entity classes
CN111581183A (en) Data migration method and device based on data model
CN115114146A (en) Interface test method, device, equipment and storage medium
CN111061733A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN113157691A (en) Configurable data searching method and system
EP3853714B1 (en) Analyzing natural language expressions in a data visualization user interface
CN111008011A (en) System builder for power platform application development
CN106484492A (en) The method and system of configuration interface
CN104572921A (en) Cross-datacenter data synchronization method and device
CN110674214B (en) Big data synchronization method, device, computer equipment and storage medium
CN107402752B (en) Timing triggering method and device for application

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190416