CN101604338A - User-defined information query method of a kind of realization and device - Google Patents

User-defined information query method of a kind of realization and device Download PDF

Info

Publication number
CN101604338A
CN101604338A CNA200910158255XA CN200910158255A CN101604338A CN 101604338 A CN101604338 A CN 101604338A CN A200910158255X A CNA200910158255X A CN A200910158255XA CN 200910158255 A CN200910158255 A CN 200910158255A CN 101604338 A CN101604338 A CN 101604338A
Authority
CN
China
Prior art keywords
query
party
information
management system
template
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
CNA200910158255XA
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.)
Hangzhou H3C Technologies Co Ltd
Original Assignee
Hangzhou H3C Technologies 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 Hangzhou H3C Technologies Co Ltd filed Critical Hangzhou H3C Technologies Co Ltd
Priority to CNA200910158255XA priority Critical patent/CN101604338A/en
Publication of CN101604338A publication Critical patent/CN101604338A/en
Pending legal-status Critical Current

Links

Images

Landscapes

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

Abstract

The invention discloses the user-defined information query method of a kind of realization, be applied to comprise in the network system that third party's management system that at least two information can not be shared each other and Web server form.This method comprises: described Web server receive from the self-defined setting of keeper with the corresponding query template of at least one third party's management system wherein; When described query template is legal, store described query template; And reception is from the Query Information of other third party's management systems inputs; When described Query Information is correct, call the query template of the third party management system corresponding with described Query Information.Among the present invention, significantly reduce managerial personnel's workload, the user can own according to demand custom-built query template, has satisfied the various demands of user.The present invention provides a kind of device of corresponding the inventive method equally.

Description

