CN103412749A - Relational database based code generation method and code generator - Google Patents

Relational database based code generation method and code generator Download PDF

Info

Publication number
CN103412749A
CN103412749A CN2013103227440A CN201310322744A CN103412749A CN 103412749 A CN103412749 A CN 103412749A CN 2013103227440 A CN2013103227440 A CN 2013103227440A CN 201310322744 A CN201310322744 A CN 201310322744A CN 103412749 A CN103412749 A CN 103412749A
Authority
CN
China
Prior art keywords
file
data
database
template
code
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
CN2013103227440A
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.)
Fujian Landi Commercial Equipment Co Ltd
Original Assignee
Fujian Landi Commercial Equipment Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujian Landi Commercial Equipment Co Ltd filed Critical Fujian Landi Commercial Equipment Co Ltd
Priority to CN2013103227440A priority Critical patent/CN103412749A/en
Publication of CN103412749A publication Critical patent/CN103412749A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention discloses a relational database based code generation method. The method comprises steps as follows: S101, relevant information for accessing a database is acquired, and join operation of the database is performed; S102, legalities of a user name and passwords are verified, all data lists under the user's name are displayed in a list manner if the verification succeeds, and data list structural information is displayed in a data structure list manner simultaneously; S103, a to-be-operated data list, a list name which corresponds to the to-be-operated data list and requires page display, and a to-be-generated file type are acquired; S104, a template engine is called to acquire a template file from a corresponding template file path, and a corresponding client file or server file is generated according to the template file; and S105, the generated client file or server file is stored in a file data path in a configured file. The invention further discloses a relational database based code generator.

Description

