CN108255544A - The method that Android SQLite databases create or upgrade script batch performs - Google Patents

The method that Android SQLite databases create or upgrade script batch performs Download PDF

Info

Publication number
CN108255544A
CN108255544A CN201810028670.2A CN201810028670A CN108255544A CN 108255544 A CN108255544 A CN 108255544A CN 201810028670 A CN201810028670 A CN 201810028670A CN 108255544 A CN108255544 A CN 108255544A
Authority
CN
China
Prior art keywords
script
line
database
upgrade
sentence
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
CN201810028670.2A
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.)
Wuhan Zhi Bo Enjoy Polytron Technologies Inc
Original Assignee
Wuhan Zhi Bo Enjoy Polytron Technologies Inc
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 Wuhan Zhi Bo Enjoy Polytron Technologies Inc filed Critical Wuhan Zhi Bo Enjoy Polytron Technologies Inc
Priority to CN201810028670.2A priority Critical patent/CN108255544A/en
Publication of CN108255544A publication Critical patent/CN108255544A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/3005Arrangements for executing specific machine instructions to perform operations for flow control
    • G06F9/30065Loop control instructions; iterative instructions, e.g. LOOP, REPEAT
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • G06F16/2448Query languages for particular applications; for extensibility, e.g. user defined types
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2216/00Indexing scheme relating to additional aspects of information retrieval not explicitly covered by G06F16/00 and subgroups
    • G06F2216/01Automatic library building

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention provides the methods that a kind of establishment of Android SQLite databases or upgrade script batch perform, and include the following steps:The script sentence that data library initialization needs or the script sentence that database upgrade needs are programmed into script file line by line;The script file write is put under mobile application Resource TOC;When mobile application is installed, it reads corresponding script sentence in script file line by line according to current database version number, and preserves in chained list in memory, after script is read, program statement is performed by a cycle line by line, memory is performed line by line to all script sentences in memory chained list.The amount of writing that database initializtion script performs code is greatly reduced in the present invention, safeguards simple;The step of simplifying database upgrade so that database upgrade does not need to write additional code;Greatly improve the efficiency of data library initialization.

Description

