Movatterモバイル変換


[0]ホーム

URL:


CN104679816A - Application method of SQLITE database in embedded system - Google Patents

Application method of SQLITE database in embedded system
Download PDF

Info

Publication number
CN104679816A
CN104679816ACN201410780886.6ACN201410780886ACN104679816ACN 104679816 ACN104679816 ACN 104679816ACN 201410780886 ACN201410780886 ACN 201410780886ACN 104679816 ACN104679816 ACN 104679816A
Authority
CN
China
Prior art keywords
mapping table
data
database
file
memory
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.)
Granted
Application number
CN201410780886.6A
Other languages
Chinese (zh)
Other versions
CN104679816B (en
Inventor
修铭徽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SHANGHAI CAIYI INFORMATION TECHNOLOGY CO., LTD.
Original Assignee
Sea Of Clouds Science And Technology Ltd Can Be Thought In Beijing
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 Sea Of Clouds Science And Technology Ltd Can Be Thought In BeijingfiledCriticalSea Of Clouds Science And Technology Ltd Can Be Thought In Beijing
Priority to CN201410780886.6ApriorityCriticalpatent/CN104679816B/en
Publication of CN104679816ApublicationCriticalpatent/CN104679816A/en
Application grantedgrantedCritical
Publication of CN104679816BpublicationCriticalpatent/CN104679816B/en
Expired - Fee Relatedlegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Landscapes

Abstract

The invention provides an application method of an SQLITE database in an embedded system. The method includes 1, establishing an SQLITE database; 2, accessing to the SQLITE database; 3, caching the query results. The system balance of speed and security is realized, the negative effect caused by malicious tampering is avoided, and the system integration is improved.

Description

A kind of SQLITE database application method under embedded system
Technical field
The present invention relates to computer technology, a kind of SQLITE database application method particularly under embedded system.
Background technology
As the Lightweight Database of increasing income, SQLITE has been widely used in ANDROI system, but SQLITE database itself is not with encryption, and database file can be opened with text editor and check.Therefore the security of SQLITE database can not get effective guarantee, is easily subject to malicious attack.Although also there is the method be encrypted SQLITE database in prior art, but the existing encryption method to SQLITE database often can not meet speed and security needs simultaneously.In addition, along with the progress of memory hardware technology, greatly, but prior art does not fully use storage resources to memory hardware cost.
Summary of the invention
For the above-mentioned defect of prior art, the present invention proposes a kind of SQLITE database application method under embedded system, in order to utilize the advantage of storage resources to greatest extent, in the application of SQLITE database, keep the balance between access speed and security of system.SQLITE database application method under described embedded system comprises: step 1, structure SQLITE database, comprise: step 1.1, establishment one publicly-owned database file and a private data library file in internal storage, wherein publicly-owned data are stored in total database file, and private data is stored in private data library file; Step 1.2, employing AES symmetric cryptography mode carry out entirety encryption to publicly-owned database file; Step 1.3, employing RAS asymmetric encryption mode carry out entirety encryption to private data library file; Step 2, access SQLITE database, comprising: step 2.1, when publicly-owned data inquired about by needs, perform following steps: step 2.1.1, obtain symmetric key; Step 2.1.2, according to described symmetric key decryption publicly-owned database file; If step 2.1.3 successful decryption, then using described publicly-owned database file as database file buffer memory to be visited in internal memory; Step 2.2, when needs inquiry private data time, perform following steps: step 2.2.1, obtain deciphering unsymmetrical key; Step 2.2.2, decipher described private data library file according to described unsymmetrical key; If step 2.2.3 successful decryption, then using described private data library file as database file buffer memory to be visited in internal memory; The copy of the database file described to be visited in step 2.3, data base manipulation SQL statement audit memory is to obtain Query Result.Query Result described in step 3, buffer memory, comprising: if do not store HashMap mapping table in step 3.1 internal memory, then in internal memory, create HashMap mapping table; If do not store HashMap mapping table in step 3.2 external memory storage, then in external memory storage, create HashMap mapping table; Step 3.3, to map to Query Result respectively in internal memory and external memory storage HashMap mapping table, with index entry and data item one to one in the pair wise storing queries result of key and value in described HashMap mapping table, described HashMap mapping table stores the attribute corresponding with each data item simultaneously, and described attribute comprises file ID, Table I D, major key, data item type; Step 3.4, described database file to be visited to be removed from internal memory.
Preferably, SQLITE database application method under described embedded system also comprises: step 4, when again accessing SQLITE database, performs following steps: step 4.1, in internal memory buffer memory HashMap mapping table in the data of accessing needed for fast finding; If step 4.2 is searched unsuccessful, then return step 2.
Preferably, SQLITE database application method under described embedded system also comprises: if step 5 receives the request of more new database, then perform following steps: step 5.1, according to the data upgraded needed for fast finding in the HashMap mapping table of index entry buffer memory in internal memory of the data of required renewal; Step 5.2, according to the data upgraded needed for fast finding in the HashMap mapping table of index entry buffer memory in external memory storage of the data of required renewal; If the data item that step 5.3 finds in step 5.1 with step 5.2 is identical, then performs and upgrade statement; If the data item that step 5.4 finds in step 5.1 with step 5.2 is not identical, then the nonsynchronous miscue of return data item.
Preferably, the SQLITE database application method under described embedded system also comprises: step 6, when the timestamp of symmetric key or unsymmetrical key lost efficacy, perform following steps: step 6.1, remove the HashMap mapping table of buffer memory in internal memory; The HashMap mapping table of buffer memory in step 6.2, removing external memory storage.
The present invention compared to existing technology, has the following advantages:
By setting publicly-owned database file and private data library file, adopt AES symmetric cryptography mode and RAS asymmetric encryption mode to be encrypted respectively to publicly-owned database file and private data library file simultaneously, and effectively coordinate, realize the system equalization of speed and safety.
By being mapped in internal memory and external memory storage by Query Result with HashMap mapping mode simultaneously, and carry out synchronization map, avoid malice to distort the negative effect caused.
By Query Result being mapped to HashMap mapping table and TreeMap mapping table simultaneously, and access HashMap mapping table and TreeMap mapping table respectively according to query type, improve entire system performance.
Accompanying drawing explanation
Fig. 1 is the process flow diagram according to the SQLITE database application method under the embedded system of the embodiment of the present invention.
Fig. 2 is the process flow diagram of the calculation procedure under active state.
Fig. 3 is the calculating of data set and the process flow diagram of record.
Embodiment
Detailed description to one or more embodiment of the present invention is hereafter provided together with the accompanying drawing of the diagram principle of the invention.Describe the present invention in conjunction with such embodiment, but the invention is not restricted to any embodiment.Scope of the present invention is only defined by the claims, and the present invention contain many substitute, amendment and equivalent.Set forth many details in the following description to provide thorough understanding of the present invention.These details are provided for exemplary purposes, and also can realize the present invention according to claims without some in these details or all details.
Fig. 1 shows the process flow diagram according to the SQLITE database application method under the embedded system of the embodiment of the present invention.As shown in Figure 1, the SQLITE database application method under embedded system of the present invention at least comprises: step 1, structure SQLITE database.Step 2, access SQLITE database.Query Result described in step 3, buffer memory.Wherein, described SQLITE database comprises two database files, be respectively publicly-owned database file and private data library file, respectively publicly-owned data and private data are kept at publicly-owned database and private data storehouse respectively, although such set-up mode sacrifices a little storage resources, but bring the benefit that security significantly increases thus.Wherein, if the data of accessing belong to the data of accessing first, then described data are carried out buffer memory, particularly be cached in internal memory and external memory storage simultaneously, arranged by this, not only increase the access speed of SQLITE database, and the system that is arranged so that of dual buffer memory can identify the loss of some data automatically, even whether mistake is maliciously tampered.
In embodiments of the present invention, described step 1 specifically comprises: step 1.1, establishment one publicly-owned database file and a private data library file in internal storage, wherein publicly-owned data are stored in total database file, and private data is stored in private data library file; Step 1.2, employing AES symmetric cryptography mode carry out entirety encryption to publicly-owned database file; Step 1.3, employing RAS asymmetric encryption mode carry out entirety encryption to private data library file.On the one hand, due to AES encryption mode, realize speed fast, can improve the efficiency of whole encryption system, but encryption and decryption uses same secret key, security is not enough.And RAS cipher mode, security is higher, but it is slow to realize speed.On the other hand, publicly-owned data often require that but access speed is fast not high to security requirement, and what private data was primary is security requirement.Therefore, the present invention, by arranging different cipher modes for publicly-owned database file and private data library file, makes to be balanced in speed and security the access of SQLITE database.
In embodiments of the present invention, described step 2 specifically comprises: step 2.1, when publicly-owned data inquired about by needs, performs following steps: step 2.1.1, obtains symmetric key; Step 2.1.2, according to described symmetric key decryption publicly-owned database file; If step 2.1.3 successful decryption, then using described publicly-owned database file as database file buffer memory to be visited in internal memory.Step 2.2, when needs inquiry private data time, perform following steps: step 2.2.1, obtain deciphering unsymmetrical key; Step 2.2.2, decipher described private data library file according to described unsymmetrical key; If step 2.2.3 successful decryption, then using described private data library file as database file buffer memory to be visited in internal memory.The copy of the database file described to be visited in step 2.3, data base manipulation SQL statement audit memory is to obtain Query Result.That is for the data type needing access, access different database files respectively, and adopt different decruption keys according to the cipher mode of different database files.And by database file buffer memory to be visited to internal memory, and the inquiry realizing data in internal memory makes inquiry velocity greatly improve.
In embodiments of the present invention, described step 3 specifically comprises: if do not store HashMap mapping table in step 3.1 internal memory, then in internal memory, create HashMap mapping table, that is, SQLITE database is accessed first if belonged to, then need to create HashMap mapping table in internal memory, the present invention adopts HashMap mapping table to further increase the access speed of SQLITE database in data cached mode.If do not store HashMap mapping table in step 3.2 external memory storage, then in external memory storage, create HashMap mapping table, that is make full use of system memory resources, to realize buffer memory verifying function.Step 3.3, to map to Query Result respectively in internal memory and external memory storage HashMap mapping table, with index entry and data item one to one in the pair wise storing queries result of key and value in described HashMap mapping table, described HashMap mapping table stores the attribute corresponding with each data item simultaneously, and described attribute comprises file ID, Table I D, major key, data item type.Step 3.4, described database file to be visited to be removed from internal memory.Wherein, HashMap mapping table is the container as Query Result, HashMap mapping table in the present invention is different from HashMap mapping table of the prior art, in order to usability is stronger, HashMap mapping table in the present invention not only comprises key/value pair, and comprising attribute corresponding to each data item, of the present invention this arranges the type and an attribute column based on chained list that can also replace and become the correspondence that value provides.In a word, make usability stronger by the HashMap mapping table strengthened, such as, can directly locate a certain data item place database file by HashMap mapping table, even database table.
In embodiments of the present invention, also comprising step 4, when again accessing SQLITE database, performing following steps: step 4.1, in internal memory buffer memory HashMap mapping table in the data of accessing needed for fast finding; If step 4.2 is searched unsuccessful, then return step 2.That is, when the non-SQLITE database of access first, first judge the data that whether there is desired seek in the HashMap mapping table of buffer memory in internal memory, in the present invention, term " data ", " data item " all refer to same content, are only different appellations under various circumstances.
In embodiments of the present invention, if also comprise the request that step 5 receives more new database, then following steps are performed: step 5.1, according to the data upgraded needed for fast finding in the HashMap mapping table of index entry buffer memory in internal memory of the data of required renewal; Step 5.2, according to the data upgraded needed for fast finding in the HashMap mapping table of index entry buffer memory in external memory storage of the data of required renewal; If the data item that step 5.3 finds in step 5.1 with step 5.2 is identical, then performs and upgrade statement; If the data item that step 5.4 finds in step 5.1 with step 5.2 is not identical, then the nonsynchronous miscue of return data item.Should be noted that, when normal access SQLITE database, first in internal memory buffer memory HashMap mapping table in search desired data, if find and need to revise desired data, then first to revise in internal memory corresponding data item in HashMap mapping table, and to revise in the storer of inside and outside corresponding data item in HashMap mapping table simultaneously, that is, under normal circumstances, in internal memory, in HashMap mapping table and external memory storage, HashMap mapping table keeps synchronized update.When receiving the request of more new database, then perform above step 5.1-5.4.
In embodiments of the present invention, also comprise step 6, when the timestamp of symmetric key or unsymmetrical key lost efficacy, perform following steps: step 6.1, remove the HashMap mapping table of buffer memory in internal memory; The HashMap mapping table of buffer memory in step 6.2, removing external memory storage.This setting ensure that the security of system, avoids unsafe cache access.
In embodiments of the present invention, further comprising the steps of between step 3.2 and step 3.3: if do not store TreeMap mapping table in internal memory, then in internal memory, to create TreeMap mapping table; Further comprising the steps of between step 3.3 and step 3.4: Query Result to be mapped in the TreeMap mapping table in internal memory, with index entry and data item one to one in the pair wise storing queries result of key and value in described TreeMap mapping table.Described step 4.1 specifically comprises: if search statement during the statement of access SQLITE database, then in internal memory buffer memory HashMap mapping table in the data of accessing needed for fast finding; If traversal statement during the statement of access SQLITE database, then in internal memory buffer memory TreeMap mapping table in the data of the required access of traversal according to the order of sequence.Described step 6 also comprises: the TreeMap mapping table of buffer memory in step 6.3, removing internal memory.Wherein in internal memory, in HashMap mapping table and internal memory, TreeMap mapping table keeps synchronized update.Due to the existence of above-mentioned steps, although occupy a little storage space, but what bring is the very big raising of access speed, especially access HashMap mapping table respectively for different access types and TreeMap mapping table makes the overall performance of system be improved.Wherein, because HashMap mapping table has more advantage in searching, the object therefore searching access is set as HashMap mapping table, and the advantage due to TreeMap mapping table is ranking function, and traversal access often needs orderly traversal, the object therefore traveling through access is set as TreeMap mapping table.
Be to be understood that the embedded system designed by the present invention comprises ANDROID system, IOS system etc.External memory storage designed by the present invention comprises SD card memory etc.
In sum, the SQLITE database application method under the embedded system that the present invention proposes, achieves the system equalization of speed and safety; Avoid malice and distort the negative effect caused; And improve systematic entirety.
Should be understood that, above-mentioned embodiment of the present invention only for exemplary illustration or explain principle of the present invention, and is not construed as limiting the invention.Therefore, any amendment made when without departing from the spirit and scope of the present invention, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.In addition, claims of the present invention be intended to contain fall into claims scope and border or this scope and border equivalents in whole change and modification.

Claims (4)

CN201410780886.6A2014-12-172014-12-17A kind of SQLITE database application methods under embedded systemExpired - Fee RelatedCN104679816B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201410780886.6ACN104679816B (en)2014-12-172014-12-17A kind of SQLITE database application methods under embedded system

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201410780886.6ACN104679816B (en)2014-12-172014-12-17A kind of SQLITE database application methods under embedded system

Publications (2)

Publication NumberPublication Date
CN104679816Atrue CN104679816A (en)2015-06-03
CN104679816B CN104679816B (en)2018-02-06

Family

ID=53314858

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201410780886.6AExpired - Fee RelatedCN104679816B (en)2014-12-172014-12-17A kind of SQLITE database application methods under embedded system

Country Status (1)

CountryLink
CN (1)CN104679816B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN106850192A (en)*2017-03-132017-06-13国家电网公司A kind of method for optimizing mobile device data storehouse encryption efficiency
CN107402843A (en)*2017-06-192017-11-28阿里巴巴集团控股有限公司Restoration methods, device and the equipment of database corruption
CN108268476A (en)*2016-12-302018-07-10北京国双科技有限公司Data query method and device
CN108628885A (en)*2017-03-202018-10-09腾讯科技(深圳)有限公司A kind of method of data synchronization, device and storage device
CN109857742A (en)*2019-01-182019-06-07烽火通信科技股份有限公司A kind of big data virtual tables fast display method and system
CN111159106A (en)*2019-12-302020-05-15亚信科技(中国)有限公司Data query method and device
CN112966278A (en)*2021-02-042021-06-15北京高因科技有限公司Method for Flutter to safely access SQLite in environment
CN116842084A (en)*2023-06-292023-10-03中国联合网络通信集团有限公司Data query method, device and storage medium in cloud environment

Citations (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN1635494A (en)*2003-12-272005-07-06海信集团有限公司Method for implementing class memory database access and retrieval
CN102426637A (en)*2011-11-012012-04-25北京人大金仓信息技术股份有限公司Encryption storage method for embedded database
CN102436421A (en)*2010-09-292012-05-02腾讯科技(深圳)有限公司Method for caching data
CN103309815A (en)*2013-05-232013-09-18华中科技大学Method and system for increasing available capacity and service life of solid state disc
CN103595730A (en)*2013-11-282014-02-19中国科学院信息工程研究所Ciphertext cloud storage method and system
CN103812871A (en)*2014-02-242014-05-21北京明朝万达科技有限公司Development method and system based on mobile terminal application program security application
WO2014120636A1 (en)*2013-01-292014-08-07Diamond Fortress Technologies, Inc.Touchless fingerprinting acquisition and processing application for mobile devices
CN104090793A (en)*2014-07-072014-10-08四川效率源信息安全技术有限责任公司Device and method for destroying Android mobile phone body data

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN1635494A (en)*2003-12-272005-07-06海信集团有限公司Method for implementing class memory database access and retrieval
CN102436421A (en)*2010-09-292012-05-02腾讯科技(深圳)有限公司Method for caching data
CN102426637A (en)*2011-11-012012-04-25北京人大金仓信息技术股份有限公司Encryption storage method for embedded database
WO2014120636A1 (en)*2013-01-292014-08-07Diamond Fortress Technologies, Inc.Touchless fingerprinting acquisition and processing application for mobile devices
CN103309815A (en)*2013-05-232013-09-18华中科技大学Method and system for increasing available capacity and service life of solid state disc
CN103595730A (en)*2013-11-282014-02-19中国科学院信息工程研究所Ciphertext cloud storage method and system
CN103812871A (en)*2014-02-242014-05-21北京明朝万达科技有限公司Development method and system based on mobile terminal application program security application
CN104090793A (en)*2014-07-072014-10-08四川效率源信息安全技术有限责任公司Device and method for destroying Android mobile phone body data

Cited By (11)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN108268476A (en)*2016-12-302018-07-10北京国双科技有限公司Data query method and device
CN108268476B (en)*2016-12-302021-11-30北京国双科技有限公司Data query method and device
CN106850192A (en)*2017-03-132017-06-13国家电网公司A kind of method for optimizing mobile device data storehouse encryption efficiency
CN108628885A (en)*2017-03-202018-10-09腾讯科技(深圳)有限公司A kind of method of data synchronization, device and storage device
CN108628885B (en)*2017-03-202023-04-18腾讯科技(深圳)有限公司Data synchronization method and device and storage equipment
CN107402843A (en)*2017-06-192017-11-28阿里巴巴集团控股有限公司Restoration methods, device and the equipment of database corruption
CN109857742A (en)*2019-01-182019-06-07烽火通信科技股份有限公司A kind of big data virtual tables fast display method and system
CN111159106A (en)*2019-12-302020-05-15亚信科技(中国)有限公司Data query method and device
CN111159106B (en)*2019-12-302023-04-07亚信科技(中国)有限公司Data query method and device
CN112966278A (en)*2021-02-042021-06-15北京高因科技有限公司Method for Flutter to safely access SQLite in environment
CN116842084A (en)*2023-06-292023-10-03中国联合网络通信集团有限公司Data query method, device and storage medium in cloud environment

Also Published As

Publication numberPublication date
CN104679816B (en)2018-02-06

Similar Documents

PublicationPublication DateTitle
CN104679816A (en)Application method of SQLITE database in embedded system
US9779264B2 (en)Method, server and computer program for security management in database
US10095776B2 (en)Method and system for searching encrypted data
US8516271B2 (en)Securing non-volatile memory regions
US9135454B2 (en)Systems and methods for enabling searchable encryption
CN102855448B (en)A kind of Field-level database encryption device
US9262342B2 (en)Process authenticated memory page encryption
US11494499B1 (en)Searching encrypted data stores
EP3243182B1 (en)Method and apparatus for processing transactions
US8639948B2 (en)Encrypted data management in database management systems
US20160283749A1 (en)Method for encrypting database
EP2511848A2 (en)Multiple independent encryption domains
US20160078244A1 (en)Secured file system management
EP2778953A1 (en)Encoded-search database device, method for adding and deleting data for encoded search, and addition/deletion program
US11210409B2 (en)Method for duplexing database
CN103647636A (en)Method and device for safe access to data
CN106713334B (en)Encryption method, decryption method, access method and device for virtual storage volume
CN104780048B (en)The image file encryption system and method for a kind of lightweight
CN111797425A (en) Secure database using dictionary encoding
US9218296B2 (en)Low-latency, low-overhead hybrid encryption scheme
CN106250453A (en)The cipher text retrieval method of numeric type data based on cloud storage and device
CN117971798B (en) Data isolation method, system and equipment for SaaS software multi-technology integration
US11947684B2 (en)Searching encrypted data
CN113297210B (en) Data processing method and device
US11899811B2 (en)Processing data pages under group-level encryption

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
C41Transfer of patent application or patent right or utility model
TA01Transfer of patent application right

Effective date of registration:20150917

Address after:225400, room 4, building 401, traffic district, Taixing Town, Taixing, Jiangsu

Applicant after:Ju Qiuping

Address before:100020 Beijing city Chaoyang District auspicious A Jiahui International Center No. 14 block 1506

Applicant before:Sea of clouds Science and Technology Ltd. can be thought in Beijing

CB03Change of inventor or designer information
CB03Change of inventor or designer information

Inventor after:Mao Gaofeng

Inventor before:Xiu Minghui

TA01Transfer of patent application right

Effective date of registration:20180110

Address after:Room 501, room 2, No. 391, Guiping Road, Xuhui District, Shanghai

Applicant after:SHANGHAI CAIYI INFORMATION TECHNOLOGY CO., LTD.

Address before:225400, room 4, building 401, traffic district, Taixing Town, Taixing, Jiangsu

Applicant before:Ju Qiuping

TA01Transfer of patent application right
GR01Patent grant
GR01Patent grant
CF01Termination of patent right due to non-payment of annual fee

Granted publication date:20180206

Termination date:20191217

CF01Termination of patent right due to non-payment of annual fee

[8]ページ先頭

©2009-2025 Movatter.jp