A kind of code generating method based on relevant database and code generator
Technical field
The present invention relates to data processing field, relate in particular to a kind of code generating method based on relevant database and code generator.
Background technology
Along with popularizing of computing machine, and the extension of computational grid, people, enjoying the huge while easily of calculating in work and bringing in living, have also proposed more requirement to the exploitation of computer software and hardware.These requirements are in particular in: the exploitation of software environment to be dealt with becomes and becomes increasingly complex, and functional requirement is more comprehensive; Requirement to the quick deliverability of system, security, reliability, stability is also more and more higher; User's demand is in ceaselessly changing.
On the other hand, in today of soft project high development, most software developers still use the method for hand-coding code, and the common efficiency of this traditional development scheme is lower and the construction cycle is longer, and wherein has a large amount of duplication of labour power.In this case, extension, the cost that Large-Scale Projects usually occurs exceeds plan, performance lower than expection, even die on the vine etc.These problems force the software developer for how reducing development and maintenance cost, improve development efficiency, and the change of demaning reduction is thought deeply the impact of software systems and the life cycle that extended system.
Yet in traditional development approach, these problems always are difficult to perfect solution, this just need to a kind ofly can be avoided the low-level repetition exploitation, can realize the new mode of software development of standardized production, to tackle fast-changing software development environment, Software functional requirements and market environment.
Summary of the invention
For addressing the above problem, the technical scheme that the present invention adopts is:
A kind of code generator based on relevant database is provided, comprises: the first acquiring unit, authentication unit, represent unit, second acquisition unit, file generating unit and output unit; Described the first acquiring unit carries out the attended operation of database for obtaining the accessing database relevant information that configuration file arranges, and described accessing database relevant information comprises the username and password of type of database, database address, database.In described configuration file, also comprise other configuration informations, described other configuration informations comprise file data path, template file path; Described authentication unit is for the legitimacy of authentication of users name and password; The described unit that represents is for when described authentication unit is proved to be successful and the database successful connection, then the form of all tables of data under described user name with list displayed, with the form demonstrating data list structure information with data structure table, described data list structure information comprises row name, annotation, major key, data length, data type simultaneously; Described second acquisition unit, for obtaining the selected tables of data that will operate, then obtains row name and spanned file type that the needs corresponding with the tables of data that will operate carry out page demonstration; Row name and other configuration information of described file generating unit for carrying out page demonstration according to described needs, call template engine and from corresponding template file path, obtain template file and generate corresponding client file or service end file according to template file; Described output unit is for being stored in the client file of generation or service end file under the file data path of configuration file.
Wherein, described file generating unit comprise that template file insmods, code generation module and file generating module; Described template file insmods, for calling the template engine tune, different template files is loaded into to buffer memory; Described code generation module, for calling row name and the file type that template engine carries out page demonstration as required, carries out computing by pre-set business rules and replaces the needed code of placeholder generation in template file; Described file generating module is for obtaining corresponding client file or service end file according to needed code.
Wherein, described file generating module specifically comprises: whether the checking submodule, repeat be used to needed code and the configuration file content of verifying generation; Cover submodule, while for when described checking submodule, judging, repeating, set whether cover original and configuration file content according to configuration file; Generate submodule, while for when described checking submodule, judging, not repeating or described covering submodule judge while covering, according to described needed code generation client file or service end file and configuration file content; Described generation submodule is also for when described covering submodule, judging while not covering, and is as the criterion with former client file or service end file and configuration file content.
Wherein, represent unit and specifically comprise structural information acquisition module and data structure table generation module; Described structural information acquisition module for when with according to type of database, call the data list structure information that corresponding application program is obtained the current data table after Database is connected; Described data structure table generation module is used for according to described data list structure Information generation data structure table.
Another technical solution used in the present invention is:
A kind of code generating method based on relevant database is provided, run in described a kind of code generator based on relevant database, comprise step: S101, obtain the accessing database relevant information arranged in configuration file and carry out the attended operation of database, described accessing database relevant information comprises the username and password of type of database, database address, database, in described configuration file, also comprise other configuration informations, described other configuration informations comprise file data path, template file path; The legitimacy of S102, authentication of users name and password, if were proved to be successful with the database successful connection, then the form of all tables of data under described user name with list displayed, with the form demonstrating data list structure information of data structure table, described data list structure information comprises row name, annotation, major key, data length, data type simultaneously; S103, obtain the selected tables of data that will operate, then obtain row name and spanned file type that the needs corresponding with the tables of data that will operate carry out page demonstration; S104, the row name and other configuration information that according to described needs, carry out page demonstration, call template engine and from corresponding template file path, obtain template file and generate corresponding client file or service end file according to template file; And S105, the client file of generation or service end file are stored under the file data path in configuration file.
Wherein, described step S102 specifically comprises step: obtain tables of data information generation table information list; According to type of database, call the data list structure information that corresponding application program is obtained the current data table; And according to described data list structure Information generation data structure table.
Wherein, comprise placeholder in described template file, described step S104 specifically comprises: call template engine different template files is loaded in buffer memory; Call template engine according to row name and the file type that will carry out page demonstration, by pre-set business rules carry out computing replace template file in placeholder generate needed code; According to needed code, obtain corresponding client file or service end file.
Wherein, described step S1043 comprises specifically whether needed code and configuration file content that step: S10431, checking generate repeat, if, enter step S10432, if not, enter step S10433; S10432, set whether to cover original and configuration file content according to configuration file, if, enter step S10433, if not, enter step S10434; S10433, generate client file or service end file and configuration file content according to described needed code, then enter step S105; S10434, be as the criterion with former client file or service end file and configuration file content, then enter step S105.
Code generating method based on relevant database of the present invention and code generator, by software project, using code generator, can bring following technique effect:
High-level efficiency: the work of code generator is mainly to set up and safeguard input model, i.e. template file.And these input models can be come basically in conversion from design a model, seldom, thereby efficiency is significantly improved workload.Design a model and refer to the system framework that some are ripe, have good design.
High-quality: code Generation, use the template generating code.Template is more perfect, and the code generated out is better.After template was improved, all generating code quality can improve.And the name of code and style can be consistent.
Adopt code generator can generate more easy care of high-quality code: when demand changed, code generator can, on the input model basis, regenerate the code that meets new demand.This can effectively reduce the risk that software development brings.
The accompanying drawing explanation
Fig. 1 is the structured flowchart of a kind of code generator based on relevant database in an embodiment of the present invention;
Fig. 2 is that the code generator of take based on the SSI system framework is the table information list of example and the schematic diagram of list structure information;
Fig. 3 is the module map of Fig. 1 File generation unit;
Fig. 4 is the flowchart of a kind of code generating method based on relevant database in an embodiment of the present invention;
Fig. 5 is the concrete flowchart of step S102 in Fig. 4;
Fig. 6 is the concrete flowchart of step S104 in Fig. 4;
Fig. 7 is the concrete flowchart of step S1043 in Fig. 6.
The main element symbol description
Code generator 100 based on relevant database; The first acquiring unit 11; Authentication unit 12;
Represent unit 13; Second acquisition unit 14; File generating unit 15; Output unit 16;
Template file insmods 151; Code generation module 152; File generating module 153;
Checking submodule 1531; Cover submodule 1532; Generate submodule 1533; Database 200.
Embodiment
By describing technology contents of the present invention, structural attitude in detail, being realized purpose and effect, below in conjunction with embodiment and coordinate accompanying drawing to be explained in detail.
Seeing also Fig. 1, is the structured flowchart of a kind of code generator based on relevant database in an embodiment of the present invention.Should comprise the first acquiring unit 11, authentication unit 12, represent unit 13, second acquisition unit 14, file generating unit 15 and output unit 16 based on the code generator 100 of relevant database.
Described the first acquiring unit 11 carries out the attended operation of database 200 for the accessing database relevant information of obtaining configuration file and arranging, and described accessing database relevant information comprises the username and password of type of database, database address, database.
In described configuration file, also comprise other configuration informations, described other configuration informations comprise file data path, template file path.The Sybase type of supporting at present comprises oracle, mysql, sqlserver, db2.
Described authentication unit 12 for the legitimacy of authentication of users name and password and when being proved to be successful and database 200 connect.
Described represent unit 13 for the form of all tables of data under user name described in database 200 with the table information list displayed after Database is connected, simultaneously with the form demonstrating data list structure information of data structure table.Described data list structure information comprises the information such as row name, annotation, major key, data length, data type.
Annotation is for generating the title of form on client, and the label in newly-increased, modification, query manipulation interface; Whether data length crosses the border for the length of the content of controlling client input; Major key, row name are for generating the SQL statement of iBATIS or the information such as configuration file of hibernate.IBATIS be one can the better Java/.NET application program of Design and implementation data persistence layer framework, iBATIS object with storing process or use the SQL statement of XML descriptor to carry out associated.
For example, suppose to be connected to the oracle database, and obtain an active user tables of data T_USER under one's name, data structure form corresponding to T_USER as shown in Table 1:
The data structure form that table one T_USER is corresponding
The row name Annotation Major key whether Data length Data type
sysid Numbering Y 20 int
username User name N 50 varchar2
password Password N 50 varchar2
Referring to Fig. 2, is that the code generator of take based on the SSI system framework is the table information list of example and the schematic diagram of list structure information.After connection data Kucheng's merit, by table information list and data structure form difference demonstrating data table and data list structure information.The table information list represents under the active user which user data table is arranged.List structure information represents the structural information of certain tables of data, in this example, is the list structure information of corresponding T_USER tables of data.
Whether " the row name " that operate in certain data structure form means whether the file of current generation comprises this column information.Tick and mean this column data of operation, do not tick, mean this column data of inoperation.The spanned file type means the current file of wanting to generate which kind of type.By clicking spanned file, generate different file types according to actual concrete condition.
Wherein, the described unit 13 that represents specifically comprises information table generation module, structural information acquisition module and data structure table generation module.Described information table generation module is for obtaining tables of data information generation table information list, described structural information acquisition module for when with according to type of database, call the data list structure information that corresponding application program is obtained the current data table after Database is connected.For every kind of type of database, its data list structure acquisition of information mode is different, and unified access interface is realized in the various types of data storehouse.Described data structure table generation module is used for according to described data list structure Information generation data structure table.
Described second acquisition unit 14, be used to obtaining the selected tables of data that will operate, then obtains row name and spanned file type that the needs corresponding with the tables of data that will operate carry out page demonstration.
So, the user can pass through visual interface, according to concrete business scenario user demand, and the tables of data that selection will operate, and choose which row name corresponding to tables of data and need to carry out page demonstration, and select the spanned file type.For example, according to the demand to subscriber information management, select above-mentioned tables of data T_USER.
Can generate a plurality of files or Single document, file can be careful to current operation be which row name, the fine granularity of its application fully can scene and the developer drive.
Which kind of file what in the selection of file type, can specify current generation is, particularly, the spanned file type is selected according to different system frameworks.For example, if based on struts+spring+ibatis(SSI) system framework, the selection of file type is configuration file, spring configuration file, struts configuration file and jsp and the js file of action file, service file, ibatis so; If based on struts+spring+hibernate(SSH) system framework, the selection of file type is configuration file, spring configuration file, struts configuration file and jsp and the js file of action file, service file, hibernate so.For example, according to above-mentioned tables of data T_USER, use the SSI system framework, the client file of generation has jsp and js file, and the service end file has the action file, service file, and ibatis, the configuration file of spring and struts.
Described file generating unit 15, for according to described needs, carrying out row name and other configuration information of page demonstration, is called template engine and from corresponding template file path, is obtained template file and generate corresponding client file or service end file according to template file.
Wherein, template file is exactly the definition of the code file that will generate, and its retains or has taken out some bases, general character, constant structure or content are as the female parent of a certain class design, after template has been arranged, only the thing of some individuations need to be added, just corresponding variant can be generated.
Referring to Fig. 3, is the module map of Fig. 1 File generation unit.Particularly, in described template file, comprise placeholder.Described file generating unit 15 comprises specifically that template file insmods 151, code generation module 152 and file generating module 153.
Described template file insmods and 151 for calling template engine, different template files is loaded into to buffer memory.
Described code generation module 152 carries out row name and the file type of page demonstration as required be used to calling template engine, by pre-set business rules, carry out computing and replace the needed code of placeholder generation in template file.
Described file generating module 153 obtains corresponding client file or service end file according to needed code.
This pre-set business rules definition has the metadata of appointment and rule of conduct, and this metadata is the related resource information that needs the data structure of modeling in code.Each operation in system will be followed certain cardinal rule and standard, carries out in steps, and each operating process, operation steps, method of operating is called rule of conduct.Such as the newly-increased rule of conduct operated is: the correctness of client validation data, after being proved to be successful, service end is obtained content, and the content that then will get is assembled, and the content that finally will assemble sends to database manipulation, this a series of process, namely can be described as rule of conduct.
For example, according to table one T_USER, if need, generate the function Added User, which metadata the client file the inside just must comprise and need to increase newly in system, the service end file acquisition, to the content of these metadata, is saved in these contents in database.In this operating process, without artificial intervention operation, by code generator, generate needed code according to business rule fully.
In the present embodiment, file generating module 153 specifically comprises checking submodule 1531, covers submodule 1532, generates submodule 1533.
Whether checking submodule 1531 repeats be used to needed code and the configuration file content of verifying generation.Cover submodule 1532 for when described checking submodule is judged repetition, set whether cover original and configuration file content according to configuration file.When generating submodule 1533 and not repeating for when described checking submodule, judging or described covering submodule judge while covering, according to described needed code generation client file or service end file and configuration file content.Described generation submodule 1533 is also for when described covering submodule, judging while not covering, and is as the criterion with former client file or service end file and configuration file content.
So, can prevent from causing system normally to move because repeating generating code.
Described output unit 16 is stored under the file data path of configuration file for the client file by generation or service end file.In order to reach the seamless combination of code generator and engineering project, the code of generation outputs to code under concrete catalogue according to the configuration file of code generator the inside, also without artificial intervention, thereby reaches the purpose of " once configuration, operation everywhere ".
The invention provides a kind of code generator based on relevant database, be conducive to improve tempo of development and maintenance cost, lowered developer's burden, make its more be absorbed in business demand on realization, improved work efficiency.The developer need to be at the code that goes to write some repetitions, and basic additions and deletions change that to look into operation also all generated by code generator, and the developer only need to get final product according to the adjustment that different business be carried out part.The code that code generator generates out, have very strong regularity, names also standard, and in maintenance process, encounter problems and be very easy to location, and the quick solution problem.
Referring to Fig. 4, is the flowchart of a kind of code generating method based on relevant database in an embodiment of the present invention.Should run in described code generator based on relevant database based on the code generating method of relevant database, the method comprises the following steps:
Step S101, obtain the accessing database relevant information arranged in configuration file and carry out the attended operation of database, described accessing database relevant information comprises the username and password of type of database, database address, database, in described configuration file, also comprise other configuration informations, described other configuration informations comprise file data path, template file path etc.The Sybase of supporting at present, as: oracle, mysql, sqlserver, db2.
The legitimacy of step S102, authentication of users name and password, if be proved to be successful be connected with Database, then the form of all tables of data under described user name with list displayed, with the form demonstrating data list structure information of data structure table, this data list structure information comprises row name, annotation, major key, data length, data type simultaneously.
Annotation is for generating the title of form on client, and the label in newly-increased, modification, query manipulation interface; Whether data length crosses the border for the length of the content of controlling client input; Major key, row name are for generating the SQL statement of iBATIS or the information such as configuration file of hibernate.IBATIS be one can the better Java/.NET application program of Design and implementation data persistence layer framework, iBATIS object with storing process or use the SQL statement of XML descriptor to carry out associated.
Step S103, obtain the selected tables of data that will operate, then obtain row name and spanned file type that the needs corresponding with the tables of data that will operate carry out page demonstration.
So, the user can pass through visual interface, according to concrete business scenario user demand, and the tables of data that selection will operate, and choose which row name corresponding to tables of data and need to carry out page demonstration, and select the spanned file type.For example, according to the demand to subscriber information management, select above-mentioned tables of data T_USER.
Can generate a plurality of files or Single document, file can be careful to current operation be which row name, the fine granularity of its application fully can scene and the developer drive.
Which kind of file what in the selection of file type, can specify current generation is, particularly, the spanned file type is selected according to different system frameworks.For example, if based on struts+spring+ibatis(SSI) system framework, the selection of file type is configuration file, spring configuration file, struts configuration file and jsp and the js file of action file, service file, ibatis so; If based on struts+spring+hibernate(SSH) system framework, the selection of file type is configuration file, spring configuration file, struts configuration file and jsp and the js file of action file, service file, hibernate so.
Step S104, the row name and other configuration information that according to described needs, carry out page demonstration, call template engine and from corresponding template file path, obtain template file and generate corresponding client file or service end file according to template file.
Wherein, template file is exactly the definition of the code file that will generate, and its retains or has taken out some bases, general character, constant structure or content are as the female parent of a certain class design, after template has been arranged, only the thing of some individuations need to be added, just corresponding variant can be generated.
Step S105, the client file of generation or service end file are stored under the file data path in configuration file.
Referring to Fig. 5, is the concrete flowchart of step S102 in Fig. 4.Wherein, in described step S102, all tables of data under described user name are displayed and specifically comprise step with the form of list:
Step S1021, obtain tables of data information generation table information list;
Step S1022, call according to type of database the data list structure information that corresponding application program is obtained the current data table; And
Step S1023, according to described data list structure Information generation data structure table.
For every kind of type of database, its tables of data obtain manner is different, and various databases are realized unified access interface.
Referring to Fig. 6, is the concrete flowchart of step S104 in Fig. 4.Wherein, comprise placeholder in described template file, described step S104 specifically comprises:
Step S1041, call template engine different template files is loaded in buffer memory;
Step S1042, call template engine according to row name and the file type that will carry out page demonstration, by pre-set business rules carry out computing replace template file in placeholder generate needed code; And
Step S1043, obtain corresponding client file or service end file according to needed code.
This pre-set business rules definition has the metadata of appointment and rule of conduct, and this metadata is the related resource information that needs the data structure of modeling in code.
For example, according to table one T_USER, if need, generate the function Added User, which metadata the client file the inside just must comprise and need to increase newly in system, the service end file acquisition, to the content of these metadata, is saved in these contents in database.In this operating process, without artificial intervention operation, by code generator, generate needed code according to business rule fully.
Referring to Fig. 7, is the concrete flowchart of step S1043 in Fig. 6.Wherein, described step S1043 specifically comprises step:
Whether needed code and configuration file content that step S10431, checking generate repeat, if, enter step S10432, if not, enter step S10433.
Step S10432, set whether to cover original and configuration file content according to configuration file, if, enter step S10433, if not, enter step S10434.
Step S10433, generate client file or service end file and configuration file content according to described needed code, then enter step S105.
Step S10434, be as the criterion with former client file or service end file and configuration file content, then enter step S105.
So, can prevent from causing system normally to move because repeating generating code.
In step S105, in order to reach the seamless combination of code generator and engineering project, the code of generation outputs to code under concrete catalogue according to the configuration file of code generator the inside, also without artificial intervention, thereby reach the purpose of " once configuration, operation everywhere ".
Code generating method based on relevant database of the present invention and code generator, by software project, using code generator, can bring following technique effect:
High-level efficiency: the work of code generator is mainly to set up and safeguard input model, i.e. template file.And these input models can be come basically in conversion from design a model, seldom, thereby efficiency is significantly improved workload.Design a model and refer to the system framework that some are ripe, have good design.
High-quality: code Generation, use the template generating code.Template is more perfect, and the code generated out is better.After template was improved, all generating code quality can improve.And the name of code and style can be consistent.
Adopt code generator can generate more easy care of high-quality code: when demand changed, code generator can, on the input model basis, regenerate the code that meets new demand.This can effectively reduce the risk that software development brings.
The foregoing is only embodiments of the invention; not thereby limit the scope of the claims of the present invention; every equivalent structure or equivalent flow process conversion that utilizes instructions of the present invention and accompanying drawing content to do; or directly or indirectly be used in other relevant technical fields, all in like manner be included in scope of patent protection of the present invention.

