CN106547765A - Data base management method and device based on SQL - Google Patents
Data base management method and device based on SQL Download PDFInfo
- Publication number
- CN106547765A CN106547765A CN201510601117.XA CN201510601117A CN106547765A CN 106547765 A CN106547765 A CN 106547765A CN 201510601117 A CN201510601117 A CN 201510601117A CN 106547765 A CN106547765 A CN 106547765A
- Authority
- CN
- China
- Prior art keywords
- sql
- mobilism
- data base
- logical structure
- sql statement
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/21—Design, administration or maintenance of databases
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a kind of data base management method based on SQL, the method includes:The SQL statement of receiving user's input;The SQL statement of the reception is processed, the mobilism SQL script with logical structure is generated;The database object in data base is updated according to the mobilism SQL script with logical structure.The invention also discloses a kind of data bank management device based on SQL.Using the present invention, directly data base can be updated according to the mobilism SQL script that should carry logical structure, improve database update efficiency.
Description
Technical field
The present invention relates to Computer Applied Technology field, more particularly to a kind of data base administration side based on SQL
Method and device.
Background technology
At present, in many computer application systems, with SQL (Structured Query Language,
SQL) data base based on language assume responsibility for storage and the service logic of system business data
Calculating.During computer development, with the expansion of operation system, new data base is constantly produced
, in script management there are various patches, but with the continuous expansion of operation system, easily causes in script
The disappearance of sql scripts, and for across a set of or general database application system of several sets and on its basis
When being continually developed according to business and being extended, database maintenance is got up and is taken time and effort very much, especially existed
When scene carries out database cross multistage function upgrading, need every time to extract increment script, thereby tend to easily
Holiday script function, and cannot realize carrying out upgrading renewal to data base.In conventional data base's foot
Easily occur in this function management:A developer's foundation business demand A, on the platform of database product storehouse,
Object is increased to Database Systems, after the completion of, require a great deal of time and extract upgrading SQL scripts
(proposing increment script), just realizes the function of business A.
The above is only used for auxiliary and understands technical scheme, does not represent and recognizes that the above is
Prior art.
The content of the invention
Present invention is primarily targeted at providing a kind of data base management method and device based on SQL, purport
When in prior art is solved upgrading data base, need to extract increment script, easy holiday
Script and cause the technical problem to database upgrade failure.
The database object in data base is updated according to the SQL statement of user input, so as in reality
The database object in the data base can be directly invoked in the production environment of border.
For achieving the above object, the present invention provides a kind of data base management method based on SQL, the method
Including:
The SQL statement of receiving user's input;
The SQL statement of the reception is processed, the mobilism SQL script with logical structure is generated;
The database object in data base is carried out according to the mobilism SQL script with logical structure
Update.
Preferably, the SQL statement to the reception is processed, and is generated dynamic with logical structure
The step of state SQL script, includes:
Pretreatment is carried out to the SQL statement of the reception;
Mobilism is carried out to the pretreated SQL statement, mobilism SQL statement is generated;
According to default keyword and the mapping relations of logic template, the mobilism SQL statement pair is obtained
The logic template answered;The mobilism SQL statement is applied mechanically into the logic template of the acquisition, and according to number
According to storehouse grammer, the mobilism SQL statement for having applied mechanically logic template is merged, is generated and is tied with logic
The mobilism SQL script of structure.
Preferably, the SQL statement to the reception carries out pretreatment includes:SQL to the reception
Sentence carries out pre-formatting process, details and splits and/or details format conversion.
Preferably, the mobilism SQL script with logical structure described in the basis is to the number in data base
The step of being updated according to storehouse object includes:
Whether there is the corresponding data of mobilism SQL script with logical structure in judging the data base
Storehouse object;
If there is no the corresponding database object of SQL scripts with logical structure in the data base,
Corresponding data base couple is created in data base according to the mobilism SQL script with logical structure then
As.
Preferably, with the presence or absence of the mobilism SQL foot with logical structure in described judgement data base
After the step of this corresponding database object, the method also includes:
If there is the corresponding data base couple of mobilism SQL script with logical structure in the data base
As then being repaiied to corresponding database object according to the mobilism SQL script with logical structure
Change.
Additionally, for achieving the above object, the present invention also provides a kind of data bank management device based on SQL,
The device includes:
Receiver module, for the SQL statement of receiving user's input;
Generation module, for processing to the SQL statement of the reception, generates with logical structure
Mobilism SQL script;
Update module, for according to the mobilism SQL script with logical structure in data base
Database object is updated.
Preferably, the generation module includes:
Pretreatment unit, carries out pretreatment for the SQL statement to the reception;
First signal generating unit, for mobilism is carried out to the pretreated SQL statement, generates dynamic
Change SQL statement;
Second signal generating unit, for according to default keyword and the mapping relations of logic template, obtaining institute
State the corresponding logic template of mobilism SQL statement;The mobilism SQL statement is applied mechanically into the acquisition
Logic template, and according to database syntax, the mobilism SQL statement for having applied mechanically logic template is closed
And, generate the mobilism SQL script with logical structure.
Preferably, the SQL statement to the reception carries out pretreatment includes:SQL to the reception
Sentence carries out pre-formatting process, details and splits and/or details format conversion.
Preferably, the update module includes:
Judging unit, for judging in the data base with the presence or absence of mobilism SQL with logical structure
The corresponding database object of script;
First updating block, for there is no the mobilism with logical structure in the database
During the corresponding database object of SQL scripts, existed according to the mobilism SQL script with logical structure
Corresponding database object is created in data base.
Preferably, the update module also includes:
Second updating block, for there is mobilism SQL with logical structure in the database
During the corresponding database object of script, according to the mobilism SQL script with logical structure to correspondence
Database object modify.
The data base management method based on SQL and device of the present invention, by the SQL of receiving user's input
Sentence;The SQL statement of the reception is processed, the mobilism SQL foot with logical structure is generated
This;The database object in data base is carried out according to the mobilism SQL script with logical structure
Update;SQL statement i.e. to receiving is processed, and generates the mobilism SQL script with logical structure,
So that the mobilism SQL script with logical structure of the generation can be directly used for carrying out more data base
Newly;Then storehouse is updated the data further according to the mobilism SQL script with logical structure, so as in reality
Directly data base can be carried out more according to the mobilism SQL script that should carry logical structure in production environment
Newly, improve database update efficiency.
Description of the drawings
Fig. 1 is schematic flow sheet of the present invention based on the preferred embodiment of the data base management method of SQL;
Fig. 2 be the present invention based on the data base management method of SQL in the SQL statement to the reception carry out
Process, generate the refinement schematic flow sheet of the mobilism SQL script with logical structure;
Fig. 3 be the SQL statement to the reception is carried out in the present invention pretreatment an embodiment it is thin
Change schematic flow sheet;
Fig. 4 is the present invention based on dynamic with logical structure described in the basis in the data base management method of SQL
The refinement schematic flow sheet that state SQL script is updated to the database object in data base;
Fig. 5 is structural representation of the present invention based on the preferred embodiment of the data bank management device of SQL;
Fig. 6 is refinement structural representation of the present invention based on the generation module of the data bank management device of SQL;
Fig. 7 is refinement structural representation of the present invention based on the pretreatment unit of the data bank management device of SQL
Figure;
Fig. 8 is refinement structural representation of the present invention based on the update module of the data bank management device of SQL.
The realization of the object of the invention, functional characteristics and advantage will be done further in conjunction with the embodiments referring to the drawings
Explanation.
Specific embodiment
It should be appreciated that specific embodiment described herein is not used to limit only to explain the present invention
The fixed present invention.
With reference to Fig. 1, Fig. 1 is stream of the present invention based on the preferred embodiment of the data base management method of SQL
Journey schematic diagram, the method include:
The SQL statement of S10, receiving user's input.
User is according to database object input SQL statement to be updated.In this step, receive user is defeated
The SQL statement for entering, database object include table, index, view, chart, lack awake value, regular, tactile
Send out device, grammer, storing process, user, sequence.Such as when database object to be updated is table, and should
Table is as shown in Table 1.
Table one:
According to the SQL statement of one receiving user's input of table, the SQL statement of reception is as follows:
S20, the SQL statement to the reception are processed, and generate mobilism SQL with logical structure
Script.
SQL statement to receiving in step slo is processed, and such as carries out availability verification and specification
Change is processed, and generates the mobilism SQL script with logical structure.Specifically, can be to the SQL of the reception
Sentence carries out specific pre-formatting process, details fractionation, details format conversion, dynamic according to preset rules
State SQL statement is converted, applies mechanically logic template etc., generates the mobilism SQL script with logical structure,
The mobilism SQL script that logical structure should be carried can be used directly to update the data storehouse.
Mobilism SQL script with the logical structure classification storage of the generation such as can be carried according to this
The affiliated item types of the mobilism SQL script of logical structure carry out classification storage, will such as belong to project
1 all mobilism SQL scripts with logical structure are stored in file 1, will belong to project 2
All mobilism SQL scripts with logical structure be stored in file 2, etc., it is convenient to manage
And maintenance.During Field Force's deployment upgrade database, stored good tie with logic can be directly invoked
The mobilism SQL script of structure is updated to data base.
S30, basis should carry the mobilism SQL script of logical structure to the database object in data base
It is updated.
The SQL scripts with logical structure are performed to generate corresponding database object, according to the generation
Database object the database object in the data base is updated.Can directly according to should be with patrolling
The SQL scripts for collecting structure are updated to data base, data base are carried out without extracting increment script
Update.
When the mobilism SQL script with logical structure is to delete script, then will be right in data base
Database object is answered to delete;When the mobilism SQL script with logical structure is to increase script, then
Increase corresponding database object in the data base;When the mobilism SQL script with logical structure
When being modification script, then in the data base, correspondence database object is modified.
Using above-described embodiment, by the SQL statement of receiving user's input;SQL statement to the reception
Processed, generated the mobilism SQL script with logical structure;It is dynamic with logical structure according to this
State SQL script is updated to the database object in data base;SQL statement i.e. to receiving is carried out
Process, generate the mobilism SQL script with logical structure so that the generation with logical structure
Mobilism SQL script can be directly used for being updated data base;Then logical structure is carried further according to this
Mobilism SQL script update the data storehouse, so that the data base can be directly updated in actual production environment
In database object.
As shown in Fig. 2 Fig. 2 be the present invention based on the data base management method of SQL in the reception
SQL statement is processed, and generates the refinement schematic flow sheet of the mobilism SQL script with logical structure,
Details are as follows:
S21, the SQL statement to the reception carry out pretreatment.
In this step, pretreatment is carried out to the SQL statement of the reception, to generate available and standardize
SQL statement.
Pretreatment is carried out to the SQL statement of the reception includes:Pre- form is carried out to the SQL statement of the reception
Change process, details split and/or details format conversion.
Pre-formatting process is carried out to the SQL statement of the reception, to delete unnecessary space, delete unnecessary
Carriage return character, delete useless annotation etc..Preferably, carrying out pre-formatting in the SQL statement to receiving
During process, specific pre-formatting process can be carried out according to preset rules, in the SQL statement that will such as receive
Annotation delete, will receive SQL statement in excess space delete etc..In the SQL statement to receiving
When carrying out details fractionation, specific details fractionation can be carried out according to preset rules, such as according to default fractionation
Symbol carries out details fractionation to the SQL statement for receiving, for, between database object table, major key, this is torn open
Point symbol can for ";Carriage return ", for field between database table, the fractionation symbol is ", carriage return ".
When the SQL statement to receiving carries out details formatting conversion, can be carried out according to preset rules specific thin
Section format is converted, such as keyword capital and small letter is carried out changing, single quotation marks is substituted for two list reference signs,
English character punctuate etc. is substituted for Chinese punctuate.
S22, mobilism is carried out to the pretreated SQL statement, generate mobilism SQL statement.
Variable v_sql is given to the pretreated SQL statement, mobilism SQL statement is generated.As being somebody's turn to do
Pretreated SQL statement is:
alter table T1add COL1char(10)default”0”;
Mobilism is carried out to the pretreated SQL statement, mobilism SQL statement is generated, is:
v_sql:=' alter table T1add COL1char (10) default " 0 " ';
Thus, the pretreated SQL statement is given variable v_sql, become dynamic SQL statements.
S23, according to the mapping relations of default keyword and logic template, obtain the mobilism SQL language
The corresponding logic template of sentence;The mobilism SQL statement is applied mechanically into the logic template of the acquisition, and according to number
According to storehouse grammer, the mobilism SQL statement that this has been applied mechanically logic template merges, generates with logical structure
Mobilism SQL script.
In the mapping relations of the default keyword and logic template, keyword creat table, drop are included
Table, alter table etc., each keyword correspond to a logic template.In this step, according to this
Default keyword and the mapping relations of logic template, get the corresponding logic of mobilism SQL statement
Template, such as the mobilism SQL statement include keyword creat table, then from the keyword and logic mould
The corresponding logic template of mobilism SQL statement can be got in the mapping relations of plate for creat table couple
The logic template answered, then uses the mobilism SQL statement set on the logic template of the acquisition.
Such as when mobilism SQL statement is v_sql:=' create table T1 (COL1int not null, COL1
char(10)default''0'')’;Following sentence is formed after applying mechanically logic template:
Such as when mobilism SQL statement is v_sql:=' alter table T1add COL1char (10) default
”0”';Following sentence is formed after applying mechanically logic template:
According to database syntax, the mobilism SQL statement for having been applied mechanically logic template merges, and generation is carried
The mobilism SQL script of logical structure.The database syntax is first table major key external key storing process again again again
The order such as retrigger.
As shown in figure 3, Fig. 3 is the enforcement for carrying out pretreatment in the present invention to the SQL statement of the reception
The refinement schematic flow sheet of example, it is as follows in detail:
S211, the SQL statement to the reception carry out pre-formatting process.
Specific pre-formatting process, the note in the SQL statement that will such as receive can be carried out according to preset rules
Excess space deletion in the SQL statement that release deletion, will receive etc..SQL such as to receiving in step S10
Sentence carries out pre-formatting process, will annotate " --- explanation:The test table that establishment is used " is deleted, by " T1
Excess space between add " is deleted, and generates following SQL statement:
S212, to pre-formatting process after SQL statement carry out details fractionation.
Grammer is created according to database object, database object to be split is pre-defined and need not be torn open
The database object for dividing.For database object to be split, to the SQL statement of database object with pre-
If fractionation character carry out deconsolidation process, split into substatement.For example, for database object table, master
Between key, the fractionation symbol can for ";Carriage return ", for field between database table, the fractionation symbol is
", carriage return ".
Such as, the SQL statement after processing to the pre-formatting in step S211 splits, to split symbol
Number ";Carriage return " is split, and splits into 4 clauses, as follows:
For words and expressions a), secondary fractionation can be carried out to literary name section, be split with splitting symbol ", carriage return ",
2 clauses are split into, it is as follows:
e)、COL1int not null
f)、COL2char(10)default'0'
S213, to details split after SQL statement carry out details format conversion.
Specific details format conversion can be carried out according to preset rules, such as keyword capital and small letter is carried out changing,
Two single reference signs are substituted for single quotation marks, English character punctuate etc. is substituted for Chinese punctuate, generate shape
The SQL statement of formula compliant.
The SQL carried out after details fractionation in such as to step S212 carries out details format conversion, by COL2
Char (10) default'0' is converted into:COL2char (10) default''0'', will single quotation marks be substituted for two
Single quotation marks;Alter table are converted into:Alter table, capitalization that will be in keyword make small letter into.
In other embodiments, when carrying out pretreatment to the SQL statement of the reception, pre-formatting process,
Details splits, the execution sequence of details format conversion arbitrarily can be arranged.
With reference to Fig. 4, Fig. 4 is according to should the mobilism SQL script logarithm with logical structure in the present invention
The refinement schematic flow sheet being updated according to the database object in storehouse, details are as follows:
S31, judge in the data base with the presence or absence of the correspondence of the mobilism SQL script with logical structure
Database object, if there are no the corresponding data of SQL scripts with logical structure in the data base
Storehouse object, then execution step S32, otherwise performs S33.
By in the corresponding database object of mobilism SQL statement with logical structure and the data base
Database object is matched one by one, if in the data base, having database object and should tie with logic
The corresponding database object matching of SQL scripts of structure, then it is assumed that existing in the data should be with logical structure
The corresponding database object of mobilism SQL script.Such as, when mobilism SQL with logical structure
The corresponding database object of sentence is table T1, also has table T1, then can determine the data in the data base
There is the corresponding database object of mobilism SQL script with logical structure in storehouse.
S32, basis should carry the mobilism SQL script of logical structure and corresponding number was created in data base
According to storehouse object.
In this step, due to there is no the mobilism SQL script pair with logical structure in data base
The database object answered, then increase the mobilism SQL script with logical structure in the data base newly
Database object, is updated to the data base.
S33, basis should carry the mobilism SQL script of logical structure to corresponding data base in data base
Object is modified.
In this step, there is the correspondence of the mobilism SQL statement with logical structure in data base
Database object, but due to this with logical structure the corresponding data base couple of mobilism SQL statement
As the particular content of database object corresponding with present in the data base there may be difference, then need
Corresponding database object is modified according to the mobilism SQL statement with logical structure, such as should
The corresponding database object of mobilism SQL statement with logical structure is T1, including field COL1,
But database object table T1 in data base does not include field COL1, then the data in the data base
Increase field COL1 in Object table T1 of storehouse, complete the modification for database object T1, realize to this
The renewal of data base.
With reference to Fig. 5, Fig. 5 is knot of the present invention based on the preferred embodiment of the data bank management device of SQL
Structure schematic diagram, the device include:
Receiver module 10, for the SQL statement of receiving user's input;
Generation module 20, for processing to the SQL statement of the reception, generates with logical structure
Mobilism SQL script;
Update module 30, should carry the mobilism SQL script of logical structure in data base for basis
Database object is updated.
User is according to database object input SQL statement to be updated.10 receive user of receiver module is defeated
The SQL statement for entering, database object include table, index, view, chart, lack awake value, regular, tactile
Send out device, grammer, storing process, user, sequence.Such as when database object to be updated is table, and should
Table is as shown in above-mentioned table one.
According to the SQL statement of one receiving user's input of above-mentioned table, the SQL statement of reception is as follows:
The generation module 20 is processed in the SQL statement received to receiver module 10, such as can use
Property verification and standardization processing, generate with logical structure mobilism SQL script.Specifically, may be used
To the SQL statement of the reception according to preset rules carry out specific pre-formatting process, details split, it is thin
Section format conversion, mobilism SQL statement are converted, apply mechanically logic template etc., are generated with logical structure
Mobilism SQL script, the mobilism SQL script that should carry logical structure can be used directly to update the data storehouse.
Mobilism SQL script with the logical structure classification storage of the generation such as can be carried according to this
The affiliated item types of the mobilism SQL script of logical structure carry out classification storage, will such as belong to project
1 all mobilism SQL scripts with logical structure are stored in file 1, will belong to project 2
All mobilism SQL scripts with logical structure be stored in file 2, etc., it is convenient to manage
And maintenance.During Field Force's deployment upgrade database, stored good tie with logic can be directly invoked
The mobilism SQL script of structure is updated to data base.
The update module 30 performs the SQL scripts with logical structure to generate corresponding data base couple
As being updated to the database object in the data base according to the database object of the generation.Can be straight
Connect and data base is updated according to the SQL scripts that should carry logical structure, without extracting increment foot
This is updated to data base.
When the mobilism SQL script with logical structure is to delete script, then will be right in data base
Database object is answered to delete;When the mobilism SQL script with logical structure is to increase script, then
Increase corresponding database object in the data base;When the mobilism SQL script with logical structure
When being modification script, then in the data base, correspondence database object is modified.
Further, as shown in fig. 6, the generation module 20 includes:
Pretreatment unit 21, carries out pretreatment for the SQL statement to the reception;
First signal generating unit 22, for mobilism is carried out to the pretreated SQL statement, generates dynamic
Change SQL statement;
Second signal generating unit 23, for according to default keyword and the mapping relations of logic template, obtaining
The corresponding logic template of mobilism SQL statement;The mobilism SQL statement is applied mechanically into the logic of the acquisition
Template, and according to database syntax, the mobilism SQL statement that this has been applied mechanically logic template merges, raw
Into the mobilism SQL script with logical structure.
The SQL statement of 21 pairs of receptions of pretreatment unit carries out pretreatment, to generate available and specification
The SQL statement of change.
Pretreatment is carried out to the SQL statement of the reception includes:Pre- form is carried out to the SQL statement of the reception
Change process, details split and/or details format conversion.
Pre-formatting process is carried out to the SQL statement of the reception, to delete unnecessary space, delete unnecessary
Carriage return character, delete useless annotation etc..Preferably, carrying out pre-formatting in the SQL statement to receiving
During process, specific pre-formatting process can be carried out according to preset rules, in the SQL statement that will such as receive
Annotation delete, will receive SQL statement in excess space delete etc..In the SQL statement to receiving
When carrying out details fractionation, specific details fractionation can be carried out according to preset rules, such as according to default fractionation
Symbol carries out details fractionation to the SQL statement for receiving, for, between database object table, major key, this is torn open
Point symbol can for ";Carriage return ", for field between database table, the fractionation symbol is ", carriage return ".
When the SQL statement to receiving carries out details formatting conversion, can be carried out according to preset rules specific thin
Section format is converted, such as keyword capital and small letter is carried out changing, single quotation marks is substituted for two list reference signs,
English character punctuate etc. is substituted for Chinese punctuate.
First signal generating unit 22 pairs pretreated SQL statement gives variable v_sql, generates dynamic
Change SQL statement.Such as the pretreated SQL statement is:
alter table T1add COL1char(10)default”0”;
Mobilism is carried out to the pretreated SQL statement, mobilism SQL statement is generated, is:
v_sql:=' alter table T1add COL1char (10) default " 0 " ';
Thus, the pretreated SQL statement is given variable v_sql, become dynamic SQL statements.
In the mapping relations of the default keyword and logic template, keyword creat table, drop are included
Table, alter table etc., each keyword correspond to a logic template.Second signal generating unit 23
According to the default keyword and the mapping relations of logic template, the mobilism SQL statement is got corresponding
Logic template, such as the mobilism SQL statement include keyword creat table, then from the keyword with patrol
The corresponding logic template of mobilism SQL statement can be got in the mapping relations for collecting template for creat table
Corresponding logic template, then uses the mobilism SQL statement set on the logic template of the acquisition.
Such as when mobilism SQL statement is v_sql:=' create table T1 (COL1int not null, COL1
char(10)default''0'')’;Following sentence is formed after applying mechanically logic template:
Such as when mobilism SQL statement is v_sql:=' alter table T1add COL1char (10) default
”0”';Following sentence is formed after applying mechanically logic template:
Second signal generating unit 23 has been applied mechanically mobilism SQL of logic template according to database syntax
Sentence merges, and generates the mobilism SQL script with logical structure.The database syntax is led again for first table
Key again external key again storing process retrigger etc. order.
Further, as shown in fig. 7, the pretreatment unit 21 includes:
First pretreatment subelement 211, carries out pre-formatting process for the SQL statement to the reception;
Second pretreatment subelement 212, carries out details for the SQL statement after processing to pre-formatting and tears open
Point;
3rd pretreatment subelement 213, carries out details form for the SQL statement after splitting to details and turns
Change.
The first pretreatment subelement 211 can carry out specific pre-formatting process according to preset rules, such as
Excess space deletion in the SQL statement that annotate deletion, will receive in the SQL statement that will be received etc..
SQL statement such as to receiving in step S10 carries out pre-formatting process, will annotate " --- explanation:Create
The test table for using " is deleted, and the excess space between " T1add " is deleted, and generates following SQL
Sentence:
Grammer is created according to database object, database object to be split is pre-defined and need not be torn open
The database object for dividing.For database object to be split, 212 logarithm of the second pretreatment subelement
Deconsolidation process is carried out with default fractionation character according to the SQL statement of storehouse object, substatement is split into.For example,
For between database object table, major key, the fractionation symbol can for ";Carriage return ", for database table
Between field, the fractionation symbol is ", carriage return ".
Such as, the SQL statement after the process of 211 pre-formatting of the first pretreatment subelement is split, with
Fractionation symbol ";Carriage return " is split, and splits into 4 clauses, as follows:
For words and expressions a), secondary fractionation can be carried out to literary name section, be split with splitting symbol ", carriage return ",
2 clauses are split into, it is as follows:
e)、COL1int not null
f)、COL2char(10)default'0'
3rd pretreatment subelement 213 can carry out specific details format conversion according to preset rules, such as
Keyword capital and small letter is carried out changing, two single reference signs is substituted for single quotation marks, Chinese punctuate is replaced
Into English character punctuate etc., the SQL statement of generation form compliant.
Such as details format conversion is carried out to carrying out the SQL after details fractionation, by COL2char (10) default
' 0' is converted into:COL2char (10) default''0'', will single quotation marks be substituted for two single quotation marks;By Alter
Table is converted into:Alter table, capitalization that will be in keyword make small letter into.
In other embodiments, when carrying out pretreatment to the SQL statement of the reception, pre-formatting process,
Details splits, the execution sequence of details format conversion arbitrarily can be arranged.
Further, as shown in figure 8, the update module 30 includes:
Judging unit 31, for judging in the data base with the presence or absence of the mobilism with logical structure
The corresponding database object of SQL scripts;
First updating block 32, for there is no the SQL scripts with logical structure in the data base
During corresponding database object, created in data base according to the mobilism SQL script with logical structure
Build corresponding database object;
Second updating block 33, for there is mobilism SQL with logical structure in the data base
During the corresponding database object of script, according to the mobilism SQL script with logical structure to corresponding
Database object is modified.
By in the corresponding database object of mobilism SQL statement with logical structure and the data base
Database object is matched one by one, if in the data base, having database object and should tie with logic
The corresponding database object matching of SQL scripts of structure, then presence during the judging unit 31 thinks the data should
The corresponding database object of mobilism SQL script with logical structure.Such as, when this carries logical structure
The corresponding database object of mobilism SQL statement be table T1, also have table T1 in the data base, then
There is the corresponding data base couple of mobilism SQL script with logical structure in can determine the data base
As.
When there is no the corresponding data base couple of mobilism SQL script with logical structure in data base
As then first updating block 32 increases mobilism SQL with logical structure in the data base newly
The database object of script, is updated to the data base.
When having there is the corresponding data base couple of mobilism SQL statement with logical structure in data base
As, but due to the corresponding database object of mobilism SQL statement with logical structure and the data
The particular content of corresponding database object present in storehouse there may be difference, then second updating block
33 need to repair corresponding database object according to the mobilism SQL statement that should carry logical structure
Change, the corresponding database object of mobilism SQL statement with logical structure is such as somebody's turn to do for T1, including field
COL1, but database object table T1 in data base does not include field COL1, then in the data base
Database object table T1 in increase field COL1, complete the modification for database object T1, it is real
The now renewal to the data base.
The preferred embodiments of the present invention are these are only, the scope of the claims of the present invention is not thereby limited, it is every
The equivalent structure made using description of the invention and accompanying drawing content or equivalent flow conversion, or directly or
Connect and be used in other related technical fields, be included within the scope of the present invention.
Claims (10)
1. a kind of data base management method based on SQL, it is characterised in that the method includes:
The SQL statement of receiving user's input;
The SQL statement of the reception is processed, the mobilism SQL script with logical structure is generated;
The database object in data base is carried out according to the mobilism SQL script with logical structure
Update.
2. the data base management method based on SQL as claimed in claim 1, it is characterised in that described
The SQL statement of the reception is processed, the step of the mobilism SQL script with logical structure is generated
Suddenly include:
Pretreatment is carried out to the SQL statement of the reception;
Mobilism is carried out to the pretreated SQL statement, mobilism SQL statement is generated;
According to default keyword and the mapping relations of logic template, the mobilism SQL statement pair is obtained
The logic template answered;The mobilism SQL statement is applied mechanically into the logic template of the acquisition, and according to number
According to storehouse grammer, the mobilism SQL statement for having applied mechanically logic template is merged, is generated and is tied with logic
The mobilism SQL script of structure.
3. the data base management method based on SQL as claimed in claim 2, it is characterised in that described
Pretreatment is carried out to the SQL statement of the reception includes:Pre- form is carried out to the SQL statement of the reception
Change process, details split and/or details format conversion.
4. the data base management method based on SQL as claimed in claim 1, it is characterised in that described
The database object in data base is updated according to the mobilism SQL script with logical structure
The step of include:
Whether there is the corresponding data of mobilism SQL script with logical structure in judging the data base
Storehouse object;
If there is no the corresponding data base of mobilism SQL script with logical structure in the data base
Object, then create corresponding number according to the mobilism SQL script with logical structure in data base
According to storehouse object.
5. the data base management method based on SQL as claimed in claim 4, it is characterised in that described
Whether there is the corresponding data base couple of mobilism SQL script with logical structure in judging the data base
As the step of after, the method also includes:
If there is the corresponding data base couple of mobilism SQL script with logical structure in the data base
As then being repaiied to corresponding database object according to the mobilism SQL script with logical structure
Change.
6. a kind of data bank management device based on SQL, it is characterised in that described device includes:
Receiver module, for the SQL statement of receiving user's input;
Generation module, for processing to the SQL statement of the reception, generates with logical structure
Mobilism SQL script;
Update module, for according to the mobilism SQL script with logical structure in data base
Database object is updated.
7. the data bank management device based on SQL as claimed in claim 6, it is characterised in that described
Generation module includes:
Pretreatment unit, carries out pretreatment for the SQL statement to the reception;
First signal generating unit, for mobilism is carried out to the pretreated SQL statement, generates dynamic
Change SQL statement;
Second signal generating unit, for according to default keyword and the mapping relations of logic template, obtaining institute
State the corresponding logic template of mobilism SQL statement;The mobilism SQL statement is applied mechanically into the acquisition
Logic template, and according to database syntax, the mobilism SQL statement for having applied mechanically logic template is closed
And, generate the mobilism SQL script with logical structure.
8. the data bank management device based on SQL as claimed in claim 7, it is characterised in that described
Pretreatment is carried out to the SQL statement of the reception includes:Pre- form is carried out to the SQL statement of the reception
Change process, details split and/or details format conversion.
9. the data bank management device based on SQL as claimed in claim 6, it is characterised in that described
Update module includes:
Judging unit, for judging in the data base with the presence or absence of mobilism SQL with logical structure
The corresponding database object of script;
First updating block, for there is no the SQL scripts with logical structure in the database
During corresponding database object, according to the mobilism SQL script with logical structure in data base
Create corresponding database object.
10. the data bank management device based on SQL as claimed in claim 9, it is characterised in that institute
Stating update module also includes:
Second updating block, for there is mobilism SQL with logical structure in the database
During the corresponding database object of script, according to the mobilism SQL script with logical structure to correspondence
Database object modify.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510601117.XA CN106547765B (en) | 2015-09-18 | 2015-09-18 | SQ L-based database management method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510601117.XA CN106547765B (en) | 2015-09-18 | 2015-09-18 | SQ L-based database management method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106547765A true CN106547765A (en) | 2017-03-29 |
CN106547765B CN106547765B (en) | 2020-07-17 |
Family
ID=58362244
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510601117.XA Active CN106547765B (en) | 2015-09-18 | 2015-09-18 | SQ L-based database management method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106547765B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108073401A (en) * | 2017-12-29 | 2018-05-25 | 广州市玄武无线科技股份有限公司 | The execution method, apparatus and electronic equipment of a kind of service logic |
WO2019231657A1 (en) * | 2018-05-31 | 2019-12-05 | Oracle International Corporation | Flexible energy information aggregation |
CN110727693A (en) * | 2018-07-16 | 2020-01-24 | 中兴通讯股份有限公司 | Method, device, equipment, plug-in and storage medium for accessing heterogeneous database |
CN110865828A (en) * | 2018-08-28 | 2020-03-06 | 成都鼎桥通信技术有限公司 | Data upgrading method, device, equipment and computer readable storage medium |
CN110968591A (en) * | 2018-09-30 | 2020-04-07 | 北京国双科技有限公司 | Query statement generation method and device, storage medium and processor |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101944084A (en) * | 2009-07-09 | 2011-01-12 | 镇江华扬信息科技有限公司 | Database automatic operation system based on SQL script and FTP transmission technique |
CN102402559A (en) * | 2010-09-16 | 2012-04-04 | 中兴通讯股份有限公司 | Database upgrade script generating method and device |
US20140237341A1 (en) * | 2006-11-06 | 2014-08-21 | Eci Software, Inc. | System and method for creating integrated web form and database applications |
-
2015
- 2015-09-18 CN CN201510601117.XA patent/CN106547765B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140237341A1 (en) * | 2006-11-06 | 2014-08-21 | Eci Software, Inc. | System and method for creating integrated web form and database applications |
CN101944084A (en) * | 2009-07-09 | 2011-01-12 | 镇江华扬信息科技有限公司 | Database automatic operation system based on SQL script and FTP transmission technique |
CN102402559A (en) * | 2010-09-16 | 2012-04-04 | 中兴通讯股份有限公司 | Database upgrade script generating method and device |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108073401A (en) * | 2017-12-29 | 2018-05-25 | 广州市玄武无线科技股份有限公司 | The execution method, apparatus and electronic equipment of a kind of service logic |
CN108073401B (en) * | 2017-12-29 | 2020-09-15 | 广州市玄武无线科技股份有限公司 | Method and device for executing business logic and electronic equipment |
WO2019231657A1 (en) * | 2018-05-31 | 2019-12-05 | Oracle International Corporation | Flexible energy information aggregation |
CN111919228A (en) * | 2018-05-31 | 2020-11-10 | 甲骨文国际公司 | Flexible energy information aggregation |
US11036682B2 (en) | 2018-05-31 | 2021-06-15 | Oracle International Corporation | Flexible energy information aggregation |
CN110727693A (en) * | 2018-07-16 | 2020-01-24 | 中兴通讯股份有限公司 | Method, device, equipment, plug-in and storage medium for accessing heterogeneous database |
CN110865828A (en) * | 2018-08-28 | 2020-03-06 | 成都鼎桥通信技术有限公司 | Data upgrading method, device, equipment and computer readable storage medium |
CN110968591A (en) * | 2018-09-30 | 2020-04-07 | 北京国双科技有限公司 | Query statement generation method and device, storage medium and processor |
Also Published As
Publication number | Publication date |
---|---|
CN106547765B (en) | 2020-07-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105095195B (en) | Nan-machine interrogation's method and system of knowledge based collection of illustrative plates | |
CN106547765A (en) | Data base management method and device based on SQL | |
US10073840B2 (en) | Unsupervised relation detection model training | |
US8103705B2 (en) | System and method for storing text annotations with associated type information in a structured data store | |
CN100483417C (en) | Method for catching limit word information, optimizing output and input method system | |
WO2020253399A1 (en) | Log classification rule generation method, device, apparatus, and readable storage medium | |
CN102650995A (en) | Multi-dimensional data analyzing model generating system and method | |
CN103309806B (en) | The device and method of a kind of quick development and testing | |
US10706030B2 (en) | Utilizing artificial intelligence to integrate data from multiple diverse sources into a data structure | |
CN106682235A (en) | System and method for isomerous data mapping | |
CN102279894A (en) | Method for searching, integrating and providing comment information based on semantics and searching system | |
CN103729463A (en) | Method for implementing full-text retrieval based on Lucene and Solr | |
CN104598635A (en) | Automatic complex document generating method based on XML (Extensive Markup Language) description | |
KR100995861B1 (en) | Module and method for searching named entity of terms from the named entity database using named entity database and mining rule merged ontology schema | |
US20220083949A1 (en) | Method and apparatus for pushing information, device and storage medium | |
CN104536987B (en) | A kind of method and device for inquiring about data | |
US20170011114A1 (en) | Common data repository for improving transactional efficiencies of user interactions with a computing device | |
CN102651002A (en) | Webpage information extracting method and system | |
CN105302803A (en) | Product BOM difference analyzing and synchronous updating method | |
CN106503274A (en) | A kind of Data Integration and searching method and server | |
CN107181815A (en) | A kind of micro- application and micro services exchange method, micro- application and system | |
CN104361031A (en) | Big government data preprocessing system and method | |
CN112231417A (en) | Data classification method and device, electronic equipment and storage medium | |
JP2022518645A (en) | Video distribution aging determination method and equipment | |
CN110990057A (en) | Extraction method, device, equipment and medium of small program sub-chain information |
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 | ||
CB02 | Change of applicant information |
Address after: 518057 Energy Storage Building, 3099 South Keyuan Road, Yuehai Street, Nanshan District, Shenzhen City, Guangdong Province Applicant after: SHENZHEN ZNV TECHNOLOGY Co.,Ltd. Address before: 518057 Guangdong city of Shenzhen province Nanshan District South Road four No. 034 high-tech industrial village W1A building 4 layer Applicant before: SHENZHEN ZNV TECHNOLOGY Co.,Ltd. |
|
CB02 | Change of applicant information | ||
GR01 | Patent grant | ||
GR01 | Patent grant |