CN103473311B - A kind of method and device introducing external data base in HTML5 applies - Google Patents
A kind of method and device introducing external data base in HTML5 applies Download PDFInfo
- Publication number
- CN103473311B CN103473311B CN201310412404.7A CN201310412404A CN103473311B CN 103473311 B CN103473311 B CN 103473311B CN 201310412404 A CN201310412404 A CN 201310412404A CN 103473311 B CN103473311 B CN 103473311B
- Authority
- CN
- China
- Prior art keywords
- data base
- external data
- path
- local path
- configuration file
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 37
- 230000004913 activation Effects 0.000 claims description 5
- 238000001514 detection method Methods 0.000 claims description 3
- 230000003213 activating effect Effects 0.000 claims 1
- 238000000151 deposition Methods 0.000 claims 1
- 238000010586 diagram Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 5
- 239000000203 mixture Substances 0.000 description 2
- 206010028916 Neologism Diseases 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a kind of method and device introducing external data base in HTML5 applies.Described method comprises determining that HTML5 application preserves the local path of local data base;Judge whether described local path exists external data base;If not existing, described external data base is copied in described local path;By revising the configuration file of described external data base, activate the external data base replicated in described local path.By the present invention, HTML5 application, without using external data base by SQL statement, so that user is without having to worry about speed issue, improves Consumer's Experience, and avoids the error in data caused due to user operation, additionally, also save CPU and memory source.
Description
Technical field
The present invention relates to HTML5 technical field, particularly relate to a kind of introduce in HTML5 applies outside
The method and device of portion data base.
Background technology
HTML (HTML, Hypertext Markup Language) 5 is HTML
Next main revision version.Broadly, HTML5 refers to comprise HTML, CSS
(CSS, Cascading Style Sheets) and a set of technical combinations of JavaScript, target
It is to reduce the browser demand to the rich network english teaching of plug-in unit, and provides more multipotency to have
Effect strengthens the standard of network application.Specifically, HTML5 provides some new element and attributes, wherein
Including " Web SQL Database " (herein referred as HTML5 local data base), this function is embedded
The data base that can be accessed by SQL statement.In HTML4, data base can only be at server
End, can only be conducted interviews by server, and in HTML5, can be as accessing local file one
Embedded data base is directly conducted interviews by sample.
When data base is the external data base provided by third party, to realize external data base
Access, method is that this external data base is converted into SQL statement intuitively, HTML5 apply
Middle reading SQL statement also performs, thus generates the data identical with external data base.
It is poor that said method there is problems of the access performance to external data base, specifically, and SQL
The speed that statement performs is relatively slow, especially when the data volume in data base is bigger, and slow-footed problem
More prominent, thus cause poor Consumer's Experience.If user moves back when SQL statement is carrying out
Go out application, the data in data base can be caused to make a mistake, owing to this mistake is by the behaviour of user
Cause as mode, therefore cannot detect and avoid.Additionally, data base is converted into SQL statement,
The resource of CPU and internal memory can be consumed, and take bigger memory space.
Summary of the invention
The present invention provides a kind of method and device introducing external data base in HTML5 applies, with
Improve the performance accessing external data base.
A kind of method introducing external data base in HTML5 applies, described method includes:
Determine that HTML5 application preserves the local path of local data base;
Judge whether described local path exists external data base;
If not existing, described external data base is copied in described local path;
By revising the configuration file of described external data base, activate duplication in described local path
External data base.
Preferably, by revising the configuration file of described external data base, described local path is activated
The external data base of middle duplication includes:
Obtain the path of configuration database;
Open described configuration database;
Judge whether described configuration database comprises the configuration file of the external data base of duplication;
If there being described configuration file, then its path field is revised as and the external data base that replicates
Information is consistent, otherwise, a newly-built configuration file, its path field and the external data base of duplication
Information consistent.
Alternatively, after whether there is external data base in judging described local path, described side
Method also includes:
If there is described external data base, it is judged that whether the version of described external data base is higher than described
The already present external data base of local path, if being higher than, copies to described by described external data base
In local path, flow process terminates.
Alternatively, before determining the local path that HTML5 application preserves local data base, described
Method also includes:
The environment in described HTML5 application initialization data storehouse, and start introducing external data library facility.
Alternatively, at the configuration file by revising described external data base, activate described local road
After the external data base replicated in footpath, described method also includes:
After described HTML5 applying detection is activated to the external data base of described duplication, perform to open
The operation of data base.
A kind of device introducing external data base in HTML5 applies, described device includes:
Determine unit, for determining that HTML5 application preserves the local path of local data base;
First judging unit, is used for judging whether there is external data base in described local path;
Copied cells, if for not existing, copying to described local path by described external data base
In;
Activate unit, for the configuration file by revising described external data base, activate described
The external data base replicated in path, ground.
Preferably, described activation unit includes:
Acquiring unit, for obtaining the path of configuration database;
Open unit, be used for opening described configuration database;
Second judging unit, for judging whether to comprise in described configuration database the external number of duplication
Configuration file according to storehouse;
Matching unit, if for there being described configuration file, being then revised as its path field and replicate
The information of external data base consistent, otherwise, a newly-built configuration file, its path field is with multiple
The information of the external data base of system is consistent.
Alternatively, described device also includes:
Updating block, is used for after described first judging unit is judged to there is described external data base,
Judge that whether the version of described external data base is higher than the already present external data of described local path
Storehouse, if being higher than, copies to described external data base in described local path.
As can be seen here, external data base is copied in local path by the present invention, and to replicate outside
Portion data base activates, such that it is able to use external data base, whole process is without passing through SQL
Statement performs, so that user is without having to worry about speed issue, improves Consumer's Experience, and avoids
The error in data caused due to user operation, additionally, also save CPU and memory source.Also need
It is noted that the present invention can also determine whether the external data base of more highest version, therefore originally
The data base that HTML5 application can also be used by invention upgrades.
Accompanying drawing explanation
By description to embodiment below in conjunction with the accompanying drawings, the present invention will be apparent from and is easier to
It is understood.For convenience, accompanying drawing shows presently preferred embodiment of the invention;But,
It is understood that the invention is not restricted to shown clear and definite step and unit.Accompanying drawing includes:
The method flow diagram that Fig. 1 provides for the embodiment of the present invention one;
The method flow diagram that Fig. 2 provides for the embodiment of the present invention two;
The device block diagram that Fig. 3 provides for the embodiment of the present invention three;
The device block diagram that Fig. 4 provides for the embodiment of the present invention four.
Detailed description of the invention
Hereinafter, will with reference to the accompanying drawings the exemplary embodiment of the present invention be described in detail.
Before detailed description is illustrated, it should be appreciated that be used in this specification and right
Term and word in requirement may be not limited to its ordinary meaning or dictionary meanings, but at inventor's energy
Enough use neologisms to explain in the best way under the principle of the present invention, be interpreted to be suitable to the technology of the present invention
The implication of scope or concept.
The present invention provides embodiment make open abundant and be fully contemplated by those skilled in the art.To tool
Body details such as concrete steps, device are illustrated, thoroughly to understand the present embodiment.To this area
For technical staff, it is clear that need not use concrete details, embodiment can be with many different
Form specifically embody, and should not be construed as limitation of the scope of the invention.At some
In embodiment, known technology is not described in detail.
Therefore, this specification describe embodiment and accompanying drawing shown in structure be only used in the present invention
Embodiments of the invention are illustrated in technical scope.Those skilled in the art should understand that and can make respectively
Plant equivalence to replace and amendment replacement embodiment.
HTML5 application is a kind of client software, can use hybrid programming system.For ease of understanding
The present invention, the hybrid programming system that the present invention relates to is illustrated by this section.First, HTML5 is one
Plant client end interface to show and the standard of programming, written in JavaScript can be used.The present invention relates to
And hybrid programming system refer to partial code use HTML5 write, partial code use senior
Programming language writes (function that high-level programming language is write is commonly referred to plug-in unit).Its main feature bag
Include: 1. major part function uses JavaScript to realize;2. for different equipment, the height of employing
Level programming language is different, such as, uses the equipment of android system, uses written in Java, make
With the equipment of iOS system, Object C is used to write;3. use the merit that high-level programming language is write
Can, application programming interfaces (API, Application Program Interface) can be provided,
JavaScript can perform, by calling API, the function that high-level programming language is write.
External data base is initially stored in the installation path of HTML5 application, and HTML5 application cannot be straight
External data base is asked in receiving.External data base is introduced HTML5 application and is meant that by the present invention: will
External data base copies in the path that HTML5 application is specified and is activated, and such HTML5 should
With just can directly use external data base, now, external data base has been converted into HTML5 application
Data base in the database architecture of oneself.
Refer to Fig. 1, the method flow diagram provided for the embodiment of the present invention one, following step can be included
Rapid:
Step 101: determine that HTML5 application preserves the local path of local data base;
Step 102: judge whether there is external data base in local path;
Step 103: if not existing, external data base is copied in local path;
Step 104: by revising the configuration file of external data base, activates duplication in local path
External data base.
As can be seen here, the method that the present invention provides passes through above-mentioned steps without just may be used by SQL statement
To use external data base, so that user is without having to worry about speed issue, improve Consumer's Experience,
And avoid the error in data caused due to user operation, additionally, also save CPU and internal memory money
Source.
Below in conjunction with another embodiment, the present invention is further described in more detail.
Refer to Fig. 2, the method flow diagram provided for the embodiment of the present invention two, following step can be included
Rapid:
The environment in step 201:HTML5 application initialization data storehouse;
The environment of data base is carried out initialized purpose is that the function making data base is carried out, no
Then, will be unable to carry out subsequent step.
Specifically, the environment in initialization data storehouse can be by opening newly-built database realizing.Example
As, it is possible to use following code (wherein, Xxtebook is newly-built data base's name):
The application of step 202:HTML5 starts introducing external data library facility;
Specifically, HTML5 application starts introducing external data library facility and can pass through API Calls first
Plug-in unit realizes, and described first plug-in unit can be operated by duplication and activation manipulation introduces external data
Storehouse (is hereinafter described in detail).Different hybrid programming systems, the mode calling plug-in unit is different,
As a example by Mobile solution development platform phonegap of mobile device, call the first plug-in unit and can pass through
Following code realizes:
window.plugins.xxtEbookInit.startup(startupWin,fail);
Step 203: the first plug-in unit determines that HTML5 application preserves the local path of local data base;
The path that different equipment or browser core preserve data base is different, specifically, permissible
Determine this path by document, convenient for the sake of, herein this path is referred to as local path, i.e. before
The HTML5 that literary composition is mentioned applies the path specified.
Step 204: the first plug-in unit judges whether there is external data base in local path, if existing,
Flow process terminates, and otherwise enters step 205;
" flow process terminates " is meant that herein: when HTML5 application starts every time, all can first carry out
JavaScript code, JavaScript and then call the first plug-in unit, if having been incorporated into external number
According to storehouse, then for self-defined information that is time-consuming and that maintain user to add in data base, it is not necessary to
It is introduced back into.If but external data base has higher version, external data can be reintroduced back to
Storehouse, therefore, it can be updated the external data base introduced in the following way.
Alternatively, if local path exists external data base, the first plug-in unit determines whether external number
Whether being higher than the already present external data base of local path according to the version in storehouse, if being higher than, entering step
205, otherwise, flow process terminates.
Step 205: external data base is copied in local path by the first plug-in unit;
The process of described duplication, can be the reproduction process of binary file.
Step 206: the first plug-in unit, by revising the configuration file of external data base, activates local path
The external data base of middle duplication;
Activate closely related with mobile phone operating system and different system and activate the external data replicated
The concrete grammar in storehouse is different.The configuration file of data base is saved in Database by Webkit system
In data base, accordingly, it would be desirable to the configuration file in amendment Database data base just can activate multiple
The external data base of system.For use android system equipment, the first plug-in unit can by with
The external data base that the activation of lower step replicates:
Step 206-1: obtain the path of configuration database;
Configuration database is a data base of the data base of management HTML5, and its name is
Databases.db, its path is saved in db_path variable, and different systems, db_path
Variable is different.
Step 206-2: open configuration database;
Step 206-3: judge whether to comprise in configuration database the configuration literary composition of the external data base of duplication
Part;
Step 206-4: if there being described configuration file, then be revised as its path field and replicate
The information of external data base is consistent, otherwise, a newly-built configuration file, its path field and duplication
The information of external data base consistent.
By step 206-1 to step 206-4, it is possible to activate the external data base replicated, thus
Make HTML5 can use external data base.Specifically, can be realized by code below:
After step 207:HTML5 applying detection is activated to the external data base replicated, again perform
Open the operation of data base, to use external data base.
Specifically, can be realized by following code:
Db=window.openDatabase (" xxtebook ", " 1.0 ", " Xxtebook
Database",1*1024*1024);
Pass through above-mentioned steps, it can be seen that external data base is copied in local path by the present invention,
And the external data base replicated is activated, such that it is able to use external data base, whole process
Without being performed by SQL statement, so that user is without having to worry about speed issue, improve user's body
Test, and avoid the error in data caused due to user operation, additionally, also save CPU and interior
Deposit resource.It may also be noted that owing to the first plug-in unit can also determine whether more highest version
External data base, the data base that therefore HTML5 application can also be used by the present invention upgrades.
Refer to Fig. 3, the device block diagram provided for the embodiment of the present invention three, may include that
Determine unit 301, for determining that HTML5 application preserves the local path of local data base;
First judging unit 302, is used for judging whether there is external data base in local path;
Copied cells 303, if for not existing, copying to external data base in local path;
Activate unit 304, for the configuration file by revising external data base, activate local path
The external data base of middle duplication.
Refer to Fig. 4, the device block diagram provided for the embodiment of the present invention four.
Described activation unit 304 may include that
Acquiring unit 401, for obtaining the path of configuration database;
Open unit 402, be used for opening described configuration database;
Second judging unit 403, for judging whether to comprise in described configuration database the outside of duplication
The configuration file of data base;
Matching unit 404, if for there being described configuration file, then its path field is revised as with
The information of the external data base replicated is consistent, otherwise, a newly-built configuration file, its path field
Consistent with the information of the external data base replicated.
Fig. 3 shown device can also include:
Updating block 405, for judging to there is described external number at described first judging unit 302
Behind storehouse, it is judged that outside the version of described external data base is the most already present higher than described local path
Portion data base, if being higher than, copies to described external data base in described local path.
It can be seen that external data base is copied in local path by the present invention, and to replicate outside
Portion data base activates, such that it is able to use external data base, whole process is without passing through SQL
Statement performs, so that user is without having to worry about speed issue, improves Consumer's Experience, and avoids
The error in data caused due to user operation, additionally, also save CPU and memory source.Also need
It is noted that owing to the first plug-in unit can also determine whether the external data base of more highest version,
Therefore the data base that HTML5 application can also be used by the present invention upgrades.
Term used herein, merely to describe specific embodiment, is not intended to limit.As herein
Using, unless context is expressly noted that, term " includes " comprising, and therefore describes in detail
Statement feature, entirety, step, operation, element and/or parts, it is not excluded that one or
Other existence of feature, entirety, step, operation, element, parts and/or a combination thereof multiple
Or it is additional.
Although term first, second can be used to describe various parts, these parts should be by these
Term limits.These terms can only be used for being distinguished parts with another parts.Unless
Context clearly indicates, when use such as " first ", " second " and other numerical terms this
During the term of sample, do not imply that sequence or order.Therefore, in the feelings of the principle without departing substantially from embodiment
Under condition, the first component of description can be referred to as second component.
The description purpose providing the present embodiment is by explanation, is not intended to limit or limits the present invention.
Single step or parts are not intended in this embodiment, even if being not specifically illustrated or retouching
State, it is also possible to be interchangeable in the embodiment of applicable selection and use.Can also be according to being permitted
Multimode is changed, and these changes are without departing from the present invention, and all these change is included in
In the scope of the present invention.
Claims (8)
1. the method introducing external data base in HTML5 applies, it is characterised in that described
Method includes:
Determine that HTML5 application preserves the local path of local data base;
Judge whether described local path exists external data base;
If not existing, described external data base is copied in described local path;
By revising the configuration file of described external data base, activate duplication in described local path
External data base.
Method the most according to claim 1, it is characterised in that by revising described external number
According to the configuration file in storehouse, activate the external data base replicated in described local path and include:
Obtain the path of configuration database;
Open described configuration database;
Judge whether described configuration database comprises the configuration file of the external data base of duplication;
If there being described configuration file, then its path field is revised as and the external data base that replicates
Information is consistent, otherwise, a newly-built configuration file, its path field and the external data base of duplication
Information consistent.
Method the most according to claim 1, it is characterised in that judging described local path
In whether there is external data base after, described method also includes:
If there is described external data base, it is judged that whether the version of described external data base is higher than described
The already present external data base of local path, if being higher than, copies to described by described external data base
In local path, flow process terminates.
Method the most according to claim 1, it is characterised in that determining that HTML5 application is protected
Before depositing the local path of local data base, described method also includes:
The environment in described HTML5 application initialization data storehouse, and start introducing external data library facility.
Method the most according to claim 1, it is characterised in that by revising described outside
The configuration file of data base, after activating the external data base replicated in described local path, described
Method also includes:
After described HTML5 applying detection is activated to the external data base of described duplication, perform to open
The operation of data base.
6. the device introducing external data base in HTML5 applies, it is characterised in that described
Device includes:
Determine unit, for determining that HTML5 application preserves the local path of local data base;
First judging unit, is used for judging whether there is external data base in described local path;
Copied cells, if for not existing, copying to described local path by described external data base
In;
Activate unit, for the configuration file by revising described external data base, activate described
The external data base replicated in path, ground.
Device the most according to claim 6, it is characterised in that described activation unit includes:
Acquiring unit, for obtaining the path of configuration database;
Open unit, be used for opening described configuration database;
Second judging unit, for judging whether to comprise in described configuration database the external number of duplication
Configuration file according to storehouse;
Matching unit, if for there being described configuration file, being then revised as its path field and replicate
The information of external data base consistent, otherwise, a newly-built configuration file, its path field is with multiple
The information of the external data base of system is consistent.
Device the most according to claim 6, it is characterised in that described device also includes:
Updating block, is used for after described first judging unit is judged to there is described external data base,
Judge that whether the version of described external data base is higher than the already present external data of described local path
Storehouse, if being higher than, copies to described external data base in described local path.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201310412404.7A CN103473311B (en) | 2013-09-11 | 2013-09-11 | A kind of method and device introducing external data base in HTML5 applies |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201310412404.7A CN103473311B (en) | 2013-09-11 | 2013-09-11 | A kind of method and device introducing external data base in HTML5 applies |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN103473311A CN103473311A (en) | 2013-12-25 |
| CN103473311B true CN103473311B (en) | 2016-10-12 |
Family
ID=49798159
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201310412404.7A Active CN103473311B (en) | 2013-09-11 | 2013-09-11 | A kind of method and device introducing external data base in HTML5 applies |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN103473311B (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104462463B (en) * | 2014-12-17 | 2018-08-14 | 南京莱斯信息技术股份有限公司 | Data access methods of the JavaScript based on SQL templates |
| CN119557013A (en) * | 2024-11-26 | 2025-03-04 | 山东中创软件商用中间件股份有限公司 | External class library loading method, device, equipment and medium based on application server |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| EP1686498A2 (en) * | 2005-01-31 | 2006-08-02 | Microsoft Corporation | Integration of a non-relational query language with a relational data store |
| CN102053822A (en) * | 2009-10-27 | 2011-05-11 | 上海杉达学院 | Method and device for connecting Java information platform and SQL Server database |
| CN102402626A (en) * | 2011-12-28 | 2012-04-04 | 用友软件股份有限公司 | Dynamic query system and method for version inheritance data |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2007061430A1 (en) * | 2005-11-22 | 2007-05-31 | Bea Systems, Inc. | System and method for translating sql queries into xml query language |
-
2013
- 2013-09-11 CN CN201310412404.7A patent/CN103473311B/en active Active
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| EP1686498A2 (en) * | 2005-01-31 | 2006-08-02 | Microsoft Corporation | Integration of a non-relational query language with a relational data store |
| CN102053822A (en) * | 2009-10-27 | 2011-05-11 | 上海杉达学院 | Method and device for connecting Java information platform and SQL Server database |
| CN102402626A (en) * | 2011-12-28 | 2012-04-04 | 用友软件股份有限公司 | Dynamic query system and method for version inheritance data |
Also Published As
| Publication number | Publication date |
|---|---|
| CN103473311A (en) | 2013-12-25 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10809991B2 (en) | Security model for live applications in a cloud collaboration platform | |
| Taivalsaari et al. | Web browser as an application platform | |
| US7917888B2 (en) | System and method for building multi-modal and multi-channel applications | |
| Relan | Building REST APIs with Flask | |
| US20140282372A1 (en) | Code separation with semantic guarantees | |
| Cheng et al. | Build Mobile Apps with Ionic 4 and Firebase | |
| KR20140060299A (en) | Transformational context-aware data source management | |
| CN105893061A (en) | Application program development method and system | |
| CN116450107B (en) | Method and device for secondary development of software by low-code platform and electronic equipment | |
| US10680901B2 (en) | Configuration management in a multisystem environment | |
| US9509761B2 (en) | Open user interface | |
| CN103473311B (en) | A kind of method and device introducing external data base in HTML5 applies | |
| US9921855B2 (en) | Systems and methods for generating an interactive user interface from a database | |
| CN118427218A (en) | State information configuration method and device, electronic equipment, storage medium and computer program product | |
| US11977473B2 (en) | Providing a pseudo language for manipulating complex variables of an orchestration flow | |
| Amatya | Cross-platform mobile development: An alternative to native mobile development | |
| CN110874322A (en) | Test method and test server for application program | |
| Marchioni | MongoDB for Java developers | |
| Sadakath | Spring Boot 2.0 Projects: Build production-grade reactive applications and microservices with Spring Boot | |
| Abeille et al. | State of the Tango controls kernel development in 2019 | |
| CN116755684B (en) | OAS Schema generation method, device, equipment and medium | |
| Patel | Spring 5.0 Projects: Build Seven Web Development Projects with Spring MVC, Angular 6, JHipster, WebFlux, and Spring Boot 2 | |
| Merten et al. | GeoPandas-AI: A Smart Class Bringing LLM as Stateful AI Code Assistant | |
| Yin | Salesforce-Usability of Lightning Web Components | |
| Hoang | Finnish scanner mobile application |
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 |