Claims (8)

1. the code generator based on relevant database, is characterized in that, comprising: the first acquiring unit, authentication unit, represent unit, second acquisition unit, file generating unit and output unit;
Described the first acquiring unit carries out the attended operation of database for obtaining the accessing database relevant information that configuration file arranges, and described accessing database relevant information comprises the username and password of type of database, database address, database.In described configuration file, also comprise other configuration informations, described other configuration informations comprise file data path, template file path;
Described authentication unit is for the legitimacy of authentication of users name and password;
The described unit that represents is for when described authentication unit is proved to be successful and the database successful connection, then the form of all tables of data under described user name with list displayed, with the form demonstrating data list structure information of data structure table, described data list structure information comprises row name, annotation, major key, data length, data type simultaneously;
Described second acquisition unit, for obtaining the selected tables of data that will operate, then obtains row name and spanned file type that the needs corresponding with the tables of data that will operate carry out page demonstration;
Row name and other configuration information of described file generating unit for carrying out page demonstration according to described needs, call template engine and from corresponding template file path, obtain template file and generate corresponding client file or service end file according to template file;
Described output unit is for being stored in the client file of generation or service end file under the file data path of configuration file.
2. a kind of code generator based on relevant database according to claim 1, is characterized in that, described file generating unit comprises that template file insmods, code generation module and file generating module;
Described template file insmods, for calling the template engine tune, different template files is loaded into to buffer memory;
Described code generation module, for calling row name and the file type that template engine carries out page demonstration as required, carries out computing by pre-set business rules and replaces the needed code of placeholder generation in template file;
Described file generating module is for obtaining corresponding client file or service end file according to needed code.
3. a kind of code generator based on relevant database according to claim 2, is characterized in that, described file generating module specifically comprises:
Whether the checking submodule, repeat be used to needed code and the configuration file content of verifying generation;
Cover submodule, while for when described checking submodule, judging, repeating, set whether cover original and configuration file content according to configuration file;
Generate submodule, while for when described checking submodule, judging, not repeating or described covering submodule judge while covering, according to described needed code generation client file or service end file and configuration file content;
Described generation submodule is also for when described covering submodule, judging while not covering, and is as the criterion with former client file or service end file and configuration file content.
4. a kind of code generator based on relevant database according to claim 1, is characterized in that, represents unit and specifically comprise structural information acquisition module and data structure table generation module;
Described structural information acquisition module for when with according to type of database, call the data list structure information that corresponding application program is obtained the current data table after Database is connected;
Described data structure table generation module is used for according to described data list structure Information generation data structure table.
5. the code generating method based on relevant database, run in the described a kind of code generator based on relevant database of claim 1-4 any one, it is characterized in that, comprises step:
S101, obtain the accessing database relevant information arranged in configuration file and carry out the attended operation of database, described accessing database relevant information comprises the username and password of type of database, database address, database, in described configuration file, also comprise other configuration informations, described other configuration informations comprise file data path, template file path;
The legitimacy of S102, authentication of users name and password, if were proved to be successful with the database successful connection, then the form of all tables of data under described user name with list displayed, with the form demonstrating data list structure information of data structure table, described data list structure information comprises row name, annotation, major key, data length, data type simultaneously;
S103, obtain the selected tables of data that will operate, then obtain row name and spanned file type that the needs corresponding with the tables of data that will operate carry out page demonstration;
S104, the row name and other configuration information that according to described needs, carry out page demonstration, call template engine and from corresponding template file path, obtain template file and generate corresponding client file or service end file according to template file; And
S105, the client file of generation or service end file are stored under the file data path in configuration file.
6. a kind of code generating method based on relevant database according to claim 5, is characterized in that, described step S102 comprises step:
Obtain tables of data information generation table information list;
According to type of database, call the data list structure information that corresponding application program is obtained the current data table; And
According to described data list structure Information generation data structure table.
7. a kind of code generating method based on relevant database according to claim 5, is characterized in that, in described template file, comprise placeholder, described step S104 specifically comprises:
Calling template engine is loaded into different template files in buffer memory;
Call template engine according to row name and the file type that will carry out page demonstration, by pre-set business rules carry out computing replace template file in placeholder generate needed code;
According to needed code, obtain corresponding client file or service end file.
8. a kind of code generating method based on relevant database according to claim 7, is characterized in that, described step S1043 specifically comprises step:
Whether needed code and configuration file content that S10431, checking generate repeat, if, enter step S10432, if not, enter step S10433;
S10432, set whether to cover original and configuration file content according to configuration file, if, enter step S10433, if not, enter step S10434;
S10433, generate client file or service end file and configuration file content according to described needed code, then enter step S105;
S10434, be as the criterion with former client file or service end file and configuration file content, then enter step S105.
CN2013103227440A 2013-07-29 2013-07-29 Relational database based code generation method and code generator Pending CN103412749A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2013103227440A CN103412749A (en) 2013-07-29 2013-07-29 Relational database based code generation method and code generator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2013103227440A CN103412749A (en) 2013-07-29 2013-07-29 Relational database based code generation method and code generator

