CN100403306C - Method for realizing transplantation between information websites of different platforms - Google Patents

Method for realizing transplantation between information websites of different platforms Download PDF

Info

Publication number
CN100403306C
CN100403306C CNB2005100114200A CN200510011420A CN100403306C CN 100403306 C CN100403306 C CN 100403306C CN B2005100114200 A CNB2005100114200 A CN B2005100114200A CN 200510011420 A CN200510011420 A CN 200510011420A CN 100403306 C CN100403306 C CN 100403306C
Authority
CN
China
Prior art keywords
database
script
conversion
platform
transplantation
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.)
Expired - Fee Related
Application number
CNB2005100114200A
Other languages
Chinese (zh)
Other versions
CN1664816A (en
Inventor
谢永强
王朝君
徐军
金伟信
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CNB2005100114200A priority Critical patent/CN100403306C/en
Publication of CN1664816A publication Critical patent/CN1664816A/en
Application granted granted Critical
Publication of CN100403306C publication Critical patent/CN100403306C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The present invention discloses a method for realizing information web site transplanting among different platforms. A first information web site on a microsoft platform is converted into a second information web site on an LINUX platform. The present invention comprises the following steps: a data base converting module converts a first data base into a second data base and simultaneously, the data base converting module realizes the association treatment of the data base table structure of data base conversion and the conversion of the corresponding field data types of the two data bases; a data base conversion mapping table stores the change of the data base table structure in the association treatment on the data base conversion and the change of the field data types; a script converting module converts a first script into a second script; a data base access object module realizes the association treatment on the script conversion according to the data base conversion mapping table. The present invention achieves the key purposes of the automatic conversion of the ASP script of the microsoft platform and the PHP script of the LINUX platform, the automatic conversion of the data bases of ACCESS, MSSQL SERVER, etc. and the MYSQL data base of the LINUX platform, the association treatment on the script conversion and the data base conversion, etc. and can realize the automatic transplanting of information web sites based on microsoft systems and LINUX systems.

Description

Realize the method for transplantation between information websites of different platforms
Technical field
The present invention relates to the information site technology, particularly a kind of method that realizes transplantation between information websites of different platforms has realized the automatic conversion between the information site of different platform, and is simple to operate.
Background technology
Information site (WEB server) has become extensive and the most basic infosystem application model at present, and only domestic information site just has nearly 1,000,000 at present.
The basic building assembly of information station is script and database.Widely used script is html language, ASP language and JAVA SCRIPT speech like sound in Microsoft's platform information website structure pattern, and widely used database is ACCESS database, MS SQL database and ORACLE database.
Show that according to the IDC statistics information site more than 90% is all based on Microsoft's Platform Implementation.Along with the development of open source code LINUX operating system and the continuous popularization of application, the demand that makes up information site based on LINUX will get more and more, and just has one from the problem of Microsoft's platform to LINUX platform migration information site.
If solution is to allow the exploitation personnel again based on LINUX platform design developing web, can bring very big expense and long cycle, therefore press for relevant robotization implantation technique, make the user can be in the shortest time, spend minimum cost, be transplanted on the LINUX platform based on the website of Microsoft's platform construction.
ASP language, ACCESS database and SQL SERVER database all are key components on Microsoft's platform, are most widely used in the information site based on Microsoft's platform development.The use of these key components simultaneously needs the support of operating system and IIS a series of business softwares such as (Internet Information Server) of Microsoft, and can't directly move on the LINUX system platform, and is portable poor.Therefore how with these assemblies and use and to be transplanted to the operation of LINUX platform and just to become a problem.
Because PHP sets up the script that information site is most widely used on the LINUX platform, therefore ASP being converted into PHP is that information site is transplanted the most basic solution pattern.Move on the LINUX platform for the ASP script, mainly taked mode in the world based on emulator, promptly in the operating system of non-NT by realizing that simulation layer provides the support to the ASP script, the user does not need directly to carry out the conversion work of script, and the SUN ONE Active Server Pages of Sun Microsystems just can realize this function.In the open source code environment of LINUX, also there be the script translater of ASP in addition to PHP.Yet realize the pattern of ASP script in LINUX platform operation based on the mode based on emulator, because the ASP script exists diversified COM, ActiveX assembly, emulation mode exists that efficient is low, the problem of poor compatibility; Simultaneously each LINUX information station is all needed to buy a commercial SUNONE Active Server Pages, the expense height has lost the advantage of LINUX Platform Price performance ratio; ASP in the open source code environment of LINUX only can realize the conversion of simple grammer correspondence to the script translater of PHP, while also can't be practical owing to not considering WINDOWS platform and the LINUX platform difference at aspects such as character processing, database access, C Programming with Pascal Language.Simultaneously because there is the ActiveX/COM object based on the component technology of Windows of a large amount of exploitations of third party in ASP, comprise from simple GUI (Graphic User Interface) and control to complicated commercial applied logic assembly, the said goods is equal imperfection aspect support ActiveX/COM assembly, and extremely expensive.
The database that Windows/ management tool/data source realizes is transplanted translation function, the present simultaneously ACCESS database that exists at the open source code environment of LINUX is to MYSQL database crossover tool, substantially taked database table, the pattern that imports and exports of field and data, do not possess table to raw data base, field, content is to the target database table, user's consolidation ability of field and content, as not handling the variation of capital and small letter according to customer requirements, the variation of field name, the variation of table name, situations such as the support of Chinese character, the practical application of data base automatic conversion in the time of therefore can't adapting to the website and be transplanted to the LINUX platform automatically.
Customer data base was used during information site made up simultaneously, should close association as the access queries of storehouse, table, field and website Script Programming, therefore the processing to this incidence relation is sought after in migration process, to be transplanted to the total solution on the LINUX platform automatically based on the information site of Microsoft's platform construction, yet there is not relevant technical scheme can realize this conversion at present.
In the above-mentioned existing relevant implantation technique, database conversion and script conversion are two switch technologies independent of each other, customer data base is transplanted and be associated with the transplanting of website scripted code, user interface disunity not only, and be on different platforms, as the database crossover tool is application program on the Windows upper mounting plate, and the script crossover tool is the program on the Linux platform.Utilize above-mentioned correlation technique that the website is transplanted, need switch at different instrument peace interstations, because the user interface disunity, complicated operation is loaded down with trivial details, make mistakes easily, therefore can't satisfy the website of Microsoft's platform construction and to the LINUX platform, transplant actual demand automatically.Therefore above-mentioned implantation technique does not possess the practical application transfer ability to the website.
Summary of the invention
The object of the present invention is to provide a kind of method that realizes transplantation between information websites of different platforms, solve script and the conversion of database and the problem of association process of information site between different platform, realize robotization transplanting based on the information site of different platform.
To achieve these goals, the invention provides a kind of method that realizes transplantation between information websites of different platforms, be used for the first information website under Microsoft's platform is converted into second information site under the LINUX platform, described first information website comprises first database and first script of supporting ODBC, described second information site comprises second database and second script of supporting ODBC, wherein, may further comprise the steps:
Step S1: a database modular converter is converted to described second database with described first database, and realization is to the association process of the storehouse list structure of two databases and the conversion of two database corresponding field data types;
Step S2: database conversion mapping table is preserved the change of storehouse list structure in the database conversion association process and the variation of field data types;
Step S3: a script modular converter is converted to described second script with described first script;
Step S4: a database access object module is according to the association process of described database conversion mapping table realization to the script conversion.
The method of above-mentioned realization transplantation between information websites of different platforms, wherein, described first platform is Microsoft's platform, described second platform is the LINUX platform.
The method of above-mentioned realization transplantation between information websites of different platforms, wherein, the association process of described database conversion comprises that the no ambiguity of storehouse list structure is handled, Chinese and English is changed and the capital and small letter conversion.
The method of above-mentioned realization transplantation between information websites of different platforms, wherein, the different processing of the nothing of storehouse list structure carried out rename with storehouse, table and the field of conflicting with key word in described second database; The Chinese and English conversion is converted to English table name and field name with Chinese table name in described second database and field name; The capital and small letter conversion changes table name and field name in described second database into small letter.
The method of above-mentioned realization transplantation between information websites of different platforms, wherein, realization is the SQL statement that will carry out described second database that described database access object module receives described second scripts pass to the association process step of script conversion, and revises tables of data and field in the described SQL statement according to described database conversion mapping table.
The method of above-mentioned realization transplantation between information websites of different platforms, wherein, realize that the association process step to the script conversion is that described database access object module is changed mapping table to tables of data and field in the SQL statement of in described second script described second database being operated according to described database.
The method of above-mentioned realization transplantation between information websites of different platforms, wherein, described database modular converter comprises and connects source database module, data conversion module and be connected the destination data library module that described step S1 may further comprise the steps again:
Step S11: connect source database module being connected by ODBC and source database;
Step S12: data conversion module creates the storehouse list structure be used for described second database, finish the conversion of the described first database data and finish association process to the storehouse list structure of database conversion;
Step S13: described first database that will connect after the destination data library module will be changed by ODBC saves as described second database.
The method of above-mentioned realization transplantation between information websites of different platforms, wherein, described first database is Access database, MsSQL SERVER database, described second database is the MySQL database.
The method of above-mentioned realization transplantation between information websites of different platforms, wherein, described first script and crus secunda originally are respectively ASP script and PHP script, and described step S3 may further comprise the steps again:
Step S311: read described first script and carry out pre-service;
Step S312: carry out the scanning first time, handle the DTC control of existence and the function name in the function declaration;
Step S313: the function of record statement in advance or variable name are to the relevant variable table;
Step S314: export the DTC code that obtains among the described step S32 and arrive described second script;
Step S315: described first script of compiling and conversion Jscript or VBScript code.
The method of above-mentioned realization transplantation between information websites of different platforms, wherein, described pre-service comprises the validity of checking first script file, catalogue and crus secunda presents, catalogue, opens file or catalogue, all outside global variables and initialization script modular converter is set.
The method of above-mentioned realization transplantation between information websites of different platforms wherein, also comprises between the described step S311 to 315:
Step S316: as comprising grabglobals.inc and mysql_class.inc, then in described second script, generate the require statement of corresponding PHP in described second script.
The method of above-mentioned realization transplantation between information websites of different platforms, wherein, the information of variable name, function name and type that variable symbol table preservation script modular converter program finds;
Program structure control storehouse is preserved the nested structure of being made up of many statements;
Memory management module is carried out unified management to internal memory distribution interface and assignable memory headroom, and sets up memory allocation pool;
Mistake is recovered the mistake of module to finding, provides suitable diagnostic message and continue to handle.
A kind of method that realizes transplantation between information websites of different platforms of the present invention has solved the automatic conversion of the platform ASP of Microsoft (Active Server Page) script to the automatic conversion of LINUX platform PHP (PHP:Hypertext Preprosessor) script, databases such as the platform ACCESS of Microsoft, MSSQL SERVER to LINUX platform MYSQL database and the key issues such as association process of script conversion and database conversion, can realize based on the robotization transplanting to the LINUX system of the information site of microsoft system.This technology will play great facilitation to the application of China LINUX operating system.
The present invention is described in detail below in conjunction with drawings and Examples.
Description of drawings
Fig. 1 is the realization flow figure of website of the present invention implantation method;
Fig. 2 is the realization flow figure of database conversion of the present invention;
Fig. 3 is a script modular converter structural representation of the present invention;
Fig. 4 is the realization flow figure of script conversion of the present invention;
Fig. 5 is a transplantation between information websites of different platforms one-piece construction synoptic diagram of the present invention;
Embodiment
Realize the method for transplantation between information websites of different platforms, be used for the first information website under Microsoft's platform is converted into second information site under the LINUX platform, described first information website comprises first database and first script of supporting ODBC, and described second information site comprises second database and second script of supporting ODBC.
In the embodiments of the invention, first database can be Access database, MsSQL SERVER database etc. for only supporting the support odbc database of Microsoft's platform, and described second database is the MySQL database.First script is the ASP script, and second script is the PHP script.
Open Database Connectivity (Open DataBase Connectivity, be called for short ODBC) is a kind of standard application program interface (API) that is used in relevant or incoherent data base management system (DBMS) access data.ODBC provides a high-rise calling interface standard of cover for application program and based on the operation support environment of dynamic link library.
The database auto-conversion function of the method for realization transplantation between information websites of different platforms of the present invention can be realized supporting the database of ODBC to convert the database of the another kind of ODBC of support to any.
The script auto-conversion function will convert among the corresponding PHP operation support to the MySQL database to the operation of database among the ASP; Conversion support to built-in objects among the ASP and file operation object is provided; Conversion support to the Design-time Control object that uses Microsoft Visual InterDev exploitation is provided; And provide multiple database to operate extended capabilities such as pre-service, script format consolidation pre-service support.In transfer process, must come SQL statement in the processing scripts according to the database that generates in database transfer process conversion mapping table.
The user can upload to the result of conversion the publisher server of user's appointment at last automatically, and the user just can view conversion information station afterwards very easily with browser.
Method to realization transplantation between information websites of different platforms of the present invention is described in detail below.
As shown in Figure 1, the method for realization transplantation between information websites of different platforms of the present invention may further comprise the steps:
Step S1: the database modular converter is converted to second database with first database, i.e. MySQL database is realized simultaneously to the association process of the storehouse list structure of database conversion and the conversion of two database corresponding field data types;
Step S2: database conversion mapping table is preserved the change of storehouse list structure in the database conversion association process and the variation of field data types;
Step S3: a script modular converter is converted to second script with first script;
Step S4: a database access object module is according to the association process of described database conversion mapping table realization to the script conversion.
In the database transfer process of step S1, can carry out the association process of following several respects:
The capital and small letter conversion of the name of tables of data or field:
There is not the requirement to database literary name section capital and small letter in SQL statement in Microsoft's platform environment, but the MySQL database of LINUX platform needs to distinguish.The Access database that generally adopts in the construction of first information website for the name case-insensitive of tables of data and field, so has the inconsistent place of a lot of capital and small letters in the database SQL statement of first information website.The MySQL database that generally uses on the Linux platform is a case sensitive for the name of tables of data and field.To this problem association process method is to check first database, discovery may exist the tables of data of capital and small letter ambiguity or the name of field, change the name of tables of data and field in the MySQL database (i.e. second database) after the conversion into small letter without exception, between corresponding relation also be kept at database as the part of mapping table and change in the mapping table;
The no ambiguity of the name of tables of data or field is handled:
Windows environment give a definition tables of data and field are transformed into the conflict that may cause key word under the MySQL database environment.To the problems referred to above association process method be: before the database conversion, check first database by converse routine, discovery may cause the name of key word conflicting data table or field, then be that this tables of data or field select the new name that can avoid the key word conflict to substitute, the corresponding relation between the alternative name of name originally and selection also is kept in the database conversion mapping table as the part of mapping table;
As comprising two tables of data in the ACCESS database (first database), the name of a table is use, comprises two fields in the table, and the name of field is respectively char and int; The name of another table is select, comprise two fields in the table, the name of field is respectively update and insert, and the key word of the one or more MySQL of being databases is arranged among this use, char, int, select, update, the insert, so just need these several tables of data and field name not had the ambiguity processing, the mapping table that produces in the no ambiguity processing procedure is as follows:
#table
use:use1
#field
char:char1
#field
int:int1
#table
select:select1
#field
update:update1
#filed
insert:insert1
#end
And do not have ambiguity handle no ambiguous data storehouse (i.e. second database) that the back produces in comprise:
Tables of data use1: comprise two fields of char1 and int1; And
Tables of data select1: comprise two fields of update1 and insert1.
The Sino-British conversion process of tables of data or field name:
Data base querying and the retouching operation existing problems of MySQL database to including Chinese table name and field name on the Linux platform can cause the incorrect of operation failure or operating result at present.
To the problems referred to above association process method be: when database is changed, check first database, original Chinese table name and field name substituted with corresponding english name, between corresponding relation also be kept in the database conversion mapping table.
Simultaneously, in the disparate databases system except having defined universal field data types such as character, numeral, date, some proprietary field data types have also been defined, therefore when carrying out the database conversion, there is proprietary field data types in first database, need redefines with the field data types of the second database support.
It is Access that table 1 has been described source database, and the destination data storehouse is under the situation of MySQL, the corresponding relation of field data types when converse routine is changed; It is SQLServer that form 2 has then been described source database, and the destination data storehouse is the situation of MySQL.
Table 1:
The Access data type The Mysql data type
Boolean type
Byte type numeral Tinyint
The integer numeral Int
Long shaping numeral Bigint
Single-precision floating point type numeral Float
Double-precision floating point type numeral Double
Synchronization replication ID numeral
Currency Decimal
Decimal (decimal) Float
Date Datetime
Automatic numbering Int
Text varchar(m)
Remarks Blob
Ole object Blob
Hyperlink Text
Table 2:
SQL Server data type The Mysql data type
Binary[(n)] varchar(l)
varbinary[(n)] Varbinary[(n)]
char[(n)] Char
varchar[(n)] Varchar
nchar[(n)] Char
nvarchar[(n)] Varchar
Datetime Datetime
?Smalldatetime ?Datetime
?Smallint ?Smallint
?Int ?Int
?Bigint ?Bigint
?Real ?Real
?Float ?Float
?Decimal ?Decimal
?Numeric ?Numeric
?Money ?Numeric
?Smallmoney ?Numerice
?Bit ?Varchar(l)
?Timestamp ?Datetime
?Uniqueidentifier ?Int
?Text ?Blob
?Image ?Blob
?Ntext ?Char
Can see that from form 1 Boolean type is the proprietary data type of Access, directly do not support the type in MySQL, therefore redefining to field length is the character types of 1 character.In the database transfer process, converse routine can be analyzed each field in first database table, and carries out the derivation importing of storehouse list structure and data content according to the corresponding relation of field data types.For the Boolean type field that occurs in the Access database, with reference to can in the MySQL database, set up the character types that field length is 1 character behind the corresponding relation, and be kept in the newly-built field after the data in boolean's field are changed accordingly.For Boolean type, the rule of conversion is that boolean's true value adopts character " T " to replace, and boolean's falsity adopts character " F " to replace.And the data converted type information is saved in database conversion mapping table.
The database modular converter comprises and connects source database module, data conversion module and be connected the destination data library module that as shown in Figure 2, step S1 may further comprise the steps again:
Step S11: connect source database module being connected by ODBC and source database;
Step S12: data conversion module creates the storehouse list structure be used for described second database, finish the conversion of the described first database data and finish association process to the storehouse list structure of database conversion;
Step S13: first database that will connect after the destination data library module will be changed by ODBC saves as second database.
Data conversion module mainly is made up of the conversion of storehouse list structure, two submodules of data-switching, mainly finishes the establishment of new storehouse list structure and the conversion of data, and this is the core of database crossover tool.It mainly finishes the establishment of the storehouse table from ACCESS, SQL Server to the MySQ1 database, and its establishment is to set up on the basis of data type mapping table.In setting up process, can solve the problems such as the conversion of no ambiguity, capital and small letter conversion, Chinese and English conversion of tables of data and field name according to User Defined.
Data conversion module comprises that also a destination data storehouse checks module, mainly is can simply browse, search the database structure of having changed by this module etc.
As Fig. 3, script crossover tool 3 mainly comprises J2PHP module 311, B2PHP module 312, memory management module 32, mistake recovery module 33, variable symbol table 34 and program structure control storehouse 35 6 parts.
The information of variable name, function name and type thereof that the program compiler of preserving variable symbol table 34 finds;
Program structure control storehouse 35 is preserved the nested structure of being made up of many statements, as circulation, selection/branch etc.;
J2PHP module 311 is Jscript compilers to PHP, and the design of this compiler is that the grammar construct that is based upon JavaScript carries out adopting top-down prediction analysis method during realization on the basis of labor.
B2PHP module 312 is VBScript compilers to PHP, it is responsible for analyzing the syntactic structure of VBScript program, and be in due course according to grammar-guided thought and cause different grammer actions, call relevant process and finish the conversion of whole VBScript language and the generation of php code.
The Memory Allocation interface and the assignable memory headroom of 32 pairs of whole compilers of memory management module carry out unified management, and set up the distributing reservoir of fair-sized, all distribute from system space avoiding at every turn.Based on distributing reservoir, program run efficient is improved, but also has reduced the possibility of makeing mistakes.
Mistake recovery module 33 can in time be found the mistake in the source program, thereby provides suitable diagnostic message and continue to compile down to find more mistake.
J2PHP module 311 comprises following ingredient:
One symbol table is used to store all symbols and information thereof, for example type, scope or the like;
One lexical analyzer is used for character stream (as first script) is converted to mark, as keyword, operational character etc.;
A syntax analyzer is used to read mark stream, and sets up syntax tree;
One semantic test device is used to check the semantic error of syntax tree;
One intermediate code maker is used for syntax tree is converted to intermediate code;
One optimizer is used to optimize intermediate code; And
One code generator is used for generating bytecode, i.e. second script from middle code.
The J2PHP module adopts two-pass scan when compiling.First pass is pre-service, mainly is identification DTC (Design-Time Control) and function declaration.Scan all function definitions, and the name of these functions is charged to function table, finish conversion work simultaneously all Design-Time controls.
In identification DTC, produce relevant PHP code, it is left in the code table.The name of function is write down the time in the recognition function statement, leaves in the function name tabulation, use preceding to adapt to function, statement after situation.
The essential object properties value (form with " NAME=XXX VALUE=XXX " in first script file provides) of extraction from DTC object statement (part of surrounding by '<OBJECT ' and '</OBJECT〉'), produce the PHP code then, attribute is composed to the PHP object that generates.The PHP code of these generations is output at once not, but temporarily be kept in the code table, and each DTC control class all has a code table, deposits the code of all these class objects.If there is not this class object, code table is empty.After pre-service finishes, export all DTC codes that pretreatment stage produces sequentially.Entered symbol table before the pairing variable name of DTC object that pretreatment stage produces is all being carried out second time scanning, therefore in the compilation phase of back, compiler can be discerned these objects, to produce correct PHP code.
For each DTC object, all there is a PHP object to realize its function.These PHP objects are kept among file mysql_class.inc and the dt_controls.inc.In the end must these two files be included with " require " statement in the PHP code of Sheng Chenging.
With the use-pattern of corresponding each attribute of PHP class of DTC and method mostly and identical under VisualInterDev, be convenient to user's needs according to oneself on the basis of the code that J2PHP produces like this and make amendment.
Second time is compilation process, comprises lexical analysis and grammatical analysis two large divisions.Syntax analyzer provides identifier by lexical analyzer, is responsible for the syntactic structure of correct identification JScript, and calls the generation that each modular converter is finished the PHP code.
Lexical analyzer comprises JScript lexical analyzer and DTC control statement lexical analyzer.
DTC control statement lexical analyzer obtains required information from the statement of DTC control, be called when pre-service DTC control is stated, once returns a lexical token.
The JScript lexical analyzer is used for extracting correct lexical token (Symbols) from the JScript program.It is four classes that lexical token is divided into: identifier, operational symbol, reserved word and special object mark.
Lexical analyzer is responsible for calling by syntax analyzer, whenever calls and once returns a lexical token, and the word of lexical token correspondence is preserved.When obtaining lexical token, lexical analyzer also is responsible for safeguarding two outside global variable: line and column, is used to follow the tracks of the row, column number of current input file respectively.When fault processing, can locate erroneous point exactly.
The JScript syntax analyzer is the foundation of whole J2PHP module, according to grammar-guided thought, adopt and not take back the analytical algorithm of tracing back from top to bottom guarantee that whole compilation process finishes in the single pass process.
Be the JScript grammar construct after the change of J2PHP module employing below.These syntax have determined the design philosophy and the implementation method of whole compiler:
STATEMENT->var?expression[;]|
function?IDENT([IDENT[,...]])|
expression[;]|
if(expression)|
else|
do|
while(expression)|
switch(expression)|
case?expression:|
default:|
break[;]|
for(expression;expression;expression)|
exit[([expression])][;]|
return[([expression])][;]|
linecomment|
blockcomment|
@STRING|
{|
}|
Expression being carried out grammer when disassembling, must consider the operation precedence level, because type of variables can dynamic change, and each operational symbol has different method for converting types.For as far as possible correctly discerning types of variables, must carry out classified finishing to the priority of operational symbol, will have identical method for converting types, and the operational symbol on same priority aspect is classified as a class, this notion of plurality of sub expression formula just occurred.Expression formula by subexpression from level to level deeply stops when the project of being resolved to and the factor.
Set up these variablees and open source file and file destination after, just can call the function interface of compiler and finish conversion work.The J2PHP module provides following function interface:
Int j2php_init (void): be used for the compiler initialization;
Int j2php_clear (void): be used for compiling and finish, discharge the system resource that compiler takies;
Void j2php_regfunc (char*func): function name func is charged to function table jfunct, allow this function of identification in the compiler compilation process afterwards;
Void j2php_regvars (char*name, int type): variable name name and its type type are charged to global variable table jgvars;
Int j2php_parser (FILE*inf, FILE*outf): start a compilation process when second time scanning, inf and outf are respectively the source and target file pointer;
Int j2php_passobject (FILE*inf, FILE*outf): the time allow compiler processes '<object ' and ' by the html mark second time scanning</object〉' part of encirclement.If belong to the DTC statement, compiler omits this section literal; If not, former state output.Inf and outf are respectively the source and target file pointer;
Int j2php_getfunction (FILE*infile): handle the JScript part at pretreatment stage, extract function declaration and charge to function table jfunct.Inf is the source file pointer;
The part of int j2php_getobject (FILE*infile): handle by the html mark '<object ' and '</object〉' encirclement at pretreatment stage.Then produce corresponding PHP code if belong to the DTC statement; If not, omit this section literal, do not produce any action.Inf is the source file pointer;
Int j2php_createDTC (FILE*outfile): pre-service finishes, and calls before second time scanning beginning, its objective is after the DTC code that generates in to preprocessing process is done certain adjustment to output to file destination outfile.Outfile is the file destination pointer;
Therefore can directly use the J2PHP module that the ASP source file is changed, also can allow external program that the user interface of other form is provided, call compiler by interface function.
The VBScript lexical analyzer of B2PHP module is used for extracting correct lexical token (Symbols) from the VBScript program, calls for syntax analyzer.Lexical token is divided three classes altogether: reserved word, operational symbol and special object mark.
And the VBScript syntax analyzer is the foundation of whole B2PHP module, is responsible for the syntactic structure of routine analyzer by it, and according to grammar-guided thought, and adopt and do not take back the generation that the analytical algorithm of tracing back realizes the PHP code from top to bottom.
Simultaneously, the B2PHP module also provides following function interface, can call the function interface of compiler and finish conversion work:
Int b2php_init (void): initialization compiler;
Void b2php_regvars (char*var, iht type): variable name name and its type type are charged to global variable table jgvars;
Void b2php_regfunc (char*func): function name func is charged to function table jfunct, allow this function of identification in the compiler compilation process afterwards;
Int b2php_clear (void): compiling finishes, and discharges the system resource that compiler takies;
Int b2php_parser (FILE*infile, FILE*outfile): start a compilation process when second time scanning, inf and outf are respectively the source and target file pointer;
Int b2php_getfunction (FILE*infile): handle the JScript part at pretreatment stage, extract function declaration and charge to function table jfunct, infile is the source file pointer.
ASP script with the Jscript code is the step S3 that the example explanation realizes the script conversion below, i.e. the compiling of first script is finished by the J2PHP module.
As shown in Figure 4, the script conversion comprises the steps:
Step S311: read first script and carry out pre-service, in pre-service, master routine check source file, catalogue and file destination, catalogue validity, open file or catalogue, all outside global variables and initialization compiler be set;
Step S312: carry out the scanning first time, handle DTC (Design-Time Control) control of existence and the function name in the function declaration; Read '<object ' mark, then call j2php_getobject and handle the DTC control that may exist; If reading that '<% ' or '<script runat=server language=javascript〉' wait below the expression is the mark of JScript code, then call the function name in the function declaration that the j2php_getfunction extraction may exist;
Step S313:, then call j2php_regfunc and j2php_regvars at this moment respectively and charge to the variables corresponding table if there is other to need the function or the variable name of statement in advance;
Step S314: call j2php_createDTC and export the DTC code that obtains among the described step S312 to second script;
Step S315: utilize the J2PHP module compiles and change the JScript code,, then call j2php_passobject, to guarantee the statement of DTC control not to be outputed to file destination if read '<object ' mark; If reading below the expressions such as '<% ' or '<script runat=server language=javascript〉' is the mark of JScript code, then call j2php_parser this section JScript code is compiled;
Step S316: second time end of scan, call j2php_clear and allow the compiler free system resources, and close the pointer of source file and file destination.
Simultaneously if in file destination, comprise " grabglobals.inc " and " mysql_class.inc ", then this moment generation corresponding PHP " require " statement in file destination.
The one database access object module association process that realization is changed script according to described database conversion mapping table can take the SQL statement that comprises in the page is carried out the method for static adjustment, also can take carrying out the method that SQL statement is dynamically adjusted.
The static method of adjusting is that database SQL statement operation code in the page is made amendment according to mapping table; When dynamically the method for adjusting is the execution of PHP language SQL statement is made amendment.
Dynamically adjustment is not the SQL statement of adjusting in the page script, but adjusts the SQL statement that passes over when carrying out, and therefore redesigns the SQL statement adjusting module, just can support site be transplanted on the new database.
As shown in Figure 5, among the figure as can be seen database conversion mapping table 2 are information channels between database conversion and the script conversion, between the two, transmit the modification information of storehouse list structure, comprise that mainly the data table name and the field name of capital and small letter conversion, the different processing of nothing, Chinese changes English or the like; And the adjustment that converse routine carries out automatically mainly comprises the conversion of field data types etc.
Call database access object module 4 in the PHP scripted code after the script conversion, after 4 pairs of SQL statement that passed over by PHP script 5 of access object module are optimized processing, call the bottom operation functional query of second database 6 and revise data, and the result that will carry out returns the PHP code 5 that calls it, set up the contact between database crossover tool and the script crossover tool in this way.Therefore, finished the transplanting work of information station jointly by database crossover tool, script crossover tool and the database access object module 4 between them.
Certainly; the present invention also can have other various embodiments; under the situation that does not deviate from spirit of the present invention and essence thereof; those of ordinary skill in the art work as can make various corresponding changes and distortion according to the present invention, but these corresponding changes and distortion all should belong to the protection domain of the appended claim of the present invention.

Claims (12)

1. method that realizes transplantation between information websites of different platforms, be used for and be converted under second platform second information site based on the first information website of ASP script and ACCESS, MSSQL SERVER database schema under first platform based on PHP script and MYSQL database schema, described first information website comprises first database and first script of supporting ODBC, described second information site comprises second database and second script of supporting ODBC, it is characterized in that, may further comprise the steps:
Step S1: a database modular converter is set described first database is converted to described second database, realization is to the association process of the storehouse list structure of two databases and the conversion of two database corresponding field data types;
Step S2: database conversion mapping table is set preserves the change of storehouse list structure in the database conversion association process and the variation of field data types;
Step S3: a script modular converter is set described first script is converted to described second script;
Step S4: a database access object module is set according to the association process of described database conversion mapping table realization to the script conversion.
2. the method for realization transplantation between information websites of different platforms according to claim 1 is characterized in that:
Described first platform is Microsoft's platform, and first script is the ASP script, and first database is ACCESS, MSSQL SERVER database; Described second platform is the LINUX platform, and second script is the PHP script, and second database is the MYSQL database.
3. the method for realization transplantation between information websites of different platforms according to claim 2 is characterized in that:
The association process step of described database conversion comprises that the no ambiguity of storehouse list structure is handled, Chinese and English is changed and the capital and small letter switch process.
4. the method for realization transplantation between information websites of different platforms according to claim 3 is characterized in that: the different treatment step of the nothing of storehouse list structure is that storehouse, table and the field of conflicting with key word in described second database are carried out rename; The Chinese and English switch process is that Chinese table name in described second database and field name are converted to English table name and field name; The capital and small letter switch process is to change table name and field name in described second database into small letter.
5. according to the method for claim 2,3 or 4 described realization transplantation between information websites of different platforms, it is characterized in that, realization is the SQL statement that will carry out described second database that described database access object module receives described second scripts pass to the association process step of script conversion, and revises tables of data and field in the described SQL statement according to described database conversion mapping table.
6. according to the method for claim 2,3 or 4 described realization transplantation between information websites of different platforms, it is characterized in that, realize that the association process step to the script conversion is that described database access object module is changed mapping table to tables of data and field in the SQL statement of in described second script described second database being operated according to described database.
7. the method for realization transplantation between information websites of different platforms according to claim 2, it is characterized in that, described database modular converter comprises and connects source database module, data conversion module and be connected the destination data library module that described step S1 may further comprise the steps again:
Step S11: connect source database module being connected by ODBC and source database;
Step S12: data conversion module creates the storehouse list structure be used for described second database, finish the conversion of the described first database data and finish association process to the storehouse list structure of database conversion;
Step S13: described first database that will connect after the destination data library module will be changed by ODBC saves as described second database.
8. according to the method for claim 2,3,4 or 7 described realization transplantation between information websites of different platforms, it is characterized in that, described first platform is Microsoft's platform, first script is the ASP script, first database is Access database, MSSQL SERVER database, described second platform is the LINUX platform, and second script is the PHP script, and second database is the MySQL database.
9. according to the method for claim 2 or 7 described realization transplantation between information websites of different platforms, it is characterized in that described first script and crus secunda originally are respectively ASP script and PHP script, described step S3 may further comprise the steps again:
Step S311: read described first script and carry out pre-service;
Step S312: carry out the scanning first time, handle the DTC control of existence and the function name in the function declaration;
Step S313: the function of record statement in advance or variable name are to the relevant variable table;
Step S314: export the DTC code that obtains among the described step S32 and arrive described second script;
Step S315: described first script of compiling and conversion Jscript or VBScript code;
Step S316: compiling finishes, free system resources, and the pointer of close file.
10. the method for realization transplantation between information websites of different platforms according to claim 9, it is characterized in that described pre-service comprises the validity of checking first script file, catalogue and crus secunda presents, catalogue, open file or catalogue, all outside global variables and initialization script modular converter are set.
11. the method for realization transplantation between information websites of different platforms according to claim 9 is characterized in that, described step S311 also comprises between step S315:
Step S317: as comprising grabglobals.inc file and mysql_class.inc file, then in described second script, generate the repuire statement of corresponding PHP in described second script.
12. the method for realization transplantation between information websites of different platforms according to claim 9 is characterized in that:
The information of variable name, function name and type that the script modular converter program of preserving the variable symbol table finds;
Program structure control storehouse is preserved the nested structure of being made up of many statements;
Memory management module is carried out unified management to internal memory distribution interface and assignable memory headroom, and sets up memory allocation pool;
Mistake is recovered the mistake of module to finding, provides suitable diagnostic message and continue to handle.
CNB2005100114200A 2005-03-11 2005-03-11 Method for realizing transplantation between information websites of different platforms Expired - Fee Related CN100403306C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2005100114200A CN100403306C (en) 2005-03-11 2005-03-11 Method for realizing transplantation between information websites of different platforms

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2005100114200A CN100403306C (en) 2005-03-11 2005-03-11 Method for realizing transplantation between information websites of different platforms

Publications (2)

Publication Number Publication Date
CN1664816A CN1664816A (en) 2005-09-07
CN100403306C true CN100403306C (en) 2008-07-16

Family

ID=35035909

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2005100114200A Expired - Fee Related CN100403306C (en) 2005-03-11 2005-03-11 Method for realizing transplantation between information websites of different platforms

Country Status (1)

Country Link
CN (1) CN100403306C (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101866364B (en) * 2010-06-22 2011-12-07 用友软件股份有限公司 Data lead-in method and device
CN102567422A (en) * 2010-12-27 2012-07-11 北大方正集团有限公司 Page display method and equipment
CN102867045A (en) * 2012-09-05 2013-01-09 武汉达梦数据库有限公司 Method and system for realizing compatibility of heterogeneous database reserved words based on driver layer
CN105069033B (en) * 2015-07-22 2018-06-22 北京京东尚科信息技术有限公司 A kind of method and device for creating database table model
CN106802901A (en) * 2015-11-26 2017-06-06 北京国双科技有限公司 The method and device of data base querying
CN107122187A (en) * 2017-04-26 2017-09-01 四川中电启明星信息技术有限公司 A kind of operation system OS accesses design method
CN107729345B (en) * 2017-07-27 2020-08-18 深圳壹账通智能科技有限公司 Website data processing method and device, website data processing platform and storage medium
CN107992327A (en) * 2017-12-07 2018-05-04 国云科技股份有限公司 The method that the script write under a kind of Windows environment is adapted to Linux
CN110740291A (en) * 2018-07-20 2020-01-31 视联动力信息技术股份有限公司 synchronization method and device based on video networking monitoring data
CN112000690B (en) * 2020-08-19 2024-03-19 北京人大金仓信息技术股份有限公司 Method and device for analyzing structured operation statement
CN115408473A (en) * 2022-11-01 2022-11-29 神州数码融信云技术服务有限公司 Data synchronization method and device, computer equipment and computer readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5838964A (en) * 1995-06-26 1998-11-17 Gubser; David R. Dynamic numeric compression methods
US6006232A (en) * 1997-10-21 1999-12-21 At&T Corp. System and method for multirecord compression in a relational database
CN1316707A (en) * 2000-01-25 2001-10-10 索尼株式会社 Data compaction and search method and data retieval equipment and recording medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5838964A (en) * 1995-06-26 1998-11-17 Gubser; David R. Dynamic numeric compression methods
US6006232A (en) * 1997-10-21 1999-12-21 At&T Corp. System and method for multirecord compression in a relational database
CN1316707A (en) * 2000-01-25 2001-10-10 索尼株式会社 Data compaction and search method and data retieval equipment and recording medium

Also Published As

Publication number Publication date
CN1664816A (en) 2005-09-07

Similar Documents

Publication Publication Date Title
CN100403306C (en) Method for realizing transplantation between information websites of different platforms
Huck et al. Jedi: Extracting and synthesizing information from the web
EP0449449B1 (en) Use of application programs on data in a heterogeneous data base system
Caprile et al. Nomen est omen: Analyzing the language of function identifiers
Sahuguet et al. Wysiwyg web wrapper factory (w4f)
CN102073490B (en) Method and device for translating database language
EP1315086B1 (en) Generation of localized software applications
US7454435B2 (en) Systems and methods for granular changes within a data storage system
US20060004725A1 (en) Automatic generation of a search engine for a structured document
AU2019294957A1 (en) Systems and methods for translating natural language sentences into database queries
US7853936B2 (en) Compilation of nested regular expressions
US20040158820A1 (en) System for generating an application framework and components
CN102375826A (en) Structured query language script analysis method, device and system
CN104657189B (en) Hybrid dynamic code compiling device, method and service system thereof
WO2007130227A1 (en) A generic interface for deep embedding of expression trees in programming languages
CN102880468A (en) Code intelligent prompting method and system for electronic control unit (ECU) program development
CN106843996A (en) Conditional compilation preprocess method and device
CN101499093A (en) Universal interaction method for internal memory database of monitoring system
CN103678396B (en) A kind of data back up method and device based on data model
Cordy et al. Software engineering by source transformation-experience with TXL
Li et al. Refactoring erlang programs
Cooke-Fox et al. Computer translation of IUPAC systematic organic chemical nomenclature. 3. Syntax analysis and semantic processing
US20040154004A1 (en) Web application code conversion system
EP1966691A2 (en) Method and system for compiling a source code
CN114691643A (en) Data migration method and system applied to domestic substitution

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20080716

Termination date: 20160311