The method that Android SQLite databases create or upgrade script batch performs
Technical field
The present invention relates to based on Android operation system developing intellectual resource mobile application field more particularly to a kind of Android The method that SQLite databases create or upgrade script batch performs.
Background technology
Currently, when carrying out mobile application exploitation based on android system, if the SQLite numbers embedded using Android The storage using data is carried out according to library, then the script that each CRUD is operated during data library initialization, it will be by writing journey Sequence sentence and the code of script sentence mixing perform, and could complete the initialization of entire application database, and each number It also needs to write code again according to qurush grade to realize.
The shortcomings that prior art is:Each script of mobile application data library initialization will be held by writing code Row, when data base data model is more complicated, script amount is bigger, it is necessary to write a large amount of script and perform code language Sentence performs corresponding script.Also, when database upgrade, also need to write code, in this way, not only written in code amount is big, And it is difficult to safeguard.
Invention content
The purpose of the present invention is to provide a kind of Android SQLite databases create or upgrade script batch perform method, It is intended for reducing Android mobile application database initializtion script execution size of code, simplifies database upgrade step, promote number According to qurush stage efficiency.
The invention is realized in this way:
The present invention provides a kind of method that Android SQLite databases create or upgrade script batch performs, and includes the following steps:
The script sentence that data library initialization needs or the script sentence that database upgrade needs are programmed into script text by S1 line by line In part;
The script file write is put under mobile application Resource TOC by S2;
When mobile application is installed, corresponding script sentence in script file is read according to current database version number line by line by S3, And in the chained list of preservation in memory, after script is read, program statement is performed by a cycle line by line, it will remember to interior All script sentences deposited in chained list perform line by line.
Further, in the step S1, each complete script sentence independently occupies a line of file.
Further, the step S2 is specially:The script file write is put into mobile applications engineering catalogue " raw " catalogue under.
Further, in the step S3, different script sentences is put into different sub-line journeys and performed, pass through thread Pond is managed collectively sub-line journey, realizes the parallel execution of script sentence.
Further, in the step S1, during each database upgrade, the script file of increment is write, while change and work as Database version number definition in preceding application program, is consistent with database version number in increment script file.
Further, in the step S3, if upgrading to database, with reference to the corresponding database of current application program Version number and the database version number of user local, the whole script files that will be differed between Liang Ge version numbers, according to version number Sequence reads and performs one time in turn.
Compared with prior art, the invention has the advantages that:
The method that this Android SQLite databases provided by the invention create or upgrade script batch performs, first by database Initialization or upgrade script are programmed into script file line by line, and script file is put under mobile application Resource TOC, mobile to answer Corresponding script sentence file is read, and pass through a cycle and hold line by line according to current database version number line by line with during installation Line program sentence, so as to quickly and easily complete the initialization and upgrade job of database.Data library initialization is greatly reduced Script performs the amount of writing of code, safeguards simple;The step of simplifying database upgrade so that database upgrade does not need to write Additional code;Greatly improve the efficiency of data library initialization.
Description of the drawings
Fig. 1 is the method that Android SQLite databases provided in an embodiment of the present invention create or upgrade script batch performs Flow chart.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained all other without making creative work Embodiment shall fall within the protection scope of the present invention.
It is created as shown in Figure 1, the embodiment of the present invention provides a kind of Android SQLite databases(Initialization)Or upgrade script The method that batch performs, includes the following steps:
The script sentence that data library initialization needs or the script sentence that database upgrade needs are programmed into script text by S1 line by line In part;
The script file write is put under mobile application Resource TOC by S2;
When mobile application is installed, corresponding script sentence in script file is read according to current database version number line by line by S3, And in the chained list of preservation in memory, after script is read, program statement is performed by a cycle line by line, it will remember to interior All script sentences deposited in chained list perform line by line.
Data library initialization or upgrade script are programmed into script file by the present invention line by line first, and script file is put into Under mobile application Resource TOC, corresponding script sentence is read according to current database version number line by line when mobile application is installed File, and pass through a cycle and perform program statement line by line, so as to quickly and easily complete the initialization of database and upgrading work Make.The amount of writing that database initializtion script performs code is greatly reduced, safeguards simple;Simplify the step of database upgrade Suddenly so that database upgrade does not need to write additional code;Greatly improve the efficiency of data library initialization.
In the step S1, if initializing database, then need to create script file, in the script file Write all CRUD operation script sentences of data library initialization needs.If upgrading database, then need to write increasing The script file of amount, while the definition of the database version number in current application program is changed, with database in increment script file Version number is consistent.
Preferably, in the step S1, each complete script sentence independently occupies a line of file, does not allow One script occupies multirow, facilitates subsequent reading and execution.
Preferably, the step S2 is specially:The script file write is put into mobile applications engineering mesh Under " raw " catalogue of record." raw " catalogue of Android engineerings is used to store original document, it ensure that application program exists After publication, the script valency of asking will not be confused and be compiled into binary file.
In the step S3, if being initialized to database, then mobile applications packet installation after, program first by Row reads the script sentence in script file, and preserves in chained list in memory, after script is read, passes through a cycle three Line code can perform memory line by line to all script sentences in memory chained list.
Due to the version number of current database defined in application program, i.e., there are one the application programs of each version Corresponding database version, again there are one corresponding script file, each script file is each database version Relative to the increment script of a upper version, this ensure that the application program of different editions only needs to perform the increasing of different editions Foot-measuring this document, and the code of perform script is shared, it does not need to additionally write code.In the step S3, if to database Upgraded, with reference to the corresponding database version number of current application program and the database version number of user local, by two versions The whole script files differed between this number according to version number's sequence read and perform one time in turn, ensure user application Database be matching version number.
In order to improve script execution efficiency, preferably, in the step S3, different script sentences is put into difference Sub-line journey in perform, sub-line journey is managed collectively by thread pool, realizes the parallel execution of script sentence, it is exponential The efficiency for improving data library initialization.
One of ordinary skill in the art will appreciate that all or part of step for realizing above-described embodiment is can to pass through journey Sequence is completed to instruct relevant hardware, which can be stored in a computer readable storage medium, and storage medium can be with Including:Read-only memory(ROM, Read Only Memory), random access memory(RAM, Random Access Memory), disk or CD etc..
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention With within principle, any modification, equivalent replacement, improvement and so on should all be included in the protection scope of the present invention god.

Claims (6)

1. a kind of method that Android SQLite databases create or upgrade script batch performs, which is characterized in that including following step Suddenly:
The script sentence that data library initialization needs or the script sentence that database upgrade needs are programmed into script text by S1 line by line In part;
The script file write is put under mobile application Resource TOC by S2;
When mobile application is installed, corresponding script sentence in script file is read according to current database version number line by line by S3, And in the chained list of preservation in memory, after script is read, program statement is performed by a cycle line by line, it will remember to interior All script sentences deposited in chained list perform line by line.
The method that 2. Android SQLite databases as described in claim 1 create or upgrade script batch performs, feature exist In:In the step S1, each complete script sentence independently occupies a line of file.
The method that 3. Android SQLite databases as described in claim 1 create or upgrade script batch performs, feature exist In:The step S2 is specially:The script file write is put under " raw " catalogue of mobile applications engineering catalogue.
The method that 4. Android SQLite databases as described in claim 1 create or upgrade script batch performs, feature exist In:In the step S3, different script sentences is put into different sub-line journeys and performed, sub-line journey is carried out by thread pool Unified management, realizes the parallel execution of script sentence.
The method that 5. Android SQLite databases as described in claim 1 create or upgrade script batch performs, feature exist In:In the step S1, during each database upgrade, the script file of increment is write, while change in current application program Database version number defines, and is consistent with database version number in increment script file.
The method that 6. Android SQLite databases as claimed in claim 5 create or upgrade script batch performs, feature exist In:In the step S3, if upgrading to database, with reference to the corresponding database version number of current application program and user's sheet The database version number on ground, the whole script files that will be differed between Liang Ge version numbers, reads simultaneously in turn according to version number's sequence It performs one time.
CN201810028670.2A 2018-01-12 2018-01-12 The method that Android SQLite databases create or upgrade script batch performs Pending CN108255544A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810028670.2A CN108255544A (en) 2018-01-12 2018-01-12 The method that Android SQLite databases create or upgrade script batch performs

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810028670.2A CN108255544A (en) 2018-01-12 2018-01-12 The method that Android SQLite databases create or upgrade script batch performs