Publications (1)

Publication Number Publication Date
CN103412749A true CN103412749A (en) 2013-11-27

Family

ID=49605762

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2013103227440A Pending CN103412749A (en) 2013-07-29 2013-07-29 Relational database based code generation method and code generator

Country Status (1)

Country Link
CN (1) CN103412749A (en)

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103942280A (en) * 2014-04-02 2014-07-23 云南电网公司 Automatic code generating method based on data structure
CN104317604A (en) * 2014-11-13 2015-01-28 中国建设银行股份有限公司 Program code generating method and device
CN104598233A (en) * 2015-01-12 2015-05-06 北京中交兴路车联网科技有限公司 Code generation method
CN104765745A (en) * 2014-01-07 2015-07-08 国际商业机器公司 Method and system for logic verification of load data in database
CN106873974A (en) * 2016-12-30 2017-06-20 武汉默联股份有限公司 Smart code generates automotive engine system and method
CN107608669A (en) * 2017-08-15 2018-01-19 山西云度知识产权服务有限公司 A kind of method based on database table structure automatic generation function and the page
CN107729003A (en) * 2017-11-20 2018-02-23 江苏神州信源系统工程有限公司 Automatic generation method, device and the electronic equipment of code
CN107729561A (en) * 2017-11-09 2018-02-23 成都卓凡软件科技有限公司 The method that the table handling of paired data storehouse is reversely given birth to based on database table structure
CN108052549A (en) * 2017-11-27 2018-05-18 中山路得斯空调有限公司 A kind of method that source data is automatically converted to entity category code
CN109032662A (en) * 2018-06-19 2018-12-18 上海陆家嘴国际金融资产交易市场股份有限公司 Code file generation method, device, computer equipment and storage medium
CN109189383A (en) * 2018-08-28 2019-01-11 厦门海迈科技股份有限公司 The generation method of code file, calculates equipment and storage medium at device
CN109254992A (en) * 2018-10-12 2019-01-22 北京京东金融科技控股有限公司 Project generation method and system, computer system and computer readable storage medium storing program for executing
CN109725893A (en) * 2018-05-17 2019-05-07 平安普惠企业管理有限公司 Code generating method, unit and computer readable storage medium
CN109739493A (en) * 2019-01-18 2019-05-10 宜创(北京)科技有限公司 Generation method, device, electronic equipment and the storage medium of data base manipulation statement
CN109885291A (en) * 2019-01-25 2019-06-14 深圳市元征科技股份有限公司 A kind of code automatic generation method and code generator
CN110032369A (en) * 2019-04-24 2019-07-19 成都市映潮科技股份有限公司 A kind of code automatic generation method, device and medium
CN110597504A (en) * 2019-09-20 2019-12-20 北京天地和兴科技有限公司 Rapid generation method of data table codes
CN112256252A (en) * 2019-07-22 2021-01-22 腾讯科技(深圳)有限公司 Interface generation method and device, storage medium and electronic equipment
CN113296760A (en) * 2021-05-25 2021-08-24 深信服科技股份有限公司 Method for generating model code, computer device and readable storage medium
CN113609138A (en) * 2021-09-30 2021-11-05 成都数联云算科技有限公司 Class and database table matching method, device, equipment and medium
CN115481355A (en) * 2022-09-19 2022-12-16 北京三维天地科技股份有限公司 Data modeling method based on category expansion

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080244510A1 (en) * 2007-03-27 2008-10-02 Microsoft Corporation Visual creation of object/relational constructs
CN101697120A (en) * 2009-11-05 2010-04-21 河南辉煌科技股份有限公司 Relational database based generation method of J2EE code
CN103135976A (en) * 2011-11-30 2013-06-05 阿里巴巴集团控股有限公司 Code automatic generation method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080244510A1 (en) * 2007-03-27 2008-10-02 Microsoft Corporation Visual creation of object/relational constructs
CN101697120A (en) * 2009-11-05 2010-04-21 河南辉煌科技股份有限公司 Relational database based generation method of J2EE code
CN103135976A (en) * 2011-11-30 2013-06-05 阿里巴巴集团控股有限公司 Code automatic generation method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
动软: "《手把手教你用动软.NET代码生成器实例教程》", 《HTTP://WWW.MATICSOFT.COM/HELP/MATICSTUDY.HTM》, 30 December 2011 (2011-12-30) *