User-defined information query method of a kind of realization and device
Technical field
The present invention relates to data communication field, particularly a kind ofly realize user-defined information query method and device based on web service.
Background technology
Along with deepening continuously of the applications of computer network, the informationization of enterprises and institutions is universal day by day, enterprises and institutions are when introducing various KXG, different management systems is very likely provided by different developers, and different management systems may adopt different language to develop, make and to carry out information sharing between each management system, formed information island between each management system each other.For example, in universities and colleges of university, have all-purpose card management system, network insertion far management system, student status management system etc., when above-mentioned management system is provided by different developers, isolated each other between each management system, when the new term, the new term begins, need in all-purpose card management system, network insertion far management system and student status management system, to open an account and pay the fees respectively, increase managerial personnel's workload, do not embodied informationalized facility fully.
In order to address the above problem, (the Service-OrientedArchitecture by SOA is arranged in the prior art, service-oriented architecture) service in the various management systems of structure, and manage mutual between the system with unified and universal mode, solve the problem of information island, made each management system can carry out mutual information sharing.Wherein, this SOA technology is independent of hardware platform, operating system and the programming language of the service of realization.For example, provide Web Services the service interface of (server) in the network insertion far management system of universities and colleges of university, (for example, all-purpose card management system and student status management system) called for third party's management system.Concrete, service interface by this Web Services, when in the all-purpose card management system, opening an account and paying the fees, can call the service interface of this WebServices automatically, thereby be implemented in the operation of opening an account and pay the fees in the network insertion far management system, and, significantly reduced managerial personnel's workload for the student provides the service of network insertion.
Yet, when merging various management system by use Web Services (based on the SOA technology), Web Services provider need define a series of interfaces according to the actual needs, interface message is outwards issued by Web Services, and provide corresponding WSDL (Web Services DefinitionLanguage simultaneously, Web Services Description Language (WSDL)) file, third party's management system changes into corresponding code by specific instrument with this wsdl document, and call corresponding service interface, thereby get access to the corresponding data of another system or operate accordingly by this interface.For example, the interface of Web Services provider define grid accounting access management system, and outwards announce the interface of this network insertion far management system and corresponding wsdl document, third party's management system (for example, the all-purpose card management system) wsdl document is changed into the employed code of all-purpose card management system, and call the interface of network insertion far management system, thereby be implemented in the operation of opening an account and pay the fees in the network insertion far management system.
Like this, along with user's demand is varied (for example, the user need call the interface of network insertion far management system, the interface of all-purpose card management system etc.), corresponding to each management system, must need outwards to announce query interface and wsdl document, be that Web Services provider need constantly develop and issue the pairing service interface of each management system, and utilize wsdl document to develop accordingly, thereby realize information sharing by Web Services by third party's management system development personnel.WebServices provider exploitation and when issuing the pairing service interface of each management system, brought a large amount of developments for WebServices provider, each demand all needs to carry out independent development﹠ testing, construction cycle is long, has wasted Web Services provider great amount of manpower and material resources, financial resources.
Summary of the invention
The invention provides user-defined information query method of a kind of realization and device,, realize information sharing to reduce user's development amount.
For achieving the above object, one aspect of the present invention provides a kind of method that realizes user-defined information inquiry, be applied to comprise in the network system that third party's management system that at least two information differ from one another shared and Web server form, said method comprising the steps of:
Described Web server receive be provided with from the keeper with the corresponding query template of at least one third party's management system wherein; When described query template is legal, store described query template;
Described Web server provides query interface according to described query template for other third party's management systems, receives from the Query Information of other third party's management systems by described query interface input; When described Query Information is correct, call the query template of the third party management system corresponding with described Query Information, and, Query Result is returned to other third party's management systems according to query template data query from this third party's Management System Data storehouse of described correspondence.
Preferably, described query template be the keeper in advance according to the self-defined setting of user's actual needs, the content of carrying comprises one or more in the following content:
The database parent name of command word, connection, SQL statement, input and output parameter.
Preferably, described Web server receives after the query template corresponding with at least one third party's management system wherein that is provided with from the keeper, also comprises:
Described Web server is resolved described query template, and judges the legitimacy of described query template;
When described query template was illegal, described Web server sent miscue, revised described query template by the keeper and laid equal stress on and newly send to described Web server.
Preferably, described query interface comprises singleQuery interface and multiQuery interface; Wherein,
Described singleQuery interface is used to provide the query function of wall scroll record; Described multiQuery interface is used to provide the query function of many records.
Preferably, described reception also comprises from after the Query Information of other third party's management systems by described query interface input:
Described Web server judges whether described Query Information is correct;
When described Query Information was incorrect, described Web server returned miscue to other third party's management systems.
Preferably, described Web server judges whether described Query Information correctly specifically comprises:
Whether described Web server is judged correct command word in the described Query Information, and judges whether the input parameter in the Query Information is legal;
Correct command word is arranged in described Query Information, and input parameter is when legal, described Web server judges that described Query Information is correct; Otherwise described Web server judges that described Query Information is incorrect.
Preferably, the described query template that calls the third party management system corresponding with described Query Information, and specifically comprise according to query template data query from this third party's Management System Data storehouse of described correspondence:
Described Web server calls the query template of third party's management system according to the command word in the described Query Information;
Described Web server obtains SQL statement from described query template, and uses the input parameter in the described Query Information to reorganize described SQL statement;
Described Web server is according to SQL statement data query from third party's Management System Data storehouse of described query template correspondence of described reorganization.
The present invention also provides a kind of user-defined information query device of realization of using the inventive method, be applied to comprise that described information query device comprises in the network system that third party's management system that at least two information can not be shared each other and Web server form:
Acquisition module, be used to receive be provided with from the keeper with the corresponding query template of at least one third party's management system wherein;
Memory module electrically connects with described acquisition module, is used for storing described query template when described query template is legal;
Enquiry module is used for receiving the Query Information of importing from other third party's management systems according to described query template for the query interface that other third party's management systems provide;
Processing module, electrically connect respectively with described memory module and enquiry module, be used for when described Query Information is correct, from memory module, call the query template of the third party management system corresponding with described Query Information, and, Query Result is returned to other third party's management systems of inquiry according to query template data query from this third party's Management System Data storehouse of described correspondence.
Preferably, described query template be the keeper in advance according to the self-defined setting of user's actual needs, carry content and comprise in the following content one or more: the database parent name of command word, connection, SQL statement, input and output parameter;
Described query interface comprises singleQuery interface and multiQuery interface; Wherein, described singleQuery interface is used to provide the query function of wall scroll record; Described multiQuery interface is used to provide the query function of many records.
Preferably, described device also comprises:
Judge module electrically connects respectively with described acquisition module and judge module, is used to judge whether the query template corresponding with third party's management system be legal; When legal, by described memory module storage; When illegal, send miscue by described acquisition module; Perhaps,
Be used to judge whether described Query Information is correct; When correct, described Query Information is handled by described processing module; When incorrect, return miscue to other third party's management systems by described enquiry module.
Preferably, when described judge module was used to judge that described Query Information is whether correct, whether be specially: judging had correct command word in the described Query Information, and judges whether the input parameter in the Query Information is legal; Correct command word is arranged, and input parameter judges that described Query Information is correct when legal in described Query Information; Otherwise, judge that described Query Information is incorrect.
Preferably, stating processing module specifically is used for:
Call the query template of third party's management system according to the command word in the described Query Information; From described query template, obtain SQL statement, and use the input parameter in the described Query Information to reorganize described SQL statement; And according to SQL statement data query from this third party's Management System Data storehouse of described query template correspondence of described reorganization.
Compared with prior art, the present invention has the following advantages: by the self-defining query template of storage in Web server, and provide corresponding inquiry service for third party's management system by the mode of query interface, thereby solved the problem of information island, make each management system can carry out mutual information sharing, significantly reduced managerial personnel's workload; And the user can own according to demand custom-built query template, has satisfied the various demands of user.
Description of drawings
Fig. 1 is the synoptic diagram of the concrete application scenarios of information query method of the present invention;
Fig. 2 is the method flow diagram of the present invention's application scenarios correspondence shown in Figure 1;
Fig. 3 is the detail flowchart of the present invention's keeper's self-defined inquiry shown in Figure 2 template;
Fig. 4 is the detail flowchart that the present invention keeper shown in Figure 2 uploads to query template Web server;
Fig. 5 is that the present invention's third party's management system shown in Figure 2 is called the detail flowchart of query template by using query interface;
Fig. 6 is the information query device structural drawing of application the inventive method of proposing of the present invention.
Embodiment
Core concept of the present invention is by the query template of user according to self-defined each management system of actual needs of self, and with the query template that defines by real-time the uploading in the Web server of configuration tool, when Web server knows that this query template is legal, store this query template, call by third party's management system, and from the Management System Data storehouse of correspondence, inquire the data that need, thus realized the information sharing between each management system, reduce managerial personnel's workload; And, the various demands of user have been satisfied because query template is user-defined.
Fig. 1 and Fig. 2 are respectively the concrete application scenarios synoptic diagram and the corresponding process flow diagrams of the method for information inquiry of the present invention, should be that application scenarios with universities and colleges of university is that example describes with scene, all can use scheme provided by the invention for any scene that comprises a plurality of management systems.Should comprise Web server and a plurality of management system with in the scene, for convenience of description, below comprise that with this management system all-purpose card management system, student status management system and network insertion far management system are that example describes.Need to prove that this Web server is based on SOA Technology in Web server, all based on the server of SOA technology all within protection scope of the present invention, for example, iMC (Intelligent Management Center, intelligent management center) server.Wherein, above-mentioned information query method may further comprise the steps:
Step S201, keeper's self-defined inquiry template.
The keeper can customize the query template of different query demands according to actual needs, for example, and for user authentication failure daily record custom-built query template, be user's information customization query template etc. of opening an account.Among the present invention, this query template can be described with general XML (Extensible Markup Language, extend markup language) form, and certainly, this query template also can be described with other form, does not repeat them here.
Further, for with a kind of query demand, the keeper can be all identical query templates of management system customization according to actual needs, for example, is all-purpose card management system, student status management system and the identical user authentication failure log query template of network insertion far management system customization.Certainly, the keeper also can be the different different query templates of management system customization according to actual needs, for example, be the independent customized user authentification failure of all-purpose card management system log query template 1, and be other management system customized user authentification failure log query template 2, this situation is not described in detail, and the present invention thinks that all identical query templates of management system customization are that example describes.
The keeper is provided with query template by management equipment, and this management equipment is the employed terminal device of keeper, and certainly, the mode that the keeper is provided with query template is not limited thereto, and does not repeat them here.
Among the present invention, the content in this query template includes but not limited to: the database parent name of command word, connection, SQL (Structured Query Language, Structured Query Language (SQL)) statement, input and output parameter etc.Wherein, this command word is the globally unique identifier of this query template, and the user can be by inquiring about the inquiry that this command word is called appointment, and obtain corresponding Query Result; The database parent name of this connection is used for describing inquiry and carries out from which database; This SQL statement is data base querying and programming language, is used for access data and inquiry, renewal and management database system; This input parameter has been pointed out operable all parameters of inquiry; This output parameter has returned result set information.
Step S202, the keeper uploads to Web server with this query template, by the legal query template of Web server storage.
The keeper query template is self-defined finish after, this query template is uploaded in the Web server, resolve this query template and carry out verification by this Web server, when check results is that this query template is when legal, Web server is stored this query template, when check results is that this query template is when illegal, Web server notifies this query template of keeper illegal information, the keeper revises this query template, and amended query template uploaded to Web server again, until this query template is legal and by till the Web server storage.
Among the present invention, Web server also needs according to this query template to make third party's management system realize user's self-defined inquiry by this query interface for the user provides corresponding query interface after obtaining query template.Wherein, this query interface is respectively multiQuery (multiple inquiry) interface and singleQuery (single inquiry) interface, certainly, according to the actual needs, can also realize self-defined inquiry for the user provides other query interface, does not repeat them here.
Step S203, third party's management system is called query template by using query interface, and uses the data in this query template inquiry correspondence database.For example, when the user that third party's management system need be inquired about the student status management system opens an account information, call user's query template of information of opening an account by this query interface, and use user in the database of this query template inquiry student status management system correspondence data of opening an account.
In order to understand realization of the present invention better, below introduce above steps in detail.Wherein:
The detailed process of keeper's self-defined inquiry template may further comprise the steps as shown in Figure 3:
Step S2011, the command word in keeper's self-defined inquiry template, wherein, this command word can adopt the command label to describe.
Step S2012, the database parent name of the connection in keeper's self-defined inquiry template, wherein, the database parent name of this connection can adopt the database label to describe, when carrying out the distributed data library inquiry, need in data designated storehouse (database of being inquired about), create database link, and realize distributed query by linked server; When carrying out non-distributed data base querying, can directly inquire about database.
Step S2013, SQL statement in keeper's self-defined inquiry template, wherein, the keeper can be according to the different different SQL statement of type of database definition, when SQL statement and database were irrelevant, then this SQL statement was a standard SQL sentence, for most database (the following relational database that all is called), all can use this standard SQL sentence, wherein this standard SQL sentence can use the common label to describe; And, need to use special SQL statement and label for specific database, for example,, need to adopt the mssql label to describe, and, need to adopt the oraclel label to describe for oracle database for the SqlServer database.Need to prove that when the custom-built query template, the keeper needs the SQL statement of design standards; Certainly, the keeper can also be designed for the SQL statement and the SQL statement that is used for oracle database of SqlServer database according to the actual needs.
Step S2014, the input parameter in keeper's self-defined inquiry template, wherein, this input parameter adopts the input label to describe, and the attribute of this input parameter includes but not limited to sequence number item, parameter name name, parameter type type etc.; This parameter type includes but not limited to int (short) type, long (long) type, float (single-precision number) type, double (double-precision quantity) type, string (character string) type, datetime (long date) type and date (short date) type etc.
Step S2015, output parameter in keeper's self-defined inquiry template, wherein, this output parameter adopts the return label to describe, and the information of carrying in the output parameter includes but not limited to return row sequence number item, returns row name (or being called parameter name) name, returns column data type (or being called parameter type) type etc.Wherein, this returns the row serial number and is meant which row of selecting in the SQL statement.
Need to prove, all there is not the sequencing relation between the above-mentioned steps S2011-step S2015, the sequencing that is above-mentioned 5 steps is for optional according to actual needs, wherein, the label describing mode of the database parent name of mentioned order word, connection, SQL statement, input and output parameter is not limited thereto, the label that can also choose other according to the actual needs is described, for example, for command word, can also use label order, for output parameter, can also use label output, do not repeat them here.
Example with a query template more clearly describes this self-defining query template below, and is as follows;
<?xml?version=″1.0″encoding=″gb2312″?>
-<query>
<command>query_user_auth_fail_log</command>
<database>ead</database>
-<sql>
-<!--
Self defined interface obtains type of database from the method for ead, read corresponding SQL according to type of database
oracle
mssql
-->
-<!--if SQL database is irrelevant, then can directly use the common label to describe, and does not need specific database label this moment
-->
<mssql>
SQL statement
<mssql>
<oracle>
SQL statement
</oracle>
</sql>
-<input>
<param?item=″1″type=″string″name=″userName″/>
<param?item=″2″type=″string″name=″loginName″/>
<param?item=″3″type=″datetime″name=″occurStartTime″/>
<param?item=″4″type=″datetime″name=″occurEndTime″/>
...
</input>
-<return>
<param?item=″1″type=″long″name=″id″/>
<param?item=″2″type=″long″name=″userId″/>
<param?item=″3″type=″long″name=″serviceId″/>
...
<param?item=″16″type=″string″name=″logonDomainName″/>
</return>
</query>
Wherein, in above-mentioned query template, query_user_auth_fail_log be command word (form of command word is<command〉command word</command), ead for the database parent name that connects (form is<database〉the database parent name</database), and defined the SQL statement of oracle database, the SQL statement of SqlServer database respectively; The content of carrying in the input parameter comprises userName (supporting type string) etc.; The content of carrying in the output parameter that returns has comprised 16 row, and the parameter of every row is referring to above-mentioned query template, and for example, first classifies id (supporting type long) as, does not repeat them here.
The keeper uploads to Web server with this query template, by the detailed process of the legal query template of Web server storage as shown in Figure 4, may further comprise the steps:
Step S2021, the keeper uploads to the query template that defines in the Web server.Wherein, the service provider provide based on SOA Technology in Web server in, in order to realize the process of dynamic load query template and dynamic releasing inquiry template, the configuration interface of uploading query template is provided for the keeper, the keeper can upload to above-mentioned self-defining query template in this Web server by using this configuration interface, this self-defining query template is described in detail in above-mentioned flow process shown in Figure 3, does not repeat them here.
Step S2022, Web server resolve this query template, and judge the legitimacy of this query template, when this query template is legal, forward step S2024 to, when this query template is illegal, forward step S2023 to.
Concrete, Web server is after receiving query template, parse the corresponding contents that carries in this query template, promptly parse five parts such as database parent name, SQL statement, input and output parameter of command word, connection, whether legal by the content of judging above-mentioned five parts, thus whether finally judge this query template legal.For example, when in parsing query template, not having the part other parts such as (or) input parameters of command word, can know that this query template is illegal; When in the application of reality not during the represented database of the database parent name of this connection, this query template is illegal as can be known; When mistake appearred in the programming of SQL statement, this query template was illegal as can be known, and certainly, this illegal situation is to be provided with arbitrarily according to the actual needs, does not repeat them here.
Step S2023, Web server sends miscue, and requires the keeper to revise query template and upload amended query template again, forwards step S2022 to, judges by Web server whether amended query template is legal.Wherein, Web server can only send an error information, mistake occurs to inform this query template of keeper; Web server can also carry the reason of makeing mistakes in miscue, so that the keeper is directly known the reason of makeing mistakes, for example, when not having command word in the query template, Web server directly sends the miscue that does not have command word, the keeper directly adds command word in query template after knowing this information.
Step S2024, Web server store this query template.Wherein, Web server can be directly be loaded into the information of this query template in the internal memory, and is stored in the server file system, can directly call this query template fast in follow-up use.
Concrete, Web server also needs to provide the inquiry service of this Web server by command word to the outside, makes third party's management system can use this query template to carry out inquiry service, thereby has realized the dynamic issue of self-defined inquiry.For example, when needs use relevant information that query template inquires about this all-purpose card management system (for example, user's the information of opening an account) time, this third party's management system is all systems except this all-purpose card management system and Web server, for example, student status management system, network insertion far management system etc.When needs used the relevant information of this query template inquiry other system, the situation of third party's management system did not similarly repeat them here.
Further, example corresponding to above-mentioned query template, after the keeper need outwards issue command word query_user_auth_fail_log, the third party just can call the query template of correspondence by using this query_user_auth_fail_log, and uses this query template to visit the database of corresponding third party's management system.
Third party's management system is called query template by using query interface, and the detailed process of using the data in this query template inquiry correspondence database is as shown in Figure 5, may further comprise the steps:
Step S2031, Web server provides query interface according to above-mentioned self-defining legal query template for the user.
Particularly, in the present invention, Web server provides two kinds of query interfaces to realize user's self-defined inquiry, and this query interface is respectively multiQuery interface and singleQuery interface.Third party's management system is by calling this multiQuery interface or this singleQuery interface realizes inquiring about relevant data.For example, the all-purpose card management system is by using the information of opening an account of terminal user in this singleQuery interface requester network accounting access management system.Need to prove that this all-purpose card management system is carried out information inquiry by using query template, below describe this singleQuery interface and multiQuery interface respectively in detail.
(1) singleQuery interface; Be used to provide the simple queries function of wall scroll record, when using this singleQuery interface to inquire about, Query Result returns a record at most, and this record that returns is to return with the character string array of one dimension.Among the present invention, for this singleQuery interface, input parameter comprises the array (this array is an input parameter part in the query template) of command word and querying condition; Comprise field name, field type and the field value etc. that return in the result set that returns, this content of returning is the output parameter part in the above-mentioned query template, and promptly this content of returning is the result of inquiry; Wherein, when not meeting the record of querying condition, the error number of then returning (errorCode) is 0 (certainly, according to the actual needs, also can return other error number), and the character string array (resultValues) of corresponding one dimension is null (sky).
Need to prove that when using the singleQuery interface to inquire about, third party's management system of calling this singleQuery interface need provide 3 parameters, and is as shown in table 1:
Table 1
Type Parameter name Describe
Character string command Command word, custom-built query of unique identification, the different different query contents of command word representative; Wherein, this command word correspondence the life in the query template
Make word.
The character string one-dimension array ParaNames Every title array in the querying condition, for example, in the above-mentioned query template, this every name is respectively userName etc.
The character string one-dimension array ParaValues The array of every value in the querying condition for example, in above-mentioned query template, can be " Zhang San " etc. corresponding to the value of this userName.
When the third party used this singleQuery interface, it was as shown in table 2 to carry the content (being rreturn value) that attribute comprises in the corresponding rreturn value (be Web server to Query Result that third party's management system is returned):
Table 2
Attribute type Attribute-name Describe
Integer ColumnCount The columns that comprises data in the Query Result, for example, in the above-mentioned query template, the columns that returns is 16.
The character string one-dimension array ColumnNames The name that comprises data rows in the Query Result, for example, in the above-mentioned query template, this name is respectively id etc.
The character string one-dimension array ColumnTypes Comprise the type of data rows in the Query Result, be respectively string etc.
The character string one-dimension array ResultValues The value that comprises data in the Query Result, for example, in above-mentioned query template, the value of id can be 1000.
Integer ErrorCode Error number, when successful inquiring, then this rreturn value is 0, the expression successful inquiring certainly, according to the actual needs, can also be represented successful inquiring with other rreturn value, does not repeat them here; When failure inquiry, then return concrete error number, wherein, this error number has corresponding relation with concrete mistake, and this corresponding relation will be known clearly in the process below
The thin description do not repeat them here.
Character string ErrorMsg Error message, when inquiring about the appearance mistake, then this rreturn value is concrete error message, and this error message and above-mentioned concrete error number have corresponding relation, and when inquiry mistake occurred, the error message of then returning was a sky.
(2) multiQuery interface; Be used to provide the query function of many records, when using this multiQuery interface to inquire about, Query Result may return many records, and this record that returns is to return with the form of 2D string array.Among the present invention, for this multiQuery interface, input parameter comprises the array (this array is an input parameter part in the query template) of command word, querying condition, the position that begins to peek and the information that need return several records; Comprise field name, field type and the field value etc. that return in the result set that returns, this content of returning is the output parameter part in the above-mentioned query template, and promptly this content of returning is the result of inquiry; Wherein, when not meeting the record of querying condition, the error number of then returning (errorCode) is 0, and corresponding 2D string array (esultValues) is empty, and the record number that returns is 0.
Need to prove that when using the multiQuery interface to inquire about, third party's management system of calling this multiQuery interface need provide 5 parameters, and is as shown in table 3:
Table 3
Type Parameter name Describe
Character string Command Command word, custom-built query of unique identification, the different different query contents of command word representative.
The character string one-dimension array ParaNames Every title array in the querying condition.
The character string one-dimension array ParaValues The array of every value in the querying condition.
Integer StartPos The reference position of the Query Result that this inquiry is returned, wherein, when Query Result was a lot, Web server can return Query Result several times, and
Only need the returning part Query Result at every turn when returning, promptly need to specify the reference position (for example, specifying this reference position of returning is, then begins to return Query Result from reference position 10) of the Query Result that this inquiry returns at 10 o'clock.
Integer Count The record number that this inquiry need be returned.
When third party's management system was used this multiQuery interface, the content that the attribute that carries in the corresponding rreturn value comprises was as shown in table 4:
Table 4
Attribute type Attribute-name Describe
Integer RecordCount The outcome record number of actual queries corresponding to the count part in the table 3, promptly returns the record number that this inquiry need be returned.
Integer ColumnCount The columns that comprises data in the Query Result.
The character string one-dimension array ColumnNames The name that comprises data rows in the Query Result.
The character string one-dimension array ColumnTypes The type that comprises data rows in the Query Result.
Integer TotalRecordCount Qualified record number promptly satisfies the record number of querying condition.
The character string two-dimensional array ResultValues The row collection array of Query Result, wherein the first dimension group element is represented which concrete bar record, the second dimension group element is represented every pairing specifying information of record.
Integer ErrorCode Error number, if during successful inquiring, then this rreturn value is 0, the expression successful inquiring, otherwise, return concrete error number.
Character string ErrorMsg Error message, if inquire about when mistake occurring, then this rreturn value is concrete error message, otherwise the error message of returning is for empty.
Step S2032, third party's management system by query interface to Web server input inquiry information.
Concrete, when third party's management system is called the singleQuery interface, need the related content in the above-mentioned table 1 of input; When third party's management system is called the multiQuery interface, need the related content in the above-mentioned table 3 of input; For convenience of description, among the present invention, calling the singleQuery interface with third party's management system is that example describes.When third party's management system is called the singleQuery interface, the information field that Web server need be imported third party's management system offers third party's management system by query interface, thereby, third party's management system can be directly according to the corresponding information of information field input that shows in this singleQuery interface, for example, third party's management system needs the array of every value in every title array in input command word, the querying condition and the corresponding querying condition.
Step S2033, whether Web server is checked has correct command word to exist in the Query Information of this input, when correct command word exists, forward step S2035 to, when not having command word existence or command word mistake (in Web server, not having corresponding query template), forward step S2034 to.
Step S2034, Web server returns error number and miscue to third party's management system.Wherein, Web server can send error information to third party's management system, mistake occurs to inform third party's management system, and to the corresponding error number of third party's management system transmission, for example, by sending error number 1 to third party's management system, expression does not have command word.As shown in table 5, be a kind of error number and concrete wrong corresponding relation, certainly, content in this table 5 is not limited thereto, this error number and concrete wrong corresponding relation also are not limited to this, content in this table 5 can be expanded and revise according to the actual needs arbitrarily, does not repeat them here.
Table 5
Error number Concrete mistake
1 There are not command word or command word mistake
2 Input parameter is made mistakes
3 SQL statement is made mistakes
Step S2035, Web server check whether input parameter is legal, and promptly whether the parameter that provided of third party's management system all exists in the query template of command word correspondence.If there is no, then forward step S2034 to,, forward step S2036 to if exist.
Step S2036, Web server call the content in the query template.Wherein, Web server calls the query template of correspondence according to this command word, and extracts the content in this query template.
Step S2037, Web server obtain out corresponding SQL statement from query template; And the parameter renegotiation new organization SQL statement of using third party's management system to provide.Wherein, Web server can find corresponding database according to the database parent name (can find by the database label) of the connection in this query template, and uses this SQL statement to inquire about this database.Among the present invention, when third party's management system did not provide in the query template desired all parameters, the parameter value that can only provide third party's management system was replaced according to the actual needs.For example, in the SQL statement in query template, name, sex, age etc. are arranged during type, if when the third party only provides name, the name that the name that then only needs to use third party's management system to provide is replaced in the query template gets final product.
Need to prove that Web server obtains out corresponding SQL statement and specifically comprises from query template:
(1) Web server checks whether third party's management system provides the common statement needed input parameter, when providing needed input parameter of common statement and input parameter all correct, then obtain the SQL statement of common label correspondence in the query template.
(2) do not provide the common statement needed input parameter as the third party, or during the needed input parameter mistake of common statement, the type of the Content inspection database of the database parent name part of Web server by connecing, when database is the oraclel database, obtain the SQL statement of oraclel label correspondence in the query template; When database is the SqlServer database, obtain the SQL statement of mssql label correspondence in the query template.
(3) Web server uses the parameter of third party's management system input to replace in this query template corresponding parameters in the SQL statement.
Step S2038, Web server uses the SQL statement data query from database after replacing, and the data that inquire are returned to third party's management system.The process of data no longer encyclopaedizes in this use SQL statement Query Database.
Among the present invention, when successful inquiring, then error number is changed to 0 (certainly, according to the actual needs, can also error number be set to other numerical value, be used for representing successful inquiring, do not repeat them here), and the requirement that meets data based third party's management system of querying condition returned, the content of this information of returning as shown in above-mentioned table 2 do not repeat them here.When failure inquiry, then return corresponding error number and error message, the content of this information of returning as shown in above-mentioned table 5, for example, when input parameter was made mistakes, the error number that Web server returns was 2, the wrong content of returning is that input parameter is made mistakes.
Wherein, the inventive method can be adjusted each sequence of steps according to actual needs.
As seen, the method that the application of the invention provides, by the self-defining query template of storage in Web server, and provide corresponding query template for third party's management system by the mode of query interface, thereby solved the problem of information island, make each management system can carry out mutual information sharing, significantly reduce managerial personnel's workload; And the user can own according to demand custom-built query template, has satisfied the various demands of user.
The invention allows for a kind of user-defined information query device of realization of using the inventive method, be applied to comprise in the network system that third party's management system that at least two information can not be shared each other and Web server form, wherein this Web server is based on SOA Technology in Web server, as shown in Figure 6, described Web server comprises:
Acquisition module 61, be used to receive be provided with from the keeper with the corresponding query template of at least one third party's management system wherein; Wherein, described query template be the keeper according to the self-defined setting of user's actual needs, carry content and comprise in the following content one or more: the database parent name of command word, connection, SQL statement, input and output parameter.
Memory module 62 electrically connects with described acquisition module 61, is used for storing described query template when described query template is legal.
Enquiry module 63 is used for receiving the Query Information of importing from other third party's management systems according to described query template for the query interface that other third party's management systems provide; Wherein, described query interface comprises singleQuery interface and multiQuery interface; Described singleQuery interface is used to provide the query function of wall scroll record; Described multiQuery interface is used to provide the query function of many records.
Processing module 64, electrically connect respectively with described memory module 62 and enquiry module 63, be used for when described Query Information is correct, from memory module 62, call the query template of the third party management system corresponding with described Query Information, and, Query Result is returned to other third party's management systems according to query template data query from database of described correspondence.
Among the present invention, when enquiry module 63 received the Query Information of importing from other third party's management systems, processing module 64 was called the query template of third party's management system according to the command word in the described Query Information; From described query template, obtain SQL statement, and use the input parameter in the described Query Information to reorganize described SQL statement; And according to SQL statement data query from this third party's Management System Data storehouse of described query template correspondence of described reorganization.
Judge module 65, electrically connect respectively with described acquisition module 61, memory module 62, enquiry module 63 and processing module 64, when acquisition module 61 received the query template corresponding with at least one third party's management system wherein from the keeper, judge module 65 judged whether the query template corresponding with third party's management system be legal; When legal, by described memory module 62 storages; When illegal, send miscue by described acquisition module 61.Perhaps
When enquiry module 63 received the Query Information of importing from other third party's management systems, judge module 65 judged whether described Query Information is correct; When correct, handle by 64 pairs of described Query Informations of described processing module; When incorrect, return miscue to other third party's management systems by described enquiry module 63.
Further, when enquiry module 63 receives Query Information, described judge module 65 is used to judge whether described Query Information is correct, is specially: whether judge module 65 is judged correct command word in the described Query Information, and judges whether the input parameter in the Query Information is legal; Correct command word is arranged, and input parameter judges that described Query Information is correct when legal in described Query Information; Otherwise, judge that described Query Information is incorrect.
Above-mentioned module can be distributed in the parts of apparatus of the present invention, also can be distributed in a plurality of parts of apparatus of the present invention.Above-mentioned module can be merged into a module, also can further split into a plurality of submodules.
Through the above description of the embodiments, those skilled in the art can be well understood to the present invention and can realize by hardware, also can realize by the mode that software adds necessary general hardware platform.Based on such understanding, technical scheme of the present invention can embody with the form of software product, it (can be CD-ROM that this software product can be stored in a non-volatile memory medium, USB flash disk, portable hard drive etc.) in, comprise some instructions with so that computer equipment (can be personal computer, server, the perhaps network equipment etc.) carry out the described method of each embodiment of the present invention.
It will be appreciated by those skilled in the art that accompanying drawing is the synoptic diagram of a preferred embodiment, module in the accompanying drawing or flow process might not be that enforcement the present invention is necessary.
It will be appreciated by those skilled in the art that the module in the device among the embodiment can be distributed in the device of embodiment according to the embodiment description, also can carry out respective change and be arranged in the one or more devices that are different from present embodiment.The module of the foregoing description can be merged into a module, also can further split into a plurality of submodules.
The invention described above sequence number is not represented the quality of embodiment just to description.
More than disclosed only be several specific embodiment of the present invention, still, the present invention is not limited thereto, any those skilled in the art can think variation all should fall into protection scope of the present invention.

Claims (12)

1, the user-defined information query method of a kind of realization is applied to comprise in the network system that third party's management system that at least two information differ from one another shared and Web server form, and it is characterized in that, said method comprising the steps of:
Described Web server receive be provided with from the keeper with the corresponding query template of at least one third party's management system wherein; When described query template is legal, store described query template;
Described Web server provides query interface according to described query template for other third party's management systems, receives from the Query Information of other third party's management systems by described query interface input; When described Query Information is correct, call the query template of the third party management system corresponding with described Query Information, and, Query Result is returned to other third party's management systems according to query template data query from this third party's Management System Data storehouse of described correspondence.
2, the method for claim 1 is characterized in that, described query template be the keeper in advance according to the self-defined setting of user's actual needs, the content of carrying comprises one or more in the following content:
The database parent name of command word, connection, SQL statement, input and output parameter.
3, the method for claim 1 is characterized in that, described Web server receives after the query template corresponding with at least one third party's management system wherein that is provided with from the keeper, also comprises:
Described Web server is resolved described query template, and judges the legitimacy of described query template;
When described query template was illegal, described Web server sent miscue, revised described query template by the keeper and laid equal stress on and newly send to described Web server.
4, the method for claim 1 is characterized in that, described query interface comprises singleQuery interface and multiQuery interface; Wherein,
Described singleQuery interface is used to provide the query function of wall scroll record; Described multiQuery interface is used to provide the query function of many records.
5, the method for claim 1 is characterized in that, described reception also comprises from after the Query Information of other third party's management systems by described query interface input:
Described Web server judges whether described Query Information is correct;
When described Query Information was incorrect, described Web server returned miscue to other third party's management systems.
6, method as claimed in claim 5 is characterized in that, described Web server judges whether described Query Information correctly specifically comprises:
Whether described Web server is judged correct command word in the described Query Information, and judges whether the input parameter in the Query Information is legal;
Correct command word is arranged in described Query Information, and input parameter is when legal, described Web server judges that described Query Information is correct; Otherwise described Web server judges that described Query Information is incorrect.
7, the method for claim 1 is characterized in that, the described query template that calls the third party management system corresponding with described Query Information, and specifically comprise according to query template data query from this third party's Management System Data storehouse of described correspondence:
Described Web server calls the query template of third party's management system according to the command word in the described Query Information;
Described Web server obtains SQL statement from described query template, and uses the input parameter in the described Query Information to reorganize described SQL statement;
Described Web server is according to SQL statement data query from third party's Management System Data storehouse of described query template correspondence of described reorganization.
8, a kind of user-defined information query device of realization of using the inventive method, be applied to comprise in the network system that third party's management system that at least two information can not be shared each other and Web server form, it is characterized in that described information query device comprises:
Acquisition module, be used to receive be provided with from the keeper with the corresponding query template of at least one third party's management system wherein;
Memory module electrically connects with described acquisition module, is used for storing described query template when described query template is legal;
Enquiry module is used for receiving the Query Information of importing from other third party's management systems according to described query template for the query interface that other third party's management systems provide;
Processing module, electrically connect respectively with described memory module and enquiry module, be used for when described Query Information is correct, from memory module, call the query template of the third party management system corresponding with described Query Information, and, Query Result is returned to other third party's management systems of inquiry according to query template data query from this third party's Management System Data storehouse of described correspondence.
9, device as claimed in claim 8, it is characterized in that, described query template be the keeper in advance according to the self-defined setting of user's actual needs, carry content and comprise in the following content one or more: the database parent name of command word, connection, SQL statement, input and output parameter;
Described query interface comprises singleQuery interface and multiQuery interface; Wherein, described singleQuery interface is used to provide the query function of wall scroll record; Described multiQuery interface is used to provide the query function of many records.
10, device as claimed in claim 8 is characterized in that, described device also comprises:
Judge module electrically connects respectively with described acquisition module and enquiry module, is used to judge whether the query template corresponding with third party's management system be legal; When legal, by described memory module storage; When illegal, send miscue by described acquisition module; Perhaps,
Be used to judge whether described Query Information is correct; When correct, described Query Information is handled by described processing module; When incorrect, return miscue to other third party's management systems by described enquiry module.
11, device as claimed in claim 10 is characterized in that, when described judge module is used to judge that described Query Information is whether correct, is specially:
Whether in described Query Information have correct command word, and judge whether the input parameter in the Query Information is legal if judging; Correct command word is arranged, and input parameter judges that described Query Information is correct when legal in described Query Information; Otherwise, judge that described Query Information is incorrect.
12, device as claimed in claim 11 is characterized in that, described processing module specifically is used for:
Call the query template of third party's management system according to the command word in the described Query Information; From described query template, obtain SQL statement, and use the input parameter in the described Query Information to reorganize described SQL statement; And according to SQL statement data query from this third party's Management System Data storehouse of described query template correspondence of described reorganization.
CNA200910158255XA 2009-07-23 2009-07-23 User-defined information query method of a kind of realization and device Pending CN101604338A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNA200910158255XA CN101604338A (en) 2009-07-23 2009-07-23 User-defined information query method of a kind of realization and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNA200910158255XA CN101604338A (en) 2009-07-23 2009-07-23 User-defined information query method of a kind of realization and device

Publications (1)

Publication Number Publication Date
CN101604338A true CN101604338A (en) 2009-12-16

Family

ID=41470067

Family Applications (1)

Application Number Title Priority Date Filing Date
CNA200910158255XA Pending CN101604338A (en) 2009-07-23 2009-07-23 User-defined information query method of a kind of realization and device

Country Status (1)

Country Link
CN (1) CN101604338A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102033871B (en) * 2009-09-25 2013-01-02 中国移动通信集团浙江有限公司 Method and system for sharing public resource data by multiple information systems
CN103577420A (en) * 2012-07-23 2014-02-12 中国移动通信集团上海有限公司 Method and device for inquiring user information dynamically
CN105868295A (en) * 2016-03-24 2016-08-17 苏州科技学院 Customizable template based data reporting system for legal person database
CN108647316A (en) * 2018-05-10 2018-10-12 北京中电普华信息技术有限公司 Data processing method and device
CN109032252A (en) * 2018-07-02 2018-12-18 清远网软网络科技有限公司 The method and system of the automatic management of enterprise's template file
CN109684403A (en) * 2018-12-24 2019-04-26 广东电网有限责任公司 Dispatching of power netwoks information query method
CN113177490A (en) * 2021-05-07 2021-07-27 中国铁道科学研究院集团有限公司 Passenger travel information query method and device

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102033871B (en) * 2009-09-25 2013-01-02 中国移动通信集团浙江有限公司 Method and system for sharing public resource data by multiple information systems
CN103577420A (en) * 2012-07-23 2014-02-12 中国移动通信集团上海有限公司 Method and device for inquiring user information dynamically
CN105868295A (en) * 2016-03-24 2016-08-17 苏州科技学院 Customizable template based data reporting system for legal person database
CN108647316A (en) * 2018-05-10 2018-10-12 北京中电普华信息技术有限公司 Data processing method and device
CN109032252A (en) * 2018-07-02 2018-12-18 清远网软网络科技有限公司 The method and system of the automatic management of enterprise's template file
CN109684403A (en) * 2018-12-24 2019-04-26 广东电网有限责任公司 Dispatching of power netwoks information query method
CN113177490A (en) * 2021-05-07 2021-07-27 中国铁道科学研究院集团有限公司 Passenger travel information query method and device

Similar Documents

Publication Publication Date Title
CN101256650B (en) Method and system for extracting enterprise data based on service entity
CN101604338A (en) User-defined information query method of a kind of realization and device
US7433887B2 (en) Method and apparatus for metadata driven business logic processing
US8234308B2 (en) Deliver application services through business object views
CN101930443B (en) Data service system and data service realization method
US8966357B2 (en) User interface for establishing mappings from internal metadata to external metadata
CN107370786A (en) A kind of general information management system based on micro services framework
US20050114394A1 (en) Mapping XML schema components to qualified Java components
CN104572122A (en) Software application data generating device and method
CN101410830A (en) System and method for storing and retrieving XML data encapsulated as an object in a database store
US20070276970A1 (en) Data Consistency Validation
CN111160658B (en) Collaborative manufacturing resource optimization method, system and platform
CN110503408B (en) Business process management system based on custom configuration
US10262055B2 (en) Selection of data storage settings for an application
CN109726244A (en) Data lead-in method and device
CN105005543A (en) Interface generation apparatus and method
US6606637B1 (en) System and method for unified data access of financial data
CN109753490A (en) Database optimizing method, system, equipment and medium based on loophole reparation
CN103678591A (en) Device and method for automatically executing multi-service receipt statistical treatment
CN109255587A (en) A kind of cooperative processing method and device of operational data
US7325003B2 (en) Method and system for mapping datasources in a metadata model
CN108376082A (en) A kind of reference library method for updating edition and system
CN102123099A (en) Message processing system and method
CN111522840A (en) Label configuration method, device, equipment and computer readable storage medium
CN116450637A (en) Data management method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20091216