Publications (1)

Publication Number Publication Date
CN108255544A true CN108255544A (en) 2018-07-06

Family

ID=62726591

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810028670.2A Pending CN108255544A (en) 2018-01-12 2018-01-12 The method that Android SQLite databases create or upgrade script batch performs

Country Status (1)

Country Link
CN (1) CN108255544A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111190660A (en) * 2019-12-31 2020-05-22 中国南方电网有限责任公司 Method and system for optimizing process automation based on bidirectional linked list model
CN112068881A (en) * 2020-09-21 2020-12-11 北京天地和兴科技有限公司 Database upgrading method based on data chain
CN113553197A (en) * 2021-07-21 2021-10-26 用友汽车信息科技(上海)股份有限公司 Data processing method, device and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09130426A (en) * 1995-11-06 1997-05-16 Nippon Telegr & Teleph Corp <Ntt> Information providing system
CN103324716A (en) * 2013-06-25 2013-09-25 四川九洲电器集团有限责任公司 Application database updating method based on Android system
CN106802817A (en) * 2016-12-29 2017-06-06 杭州迪普科技股份有限公司 The upgrade method and device of SQLite databases

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09130426A (en) * 1995-11-06 1997-05-16 Nippon Telegr & Teleph Corp <Ntt> Information providing system
CN103324716A (en) * 2013-06-25 2013-09-25 四川九洲电器集团有限责任公司 Application database updating method based on Android system
CN106802817A (en) * 2016-12-29 2017-06-06 杭州迪普科技股份有限公司 The upgrade method and device of SQLite databases

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
KONRAD LUKASIK: ""使用升级脚本进行数据库版本管理及发布"", 《HTTPS://WWW.INFOQ.CN/ARTICLE/DB-VERSIONING-SCRIPTS/》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111190660A (en) * 2019-12-31 2020-05-22 中国南方电网有限责任公司 Method and system for optimizing process automation based on bidirectional linked list model
CN111190660B (en) * 2019-12-31 2023-12-01 中国南方电网有限责任公司 Method and system for optimizing process automation based on doubly linked list model
CN112068881A (en) * 2020-09-21 2020-12-11 北京天地和兴科技有限公司 Database upgrading method based on data chain
CN113553197A (en) * 2021-07-21 2021-10-26 用友汽车信息科技(上海)股份有限公司 Data processing method, device and readable storage medium

Similar Documents

Publication Publication Date Title
Nyman et al. To fork or not to fork: Fork motivations in SourceForge projects
CN108255544A (en) The method that Android SQLite databases create or upgrade script batch performs
US20040098402A1 (en) System and method for common code generation
US7984115B2 (en) Extensible application platform
CN106605212A (en) Modular co-versioning in a dynamically linked runtime environment
US7721258B2 (en) Integrated development environment with managed platform registry
CN105893061A (en) Application program development method and system
CN1617097A (en) Software combination
CN107463603A (en) It is a kind of that control method and system are customized based on the scientific research project life cycle data management for quantifying DMP
CN106599167B (en) System and method for supporting increment updating of database
KR20140068966A (en) Efficiently providing multiple metadata representations of the same type
CN106055375A (en) Application program installation method and device
US10387124B2 (en) System and method for creating domain specific language
CN109213510A (en) A kind of application program updating method and storage medium for embedded device
CN109409531A (en) A kind of machine learning method, device and equipment based on serializing file
CN105955773A (en) System upgrading method and device
US20080196009A1 (en) Apparatus and method for componentizing legacy system
van der Hoeven et al. Modular emulation as a long-term preservation strategy for digital objects
KR20100021062A (en) Customized design template providing system and method
CN112036142A (en) Real-time report generation method and system based on data configuration
Tiepolo Getting started with rethinkdb
Pireddu et al. A Hadoop-Galaxy adapter for user-friendly and scalable data-intensive bioinformatics in Galaxy
CN102141912B (en) Method and device for processing multi-class engine Widget
Kramer et al. Using TheDesignExchange as a knowledge platform for human-centered design-driven global development
CN102629259A (en) Read-only file system setting up method in embedded system, device and embedded system

Legal Events

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

Application publication date: 20180706