Cited By (27)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104765745A (en) * 2014-01-07 2015-07-08 国际商业机器公司 Method and system for logic verification of load data in database
US10366058B2 (en) 2014-01-07 2019-07-30 International Business Machines Corporation Performing logical validation on loaded data in a database
CN104765745B (en) * 2014-01-07 2018-03-27 国际商业机器公司 Loading data in database are carried out with the method and system of logic checking
US11119988B2 (en) 2014-01-07 2021-09-14 International Business Machines Corporation Performing logical validation on loaded data in a database
CN103942280A (en) * 2014-04-02 2014-07-23 云南电网公司 Automatic code generating method based on data structure
CN104317604A (en) * 2014-11-13 2015-01-28 中国建设银行股份有限公司 Program code generating method and device
CN104598233A (en) * 2015-01-12 2015-05-06 北京中交兴路车联网科技有限公司 Code generation method
CN106873974A (en) * 2016-12-30 2017-06-20 武汉默联股份有限公司 Smart code generates automotive engine system and method
CN107608669A (en) * 2017-08-15 2018-01-19 山西云度知识产权服务有限公司 A kind of method based on database table structure automatic generation function and the page
CN107729561A (en) * 2017-11-09 2018-02-23 成都卓凡软件科技有限公司 The method that the table handling of paired data storehouse is reversely given birth to based on database table structure
CN107729003A (en) * 2017-11-20 2018-02-23 江苏神州信源系统工程有限公司 Automatic generation method, device and the electronic equipment of code
CN108052549A (en) * 2017-11-27 2018-05-18 中山路得斯空调有限公司 A kind of method that source data is automatically converted to entity category code
CN109725893A (en) * 2018-05-17 2019-05-07 平安普惠企业管理有限公司 Code generating method, unit and computer readable storage medium
CN109032662A (en) * 2018-06-19 2018-12-18 上海陆家嘴国际金融资产交易市场股份有限公司 Code file generation method, device, computer equipment and storage medium
CN109189383A (en) * 2018-08-28 2019-01-11 厦门海迈科技股份有限公司 The generation method of code file, calculates equipment and storage medium at device
CN109254992A (en) * 2018-10-12 2019-01-22 北京京东金融科技控股有限公司 Project generation method and system, computer system and computer readable storage medium storing program for executing
CN109254992B (en) * 2018-10-12 2020-11-20 京东数字科技控股有限公司 Project generation method and system, computer system and computer-readable storage medium
CN109739493A (en) * 2019-01-18 2019-05-10 宜创(北京)科技有限公司 Generation method, device, electronic equipment and the storage medium of data base manipulation statement
CN109885291A (en) * 2019-01-25 2019-06-14 深圳市元征科技股份有限公司 A kind of code automatic generation method and code generator
CN110032369A (en) * 2019-04-24 2019-07-19 成都市映潮科技股份有限公司 A kind of code automatic generation method, device and medium
CN112256252A (en) * 2019-07-22 2021-01-22 腾讯科技(深圳)有限公司 Interface generation method and device, storage medium and electronic equipment
CN112256252B (en) * 2019-07-22 2023-09-26 腾讯科技(深圳)有限公司 Interface generation method and device, storage medium and electronic equipment
CN110597504A (en) * 2019-09-20 2019-12-20 北京天地和兴科技有限公司 Rapid generation method of data table codes
CN113296760A (en) * 2021-05-25 2021-08-24 深信服科技股份有限公司 Method for generating model code, computer device and readable storage medium
CN113609138A (en) * 2021-09-30 2021-11-05 成都数联云算科技有限公司 Class and database table matching method, device, equipment and medium
CN113609138B (en) * 2021-09-30 2022-01-25 成都数联云算科技有限公司 Class and database table matching method, device, equipment and medium
CN115481355A (en) * 2022-09-19 2022-12-16 北京三维天地科技股份有限公司 Data modeling method based on category expansion

Similar Documents

Publication Publication Date Title
CN103412749A (en) Relational database based code generation method and code generator
CN108647330B (en) 3D lightweight conversion method based on BIM model file
CN105487864A (en) Method and device for automatically generating code
CN106528070B (en) A kind of data table generating method and equipment
Hasani et al. Lambda architecture for real time big data analytic
CN103309650B (en) The generation method and apparatus of persistent layer code
US11228646B2 (en) Systems and methods for generating, deploying, and managing data infrastructure stacks
US9189515B1 (en) Data retrieval from heterogeneous storage systems
Jeong et al. Anomaly teletraffic intrusion detection systems on hadoop-based platforms: A survey of some problems and solutions
CN104572895A (en) MPP (Massively Parallel Processor) database and Hadoop cluster data intercommunication method, tool and realization method
CN106886535A (en) A kind of data pick-up method and apparatus for being adapted to multiple data sources
CN108388623A (en) ER relationships generation method, device, computer equipment and storage medium
CN112632136A (en) Data statistical analysis method and device, electronic equipment and storage medium
CN103020318A (en) Method for maintenance of database tables in database
Chopvitayakun Android application to enhance performance of internship program implementing cloud computing platform and infrastructure
CN105930354B (en) Storage model conversion method and device
CN103678396A (en) Data backup method and device based on data models
CN113468149B (en) Data model development platform
US11449628B2 (en) System and method for data security grading
CN103561113A (en) Web Service interface generating method and device
CN103092617A (en) High reliability workflow development method based on backup services
Aloisio et al. Towards exascale distributed data management
CN106682228B (en) A kind of method and apparatus that Visual Dynamic draws cabinet arrangement
CN115543428A (en) Simulated data generation method and device based on strategy template
CN112130849B (en) Code automatic generation method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into 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: 20131127