CN106021591A - Data processing method and system for terminal - Google Patents

Data processing method and system for terminal Download PDF

Info

Publication number
CN106021591A
CN106021591A CN201610395581.2A CN201610395581A CN106021591A CN 106021591 A CN106021591 A CN 106021591A CN 201610395581 A CN201610395581 A CN 201610395581A CN 106021591 A CN106021591 A CN 106021591A
Authority
CN
China
Prior art keywords
data
shared database
terminal
application
data processing
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
CN201610395581.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.)
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing 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 Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201610395581.2A priority Critical patent/CN106021591A/en
Publication of CN106021591A publication Critical patent/CN106021591A/en
Pending legal-status Critical Current

Links

Classifications

    • 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/2443Stored procedures
    • 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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof

Landscapes

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

Abstract

本发明实施例公开了一种终端的数据处理方法及系统,其中,所述终端中设置有两个以上应用;所述终端的数据处理方法包括:设置共享数据库;将所述应用的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中。由于终端中多个应用公用一个共享数据库,不同的应用将其运行数据存储于共享数据库中与运行数据对应的数据表中,从而在存储或查询多个应用的运行数据时,有效减少动态空间需求,且能够避免不同应用的进程之间发生冲突,提高了数据处理的流畅性。而且,本发明实施例可以有效减少数据表建立和查询时所需要的拼串操作,提高了数据处理的效率,降低了出错的几率。

The embodiment of the present invention discloses a terminal data processing method and system, wherein the terminal is provided with more than two applications; the terminal data processing method includes: setting a shared database; storing the running data of the application In the data table corresponding to the operation data in the shared database. Since multiple applications in the terminal share a shared database, different applications store their operating data in the data table corresponding to the operating data in the shared database, thereby effectively reducing the dynamic space requirements when storing or querying the operating data of multiple applications , and can avoid conflicts between processes of different applications, and improve the fluency of data processing. Moreover, the embodiments of the present invention can effectively reduce the string concatenation operations required for data table creation and query, improve the efficiency of data processing, and reduce the probability of errors.

Description

终端的数据处理方法及系统Terminal data processing method and system

技术领域technical field

本发明涉及互联网技术,尤其是一种终端的数据处理方法及系统。The invention relates to Internet technology, in particular to a terminal data processing method and system.

背景技术Background technique

随着科学技术的不断发展,电子技术也得到了飞速的发展,电子产品的种类也越来越多,人们也享受到了科技发展带来的各种便利。现在人们可以通过各种类型的移动终端,享受随着科技发展带来的舒适生活。例如,智能手机、平板电脑等移动终端已经成为人们生活中一个重要的组成部分,用户可以使用智能手机、平板电脑等移动终端来听音乐、玩游戏等等,以减轻现代快节奏生活所带来的压力。With the continuous development of science and technology, electronic technology has also developed rapidly, and there are more and more types of electronic products, and people have also enjoyed various conveniences brought by the development of science and technology. Now people can enjoy the comfortable life brought by the development of science and technology through various types of mobile terminals. For example, mobile terminals such as smartphones and tablet computers have become an important part of people's lives. Users can use mobile terminals such as smartphones and tablet computers to listen to music, play games, etc., to alleviate the burden of modern fast-paced life. pressure.

现有移动终端市场存在三大操作系统,Android、iOS(iPhone OperateSystem,苹果操作系统)和Windows。针对各个操作系统,软件开发者又开发出大量的应用软件,以满足不同用户的使用需求。以用户群体为儿童为例,软件开发者就开发出了大量的优质儿童应用软件,以辅助儿童进行学习,娱乐以及进行健康使用提醒等。例如,识字应用、算术应用、英语学习、益智游戏、成语故事,上网计时等相关的应用。从而使移动终端实现寓教于乐、安全使用的目的。There are three major operating systems in the existing mobile terminal market, Android, iOS (iPhone Operate System, Apple operating system) and Windows. For each operating system, software developers have developed a large number of application software to meet the needs of different users. Taking children as the user group as an example, software developers have developed a large number of high-quality children's application software to assist children in learning, entertainment, and health reminders. For example, literacy applications, arithmetic applications, English learning, puzzle games, idiom stories, online timing and other related applications. Thus, the mobile terminal can realize the purpose of entertaining and safe use.

为了能够获取移动终端中各个应用的使用情况,以了解该移动终端用户的使用行为,于各个应用中分别建立独立的数据库文件,用以存储该应用的运行数据(使用时间、使用时长、使用结果等)。然后通过对各个应用的数据库文件中存储的信息进行读取和处理,分析移动终端用户的使用行为。在对各个应用的数据库文件中存储的信息进行读取和处理时,需要进行表建立和查询等大量拼串操作,同时需要采用Provider组件进行跨进程操作,操作笨重繁琐。而且,在实现Cursor转List结构时,定义对象较多,实现繁琐、效率低,且容易出错。In order to obtain the usage status of each application in the mobile terminal and understand the usage behavior of the mobile terminal user, an independent database file is established in each application to store the application's running data (use time, use duration, use result) Wait). Then, by reading and processing the information stored in the database file of each application, the usage behavior of the mobile terminal user is analyzed. When reading and processing the information stored in the database files of various applications, a large number of string operations such as table creation and query are required. At the same time, the Provider component needs to be used for cross-process operations, which is cumbersome and cumbersome. Moreover, when implementing the Cursor to List structure, there are many defined objects, which is cumbersome, inefficient, and error-prone.

因此,如何简单、快捷的存储以及查询终端中各个应用的运行数据成为当前亟待解决的问题之一。Therefore, how to simply and quickly store and query the running data of each application in the terminal has become one of the problems to be solved urgently.

发明内容Contents of the invention

本发明实施例所要解决的一个技术问题是:提供一种终端的数据处理方法及系统,以方便、快捷的存储和查询终端中各个应用的运行数据。A technical problem to be solved by the embodiments of the present invention is to provide a terminal data processing method and system to conveniently and quickly store and query the operation data of each application in the terminal.

根据本发明实施例的一个方面,提供的一种终端的数据处理方法,所述终端中设置有两个以上应用;所述终端的数据处理方法包括:According to an aspect of an embodiment of the present invention, a data processing method of a terminal is provided, wherein more than two applications are set in the terminal; the data processing method of the terminal includes:

设置共享数据库;Set up a shared database;

将所述应用的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中。The running data of the application is stored in a data table corresponding to the running data in the shared database.

在基于上述方法的另一个实施例中,在将所述应用的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中之前,还包括:In another embodiment based on the above method, before storing the running data of the application in the data table corresponding to the running data in the shared database, the method further includes:

判断所述共享数据库中是否包括与所述运行数据对应的数据表;judging whether the shared database includes a data table corresponding to the operating data;

若是,则将所述应用的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中。If yes, storing the running data of the application in a data table corresponding to the running data in the shared database.

在基于上述方法的另一个实施例中,若所述共享数据库中不包括与所述运行数据对应的数据表,则建立与所述运行数据对应的数据表并将所建立的数据表存储于所述共享数据库中,然后将所述运行数据存储于所述共享数据库中与该运行数据对应的数据表中。In another embodiment based on the above method, if the shared database does not include a data table corresponding to the operating data, then create a data table corresponding to the operating data and store the established data table in the in the shared database, and then store the operating data in a data table corresponding to the operating data in the shared database.

在基于上述方法的另一个实施例中,通过DataBaseHelper将所述应用的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中,或者于所述共享数据库中建立与所述运行数据对应的数据表。In another embodiment based on the above method, the running data of the application is stored in the data table corresponding to the running data in the shared database through DataBaseHelper, or the running data corresponding to the running data is established in the shared database. The data table corresponding to the data.

在基于上述方法的另一个实施例中,在将所述应用的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中之前,所述终端的数据处理方法还包括:In another embodiment based on the above method, before storing the running data of the application in the data table corresponding to the running data in the shared database, the data processing method of the terminal further includes:

将所述运行数据转化成ContentValues类;Convert the operation data into ContentValues class;

将转化成ContentValues类的运行数据发送至所述共享数据库。Send the running data converted into ContentValues to the shared database.

在基于上述方法的另一个实施例中,在将所述运行数据发送至所述共享数据库时,先通过Provider组件判断所述运行数据所在应用,然后通过Binder组件将所述应用的运行数据发送至所述共享数据库。In another embodiment based on the above method, when sending the running data to the shared database, the Provider component first determines the application where the running data belongs to, and then sends the running data of the application to the The shared database.

在基于上述方法的另一个实施例中,通过AIDL技术将转化成ContentValues类的运行数据发送至所述共享数据库。In another embodiment based on the above method, the running data converted into ContentValues is sent to the shared database through AIDL technology.

在基于上述方法的另一个实施例中,所述数据表包括表名和与所述表名对应的字段;所述表名与类名对应,所述字段与类成员变量对应。In another embodiment based on the above method, the data table includes a table name and a field corresponding to the table name; the table name corresponds to a class name, and the field corresponds to a class member variable.

在基于上述方法的另一个实施例中,所述类成员变量包括通用变量和附加变量,所述通用变量包括类ID。In another embodiment based on the above method, the class member variables include general variables and additional variables, and the general variables include class IDs.

根据本发明实施例的又一个方面,提供的一种终端的数据处理系统,所述终端中设置有两个以上应用单元;所述终端的数据处理系统包括:According to still another aspect of the embodiments of the present invention, a terminal data processing system is provided, wherein more than two application units are set in the terminal; the terminal data processing system includes:

数据存储单元,用于存储共享数据库,所述共享数据库用于存储各个所述应用单元的运行数据;a data storage unit, configured to store a shared database, and the shared database is used to store the operation data of each of the application units;

数据处理单元,用于获取所述应用单元的运行数据,并将所述应用单元的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中。The data processing unit is configured to obtain the operation data of the application unit, and store the operation data of the application unit in a data table corresponding to the operation data in the shared database.

基于本发明上述实施例提供的终端的数据处理方法,对于设置有两个以上应用的终端,终端的数据处理方法包括:设置共享数据库,以及将应用的运行数据存储于共享数据库中与运行数据对应的数据表中。由于终端中多个应用公用一个共享数据库,不同的应用将其运行数据存储于共享数据库中与运行数据对应的数据表中,从在后续多个应用的运行数据同时使用时,动态空间需求少,且能够避免不同应用的进程之间发生冲突,提高了数据处理的流畅性。Based on the terminal data processing method provided by the above-mentioned embodiments of the present invention, for a terminal provided with more than two applications, the terminal data processing method includes: setting a shared database, and storing the running data of the application in the shared database to correspond to the running data in the data table. Since multiple applications in the terminal share a shared database, different applications store their operating data in the data tables corresponding to the operating data in the shared database. When the operating data of multiple subsequent applications is used at the same time, the dynamic space requirement is small. In addition, conflicts between processes of different applications can be avoided, thereby improving the fluency of data processing.

另外,与现有每个应用在存储其运行数据时,分别建立其对应的数据库相比,上述终端的数据处理方法能够有效减少数据表建立和查询时所需要的拼串操作,提高了数据处理的效率,降低了出错的几率。In addition, compared with the establishment of corresponding databases for each existing application when storing its operating data, the above-mentioned terminal data processing method can effectively reduce the stringing operations required for data table creation and query, and improve data processing. Efficiency, reducing the chance of error.

进一步的,在将应用的运行数据存储于共享数据库中与运行数据对应的数据表中之前,还可包括:判断共享数据库中是否包括与运行数据对应的数据表;若包括,则将应用的运行数据存储于共享数据库中与运行数据对应的数据表中;否则,建立与运行数据对应的数据表并将所建立的数据表存储于共享数据库中,然后将运行数据存储于共享数据库中与该运行数据对应的数据表中。从而能够根据数据处理的需要,自动创建数据表,提高了数据处理的效率,降低了出错的几率。Further, before storing the running data of the application in the data table corresponding to the running data in the shared database, it may also include: judging whether the data table corresponding to the running data is included in the shared database; The data is stored in the data table corresponding to the running data in the shared database; otherwise, create a data table corresponding to the running data and store the created data table in the shared database, and then store the running data in the shared database with the running data data corresponding to the data table. Therefore, data tables can be automatically created according to the needs of data processing, which improves the efficiency of data processing and reduces the probability of errors.

进一步的,通过DataBaseHelper将应用的运行数据存储于共享数据库中与运行数据对应的数据表中,或者于共享数据库中建立与运行数据对应的数据表。以及在将应用的运行数据存储于共享数据库中与运行数据对应的数据表中之前,先将运行数据转化成ContentValues类;再将转化成ContentValues类的运行数据发送至共享数据库。由于ContentValues类为Parcelable对象,其能够通过AIDL技术实现跨进程传递,从而可以利用DataBaseHelper对数据库进行封装数据,使数据表的建立、查询和封装等通用,无需重复冗余的去写数据库语句,以及无需关心多进程操作,提高了数据处理的效率,降低了犯错几率。Further, the running data of the application is stored in a data table corresponding to the running data in the shared database through the DataBaseHelper, or a data table corresponding to the running data is created in the shared database. And before storing the running data of the application in the data table corresponding to the running data in the shared database, first convert the running data into the ContentValues class; and then send the running data converted into the ContentValues class to the shared database. Since the ContentValues class is a Parcelable object, it can realize cross-process transfer through AIDL technology, so that DataBaseHelper can be used to encapsulate data in the database, so that the establishment, query, and encapsulation of data tables can be used universally, without the need to repeatedly write redundant database statements, and There is no need to care about multi-process operations, which improves the efficiency of data processing and reduces the chance of making mistakes.

进一步的,在将运行数据发送至共享数据库时,先通过Provider组件判断运行数据所在应用,然后通过Binder组件将应用的运行数据发送至共享数据库。相对于完全通过Provider组件进程跨进程操作,将Provider组件和Binder组件结合进行跨进程操作结构简单,方便多进程读,单进程写。Further, when sending the running data to the shared database, the Provider component is used to determine the application where the running data belongs to, and then the running data of the application is sent to the shared database through the Binder component. Compared with the cross-process operation completely through the Provider component process, the combination of the Provider component and the Binder component for cross-process operation has a simple structure, which is convenient for multi-process reading and single-process writing.

进一步的,数据表包括表名和与表名对应的字段;表名与类名对应,字段与类成员变量对应。类成员变量包括通用变量和附加变量,通用变量包括类ID。利用ORM技术将定义的类与数据表形成映射关系,使数据表的建立、查询和封装等操作通用、简化。Further, the data table includes a table name and fields corresponding to the table name; the table name corresponds to the class name, and the fields correspond to class member variables. Class member variables include common variables and additional variables, and common variables include class IDs. Use ORM technology to form a mapping relationship between defined classes and data tables, so that operations such as data table creation, query, and packaging are common and simplified.

进一步的,在将应用的运行数据存储于共享数据库中与运行数据对应的数据表中之后,终端的数据处理方法还包括:将共享数据库中各数据表转化成Bean类,从而使共享数据库中所存储数据类型统一,清晰明了,便于后续的查询和封装等。Further, after storing the operation data of the application in the data table corresponding to the operation data in the shared database, the data processing method of the terminal further includes: converting each data table in the shared database into a Bean class, so that all data tables in the shared database The storage data type is unified and clear, which is convenient for subsequent query and packaging.

进一步的,在将应用的运行数据存储于共享数据库中与运行数据对应的数据表中之后,终端的数据处理方法还包括:通过类名于共享数据库中查询与类名对应的类成员变量;或者,通过共享数据库中的数据表的字段查询与数据表的表名对应的类名。利用Java的反射机制和反射注解特性,实现对共享数据库中个数据的查询,操作简单。Further, after storing the operation data of the application in the data table corresponding to the operation data in the shared database, the data processing method of the terminal further includes: querying the class member variable corresponding to the class name in the shared database through the class name; or , query the class name corresponding to the table name of the data table through the fields of the data table in the shared database. Use Java's reflection mechanism and reflection annotation features to realize the query of data in the shared database, and the operation is simple.

进一步的,通过Adapter以视图形式显示数据表中的运行数据。方便用户对所存储的数据进行查看。Further, the running data in the data table is displayed in a view through the Adapter. It is convenient for users to view the stored data.

下面通过附图和实施例,对本发明的技术方案做进一步的详细描述。The technical solutions of the present invention will be described in further detail below with reference to the accompanying drawings and embodiments.

附图说明Description of drawings

构成说明书的一部分的附图描述了本发明的实施例,并且连同描述一起用于解释本发明的原理。The accompanying drawings, which constitute a part of this specification, illustrate embodiments of the invention and, together with the description, serve to explain principles of the invention.

参照附图,根据下面的详细描述,可以更加清楚地理解本发明,其中:The present invention can be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:

图1为本发明终端的数据处理方法一个实施例的流程图。FIG. 1 is a flowchart of an embodiment of a data processing method of a terminal according to the present invention.

图2为本发明终端的数据处理方法另一个实施例的流程图。FIG. 2 is a flow chart of another embodiment of a data processing method of a terminal according to the present invention.

图3为本发明终端的数据处理方法又一个实施例的流程图。FIG. 3 is a flow chart of another embodiment of a data processing method of a terminal according to the present invention.

图4为本发明终端的数据处理系统一个实施例的结构示意图。FIG. 4 is a schematic structural diagram of an embodiment of a data processing system of a terminal according to the present invention.

图5为本发明终端的数据处理系统另一个实施例的结构示意图。FIG. 5 is a schematic structural diagram of another embodiment of a data processing system of a terminal according to the present invention.

图6为本发明终端的数据处理系统又一个实施例的结构示意图。FIG. 6 is a schematic structural diagram of another embodiment of a data processing system of a terminal according to the present invention.

图7为本发明终端的信息显示系统再一个实施例的结构示意图。FIG. 7 is a schematic structural diagram of another embodiment of an information display system for a terminal according to the present invention.

具体实施方式detailed description

现在将参照附图来详细描述本发明的各种示例性实施例。应注意到:除非另外具体说明,否则在这些实施例中阐述的部件和步骤的相对布置、数字表达式和数值不限制本发明的范围。Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangements of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless specifically stated otherwise.

同时,应当明白,为了便于描述,附图中所示出的各个部分的尺寸并不是按照实际的比例关系绘制的。At the same time, it should be understood that, for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.

以下对至少一个示例性实施例的描述实际上仅仅是说明性的,决不作为对本发明及其应用或使用的任何限制。The following description of at least one exemplary embodiment is merely illustrative in nature and in no way taken as limiting the invention, its application or uses.

对于相关领域普通技术人员已知的技术、方法和设备可能不作详细讨论,但在适当情况下,技术、方法和设备应当被视为说明书的一部分。Techniques, methods and devices known to those of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, techniques, methods and devices should be considered part of the description.

应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步讨论。It should be noted that like numerals and letters denote like items in the following figures, therefore, once an item is defined in one figure, it does not require further discussion in subsequent figures.

现有终端为了获取其内部中各个应用的使用情况,需要在各个应用中分别建立独立的数据库文件,用以存储该应用的运行数据。然后通过对各个应用的数据库文件中存储的信息进行读取和处理,分析终端用户的使用行为。然而在对各个应用的数据库文件中运行数据进行读取和处理时,需要进行表建立和查询等大量拼串操作;另外,现有终端采用Provider组件进行跨进程操作,操作笨重繁琐,效率低、易出错。In order to obtain the usage status of each application in the existing terminal, an independent database file needs to be established in each application to store the operation data of the application. Then, by reading and processing the information stored in the database file of each application, the usage behavior of the end user is analyzed. However, when reading and processing the running data in the database files of various applications, a large number of operations such as table creation and query are required; in addition, the existing terminal uses the Provider component to perform cross-process operations, which is cumbersome and cumbersome, and the efficiency is low. Error prone.

图1为本发明终端的数据处理方法一个实施例的流程图。本实施例中,终端中设置有两个以上应用。如图1所示,该实施例的终端的数据处理方法包括:FIG. 1 is a flowchart of an embodiment of a data processing method of a terminal according to the present invention. In this embodiment, more than two applications are set in the terminal. As shown in FIG. 1, the data processing method of the terminal in this embodiment includes:

S102,设置共享数据库;S102, setting a shared database;

S104,将应用的运行数据存储于共享数据库中与运行数据对应的数据表中。S104. Store the running data of the application in a data table corresponding to the running data in the shared database.

本实施例中,终端的操作系统可为安卓操作系统。终端中应用可为微信、qq、阅读软件、识字应用、算术应用、英语学习、益智游戏、成语故事等等,本实施例对应用的类型并不限制。应用的运行数据可为使用时间、使用时长、使用结果等。In this embodiment, the operating system of the terminal may be an Android operating system. The applications in the terminal can be WeChat, QQ, reading software, literacy applications, arithmetic applications, English learning, puzzle games, idiom stories, etc. This embodiment does not limit the types of applications. The running data of the application may be usage time, usage duration, usage result, etc.

本实施例中,对于设置有两个以上应用的终端,其数据处理方法包括:设置共享数据库,以及将应用的运行数据存储于共享数据库中与运行数据对应的数据表中。由于终端中多个应用公用一个共享数据库,不同的应用将其运行数据存储于共享数据库中与运行数据对应的数据表中,从而在存储或查询多个应用的运行数据时,有效减少动态空间需求,且能够避免不同应用的进程之间发生冲突,提高了数据处理的流畅性。In this embodiment, for a terminal provided with more than two applications, the data processing method includes: setting a shared database, and storing the running data of the applications in a data table corresponding to the running data in the shared database. Since multiple applications in the terminal share a shared database, different applications store their operating data in the data tables corresponding to the operating data in the shared database, thereby effectively reducing the dynamic space requirements when storing or querying the operating data of multiple applications , and can avoid conflicts between processes of different applications, and improve the fluency of data processing.

而且,与现有在每个应用中分别设置数据库,以存储其运行数据相比,上述终端的数据处理方法能够有效减少数据表建立和查询时所需要的拼串操作,提高了数据处理的效率,降低了出错的几率。Moreover, compared with existing databases that are separately set up in each application to store its operating data, the data processing method of the above-mentioned terminal can effectively reduce the stringing operations required for data table creation and query, and improve the efficiency of data processing , reducing the chance of error.

图2为本发明终端的数据处理方法另一个实施例的流程图。本实施例中,终端中设置有两个以上应用。如图2所示,该实施例的终端的数据处理方法包括:FIG. 2 is a flow chart of another embodiment of a data processing method of a terminal according to the present invention. In this embodiment, more than two applications are set in the terminal. As shown in Figure 2, the data processing method of the terminal in this embodiment includes:

S202,设置共享数据库。S202, setting a shared database.

S204,判断共享数据库中是否包括与运行数据对应的数据表。S204, judging whether the shared database includes a data table corresponding to the running data.

在S204中,若共享数据库中包括与运行数据对应的数据表,则执行S208。In S204, if the shared database includes a data table corresponding to the running data, execute S208.

S208,将应用的运行数据存储于共享数据库中与运行数据对应的数据表中。S208, storing the running data of the application in a data table corresponding to the running data in the shared database.

在S204中,若共享数据库中不包括与运行数据对应的数据表,则执行S206。In S204, if the shared database does not include a data table corresponding to the running data, execute S206.

S206,建立与运行数据对应的数据表并将所建立的数据表存储于共享数据库中,然后执行S208。S206. Establish a data table corresponding to the running data and store the established data table in the shared database, and then perform S208.

本实施例中,在将应用的运行数据存储于共享数据库中与运行数据对应的数据表中之前,先判断共享数据库中是否包括与运行数据对应的数据表,若包括,则将应用的运行数据存储于共享数据库中与运行数据对应的数据表中,否则,建立与运行数据对应的数据表并将所建立的数据表存储于共享数据库中,然后将运行数据存储于共享数据库中与该运行数据对应的数据表中。从而能够根据数据处理的需要,自动创建数据表,提高了数据处理的效率,降低了出错的几率。In this embodiment, before storing the running data of the application in the data table corresponding to the running data in the shared database, it is first judged whether the data table corresponding to the running data is included in the shared database, and if so, the running data of the application is Store in the data table corresponding to the running data in the shared database, otherwise, create a data table corresponding to the running data and store the created data table in the shared database, and then store the running data in the shared database with the running data corresponding data sheet. Therefore, data tables can be automatically created according to the needs of data processing, which improves the efficiency of data processing and reduces the probability of errors.

图3为本发明终端的数据处理方法又一个实施例的流程图。本实施例中,终端中设置有两个以上应用。如图3所示,该实施例的终端的数据处理方法包括:FIG. 3 is a flow chart of another embodiment of a data processing method of a terminal according to the present invention. In this embodiment, more than two applications are set in the terminal. As shown in FIG. 3, the data processing method of the terminal in this embodiment includes:

S302,设置共享数据库。S302, setting a shared database.

S304,判断共享数据库中是否包括与运行数据对应的数据表。S304, judging whether the shared database includes a data table corresponding to the running data.

在S304中,若共享数据库中包括与运行数据对应的数据表,则执行S308。In S304, if the shared database includes a data table corresponding to the running data, execute S308.

S308,将运行数据转化成ContentValues类。S308, converting the running data into a ContentValues class.

ContentValues类是一种存储的机制,ContentValues类只能存储基本类型的数据,像string、int之类的,不能存储对象。ContentValues类为Parcelable对象,能够通过AIDL技术实现跨进程传递。The ContentValues class is a storage mechanism. The ContentValues class can only store basic types of data, such as string and int, and cannot store objects. The ContentValues class is a Parcelable object, which can be passed across processes through AIDL technology.

安卓操作系统中,为使应用之间能够彼此通信,提供了IPC(InterProcess Communication,进程间通信)的一种独特实现,即AIDL(AndroidInterface Definition Language,Android接口定义语言)。AIDL是IPC的一个轻量级实现,AIDL默认支持的类型包括Java基本类型(int、long、boolean等)和(String、List、Map、CharSequence),AIDL是一种接口定义语言,用于约束两个进程间的通讯规则,供编译器生成代码,实现安卓操作系统终端上的两个进程间通信(IPC)。In the Android operating system, in order to enable applications to communicate with each other, a unique implementation of IPC (InterProcess Communication, inter-process communication), namely AIDL (Android Interface Definition Language, Android Interface Definition Language), is provided. AIDL is a lightweight implementation of IPC. The types supported by AIDL by default include Java basic types (int, long, boolean, etc.) and (String, List, Map, CharSequence). AIDL is an interface definition language used to constrain two An inter-process communication rule for the compiler to generate code to implement two inter-process communication (IPC) on the Android operating system terminal.

S310,将转化成ContentValues类的运行数据发送至共享数据库。S310, sending the operation data converted into the ContentValues class to the shared database.

S312,将应用的运行数据存储于共享数据库中与运行数据对应的数据表中。S312. Store the running data of the application in a data table corresponding to the running data in the shared database.

在S304中,若共享数据库中不包括与运行数据对应的数据表,则执行S306。In S304, if the shared database does not include a data table corresponding to the running data, execute S306.

S306,建立与运行数据对应的数据表并将所建立的数据表存储于共享数据库中;然后,依次执行S308、S310和S312。S306. Establish a data table corresponding to the running data and store the established data table in the shared database; then, execute S308, S310 and S312 in sequence.

本实施例中,通过DataBaseHelper将应用的运行数据存储于共享数据库中与运行数据对应的数据表中,或者于共享数据库中建立与运行数据对应的数据表。In this embodiment, the running data of the application is stored in a data table corresponding to the running data in the shared database through the DataBaseHelper, or a data table corresponding to the running data is created in the shared database.

具体的,DataBaseHelper为一种数据库访问帮助类,其能够用来管理数据库的建立和更新。Specifically, DataBaseHelper is a database access helper class, which can be used to manage the establishment and update of the database.

本实施例中,通过AIDL技术将转化成ContentValues类的运行数据发送至共享数据库。In this embodiment, the operation data converted into ContentValues is sent to the shared database through AIDL technology.

本实施例中,通过DataBaseHelper将应用的运行数据存储于共享数据库中与运行数据对应的数据表中,或者于共享数据库中建立与运行数据对应的数据表。以及在将应用的运行数据存储于共享数据库中与运行数据对应的数据表中之前,先将运行数据转化成ContentValues类;再将转化成ContentValues类的运行数据发送至共享数据库。由于ContentValues类为Parcelable对象,其能够通过AIDL技术实现跨进程传递,从而可以利用DataBaseHelper对数据库进行封装数据,使数据表的建立、查询和封装等通用,无需重复冗余的去写数据库语句,也无需关心多进程操作,提高了数据处理的效率,降低了犯错几率。In this embodiment, the running data of the application is stored in a data table corresponding to the running data in the shared database through the DataBaseHelper, or a data table corresponding to the running data is created in the shared database. And before storing the running data of the application in the data table corresponding to the running data in the shared database, first convert the running data into the ContentValues class; and then send the running data converted into the ContentValues class to the shared database. Since the ContentValues class is a Parcelable object, it can be passed across processes through AIDL technology, so that DataBaseHelper can be used to encapsulate data in the database, so that the establishment, query, and encapsulation of data tables can be used in general, without the need to repeatedly write database statements redundantly, and also There is no need to care about multi-process operations, which improves the efficiency of data processing and reduces the chance of making mistakes.

在另一个实施例中,在将运行数据发送至共享数据库时,先通过Provider组件判断运行数据所在应用,然后通过Binder组件将应用的运行数据发送至共享数据库。In another embodiment, when the running data is sent to the shared database, the Provider component is used to determine the application where the running data belongs to, and then the running data of the application is sent to the shared database through the Binder component.

Provider组件是安卓操作系统中的四大组件之一,主要用于对外共享数据,也就是通过Provider组件把应用中的数据共享给其他应用访问,其他应用可以通过Provider组件对指定应用中的数据进行操作。Binder组件其实也不是安卓操作系统提出来的一套新的进程间通信机制,它是基于OpenBinder来实现的。Binder组件是一种进程间通信机制,其实是提供远程过程调用(RPC)功能。Binder组件能够用于IPC通信过程。安卓操作系统进程间通信Binder机制在应用程序框架层的Java接口实现。The Provider component is one of the four major components in the Android operating system. It is mainly used to share data externally, that is, through the Provider component, the data in the application is shared with other applications for access. Other applications can use the Provider component to specify the data in the application. operate. The Binder component is actually not a new set of inter-process communication mechanisms proposed by the Android operating system. It is implemented based on OpenBinder. The Binder component is an inter-process communication mechanism that actually provides remote procedure call (RPC) functionality. The Binder component can be used in the IPC communication process. The Android operating system inter-process communication Binder mechanism is implemented in the Java interface of the application framework layer.

本实施例中,在将运行数据发送至共享数据库时,先通过Provider组件判断运行数据所在应用,然后通过Binder组件将应用的运行数据发送至共享数据库。相对于完全通过Provider组件进程跨进程操作,将Provider组件和Binder组件结合进行跨进程操作结构简单,方便多进程读,单进程写。In this embodiment, when the running data is sent to the shared database, the Provider component is used to determine the application where the running data belongs to, and then the running data of the application is sent to the shared database through the Binder component. Compared with the cross-process operation completely through the Provider component process, the combination of the Provider component and the Binder component for cross-process operation has a simple structure, which is convenient for multi-process reading and single-process writing.

在又一个实施例中,数据表包括表名和与表名对应的字段;表名与类名对应,字段与类成员变量对应。类成员变量包括通用变量和附加变量,通用变量包括类ID以及其他常用需要监控的用户使用应用时的运行数据。类ID与终端中是唯一的。In yet another embodiment, the data table includes a table name and fields corresponding to the table name; the table name corresponds to the class name, and the fields correspond to class member variables. Class member variables include general variables and additional variables, and general variables include class IDs and other common running data that need to be monitored when users use the application. Class IDs are unique within a terminal.

本实施例中,数据表包括表名和与表名对应的字段;表名与类名对应,字段与类成员变量对应。类成员变量包括通用变量和附加变量,通用变量包括类ID。利用ORM(Object Relational Mapping,对象关系映射)技术将定义的类与数据表形成映射关系,使数据表的建立、查询和封装等操作通用、简化。In this embodiment, the data table includes a table name and fields corresponding to the table name; the table name corresponds to the class name, and the fields correspond to class member variables. Class member variables include common variables and additional variables, and common variables include class IDs. Using ORM (Object Relational Mapping, Object Relational Mapping) technology to form a mapping relationship between the defined class and the data table, so that the establishment, query and packaging of the data table are common and simplified.

在又一个实施例中,在将应用的运行数据存储于共享数据库中与运行数据对应的数据表中之后,终端的数据处理方法还包括:将共享数据库中各数据表转化成Bean类,从而使共享数据库中所存储数据类型统一,清晰明了,便于后续的查询和封装等。In yet another embodiment, after storing the running data of the application in the data table corresponding to the running data in the shared database, the data processing method of the terminal further includes: converting each data table in the shared database into a Bean class, so that The types of data stored in the shared database are unified and clear, which is convenient for subsequent query and packaging.

在又一个实施例中,在将应用的运行数据存储于共享数据库中与运行数据对应的数据表中之后,终端的数据处理方法还包括:通过类名于共享数据库中查询与类名对应的类成员变量;或者,通过共享数据库中的数据表的字段查询与数据表的表名对应的类名。从而利用Java的反射机制和反射注解特性,实现对共享数据库中个运行数据的查询,操作简单。In yet another embodiment, after storing the running data of the application in the data table corresponding to the running data in the shared database, the data processing method of the terminal further includes: querying the shared database for the class corresponding to the class name through the class name member variable; or, query the class name corresponding to the table name of the data table through the field of the data table in the shared database. In this way, Java's reflection mechanism and reflection annotation feature are used to realize the query of running data in the shared database, and the operation is simple.

在再一个实施例中,通过Adapter(适配器)以视图形式显示数据表中的运行数据,从而方便用户对共享数据库中所存储的数据进行查看。In yet another embodiment, the running data in the data table is displayed in a view form through an Adapter (adapter), so that it is convenient for users to view the data stored in the shared database.

本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps for realizing the above-mentioned method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the It includes the steps of the above method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other various media that can store program codes.

图4为本发明终端的数据处理系统一个实施例的结构示意图。本实施例中,终端中设置有两个以上应用单元。如图4所示,本实施例中终端的数据处理系统包括:FIG. 4 is a schematic structural diagram of an embodiment of a data processing system of a terminal according to the present invention. In this embodiment, more than two application units are set in the terminal. As shown in Figure 4, the data processing system of the terminal in this embodiment includes:

数据存储单元10,用于存储共享数据库,共享数据库用于存储各个应用单元的运行数据;The data storage unit 10 is used to store a shared database, and the shared database is used to store the operation data of each application unit;

数据处理单元20,用于获取应用单元的运行数据,并将应用单元的运行数据存储于共享数据库中与运行数据对应的数据表中。The data processing unit 20 is configured to obtain the operation data of the application unit, and store the operation data of the application unit in a data table corresponding to the operation data in the shared database.

本实施例中,终端的操作系统可为安卓操作系统。终端中应用单元可为微信、qq、阅读软件、识字应用、算术应用、英语学习、益智游戏、成语故事等应用软件的实现单元,本实施例对应用单元的类型并不限制。应用单元的运行数据可为使用时间、使用时长、使用结果等。In this embodiment, the operating system of the terminal may be an Android operating system. The application unit in the terminal can be the implementation unit of application software such as WeChat, QQ, reading software, literacy application, arithmetic application, English learning, puzzle game, idiom story, etc. This embodiment does not limit the type of application unit. The operating data of the application unit may be the usage time, usage duration, usage result, etc.

需要说明的是,本实施例中,终端的数据处理系统可以集成于终端内部,也可以与终端分别设置,在此不作限制。It should be noted that, in this embodiment, the data processing system of the terminal may be integrated inside the terminal, or may be set separately from the terminal, which is not limited here.

优选的,终端的数据处理系统集成于终端内部。Preferably, the data processing system of the terminal is integrated inside the terminal.

本实施例中,对于设置有两个以上应用单元的终端,其数据处理系统包括数据存储单元10和数据处理单元20;通过数据存储单元10存储各个应用单元的运行数据的共享数据库;通过数据处理单元20获取应用单元的运行数据,并将应用单元的运行数据存储于共享数据库中与运行数据对应的数据表中。从而在存储或查询多个应用单元的运行数据时,有效减少动态空间需求,且能够避免不同应用单元的进程之间发生冲突,提高了数据处理的流畅性。In this embodiment, for a terminal provided with more than two application units, its data processing system includes a data storage unit 10 and a data processing unit 20; a shared database storing the operating data of each application unit through the data storage unit 10; The unit 20 acquires the running data of the application unit, and stores the running data of the application unit in a data table corresponding to the running data in the shared database. Therefore, when storing or querying the running data of multiple application units, the dynamic space requirement can be effectively reduced, conflicts between processes of different application units can be avoided, and the fluency of data processing can be improved.

而且,与现有于每个应用单元中分别设置数据库,以存储其运行数据相比,上述终端的数据处理系统能够在数据表建立和查询时,有效减少所需要的拼串操作,提高了数据处理的效率,降低了出错的几率。Moreover, compared with the existing databases that are separately set up in each application unit to store their operating data, the data processing system of the above-mentioned terminal can effectively reduce the required stringing operations when creating and querying data tables, and improve data processing efficiency. The efficiency of processing reduces the probability of error.

图5为本发明终端的数据处理系统另一个实施例的结构示意图。与图4相比,图5中数据处理系统的数据处理单元20进一步包括:FIG. 5 is a schematic structural diagram of another embodiment of a data processing system of a terminal according to the present invention. Compared with Fig. 4, the data processing unit 20 of the data processing system in Fig. 5 further includes:

数据获取单元202,用于获取应用单元的运行数据;A data acquisition unit 202, configured to acquire the operation data of the application unit;

数据表查询单元204,用于判断共享数据库中是否包括与运行数据对应的数据表;A data table query unit 204, configured to determine whether the shared database includes a data table corresponding to the running data;

数据表建立单元206,用于在共享数据库中不包括与运行数据对应的数据表时,建立与运行数据对应的数据表,并将所建立的数据表存储于共享数据库中;A data table establishment unit 206, configured to establish a data table corresponding to the operating data when the shared database does not include a data table corresponding to the operating data, and store the established data table in the shared database;

数据表更新单元208,用于在共享数据库中包括与运行数据对应的数据表时,将应用单元的运行数据存储于共享数据库中与运行数据对应的数据表中。The data table update unit 208 is configured to store the operation data of the application unit in the data table corresponding to the operation data in the shared database when the shared database includes a data table corresponding to the operation data.

本实施例中,数据处理单元20中数据获取单元202在获取应用单元的运行数据之后,先通过数据表查询单元204判断共享数据库中是否包括与运行数据对应的数据表;若包括,则通过数据表更新单元208将应用单元的运行数据存储于共享数据库中与运行数据对应的数据表中;否则,先通过数据表建立单元206建立与运行数据对应的数据表并将所建立的数据表存储于共享数据库中,然后通过数据表更新单元208将运行数据存储于共享数据库中与该运行数据对应的数据表中。从而能够根据数据处理的需要,自动创建数据表,提高了数据处理的效率,降低了出错的几率。In this embodiment, after the data acquisition unit 202 in the data processing unit 20 acquires the operating data of the application unit, it first judges whether the shared database includes a data table corresponding to the operating data through the data table query unit 204; The table update unit 208 stores the operation data of the application unit in the data table corresponding to the operation data in the shared database; otherwise, the data table establishment unit 206 first establishes a data table corresponding to the operation data and stores the established data table in In the shared database, the operating data is then stored in a data table corresponding to the operating data in the shared database through the data table updating unit 208 . Therefore, data tables can be automatically created according to the needs of data processing, which improves the efficiency of data processing and reduces the probability of errors.

在另一个实施例中,应用单元(图未示)还进一步包括:In another embodiment, the application unit (not shown) further includes:

第一数据转化单元(图未示),用于将运行数据转化成ContentValues类;The first data conversion unit (not shown in the figure) is used to convert the operation data into the ContentValues class;

数据发送单元(图未示),用于将转化成ContentValues类的运行数据发送至数据处理单元。The data sending unit (not shown in the figure) is used to send the operation data converted into ContentValues to the data processing unit.

具体的,ContentValues类是一种存储的机制,ContentValues类只能存储基本类型的数据,像string、int之类的,不能存储对象。ContentValues类为Parcelable对象,能够通过AIDL技术实现跨进程传递。Specifically, the ContentValues class is a storage mechanism. The ContentValues class can only store basic types of data, such as string and int, and cannot store objects. The ContentValues class is a Parcelable object, which can be passed across processes through AIDL technology.

安卓操作系统中,为使应用之间能够彼此通信,提供了IPC的一种独特实现,即AIDL。AIDL是IPC的一个轻量级实现,AIDL默认支持的类型包括Java基本类型(int、long、boolean等)和(String、List、Map、CharSequence),AIDL是一种接口定义语言,用于约束两个进程间的通讯规则,供编译器生成代码,实现安卓操作系统设备上的两个进程间通信。In the Android operating system, in order to enable applications to communicate with each other, a unique implementation of IPC, namely AIDL, is provided. AIDL is a lightweight implementation of IPC. The types supported by AIDL by default include Java basic types (int, long, boolean, etc.) and (String, List, Map, CharSequence). AIDL is an interface definition language used to constrain two The communication rule between two processes is used for the compiler to generate code to realize the communication between two processes on the Android operating system device.

本实施例中,通过AIDL技术将转化成ContentValues类的运行数据发送至共享数据库。In this embodiment, the operation data converted into ContentValues is sent to the shared database through AIDL technology.

本实施例中,数据表更新单元208通过DataBaseHelper将应用单元的运行数据存储于共享数据库中与运行数据对应的数据表中,或者于共享数据库中建立与运行数据对应的数据表。In this embodiment, the data table update unit 208 stores the operation data of the application unit in the data table corresponding to the operation data in the shared database through the DataBaseHelper, or creates a data table corresponding to the operation data in the shared database.

具体的,DataBaseHelper为一种数据库访问帮助类,其能够用来管理数据库的建立和更新。Specifically, DataBaseHelper is a database access helper class, which can be used to manage the establishment and update of the database.

本实施例中,在数据表更新单元208将应用单元的运行数据存储于共享数据库中与运行数据对应的数据表中之前,先通过应用单元中第一数据转化单元将运行数据转化成ContentValues类;再通过数据发送单元将转化成ContentValues类的运行数据发送至共享数据库。由于ContentValues类为Parcelable对象,其能够通过AIDL技术实现跨进程传递,从而可以利用DataBaseHelper对数据库进行封装数据,使数据表的建立、查询和封装等通用,无需重复冗余的去写数据库语句,以及无需关心多进程操作,提高数据处理的效率,降低犯错几率。In this embodiment, before the data table update unit 208 stores the operation data of the application unit in the data table corresponding to the operation data in the shared database, the operation data is first converted into the ContentValues class by the first data conversion unit in the application unit; Then, the operation data converted into ContentValues is sent to the shared database through the data sending unit. Since the ContentValues class is a Parcelable object, it can realize cross-process transfer through AIDL technology, so that DataBaseHelper can be used to encapsulate data in the database, so that the establishment, query, and encapsulation of data tables can be used universally, without the need to repeatedly write redundant database statements, and No need to care about multi-process operations, improve the efficiency of data processing, and reduce the chance of making mistakes.

在另一个实施例中,在数据发送单元将运行数据发送至共享数据库时,先通过Provider组件判断运行数据所在应用单元,然后通过Binder组件将应用单元的运行数据发送至共享数据库。In another embodiment, when the data sending unit sends the running data to the shared database, the Provider component first determines the application unit where the running data is located, and then sends the running data of the application unit to the shared database through the Binder component.

Provider是安卓操作系统中的四大组件之一,主要用于对外共享数据,也就是通过Provider把应用中的数据共享给其他应用访问,其他应用可以通过Provider对指定应用中的数据进行操作。Binder是一种进程间通信机制,其实是提供远程过程调用功能。Binder组件能够用于IPC通信过程。安卓操作系统进程间通信Binder机制在应用程序框架层的Java接口实现。Provider is one of the four major components in the Android operating system. It is mainly used to share data externally, that is, the data in the application is shared with other applications through the Provider, and other applications can operate on the data in the specified application through the Provider. Binder is an inter-process communication mechanism that actually provides remote procedure call functionality. The Binder component can be used in the IPC communication process. The Android operating system inter-process communication Binder mechanism is implemented in the Java interface of the application framework layer.

本实施例中,在通过数据发送单元将运行数据发送至共享数据库时,先通过Provider组件判断运行数据所在应用单元,然后通过Binder组件将应用单元的运行数据发送至共享数据库。相对于完全通过Provider组件进程跨进程操作,将Provider组件和Binder组件结合进行跨进程操作结构简单,方便多进程读,单进程写。In this embodiment, when the running data is sent to the shared database through the data sending unit, the Provider component is used to determine the application unit where the running data is located, and then the running data of the application unit is sent to the shared database through the Binder component. Compared with the cross-process operation completely through the Provider component process, the combination of the Provider component and the Binder component for cross-process operation has a simple structure, which is convenient for multi-process reading and single-process writing.

在另一个实施例中,数据表包括表名和与表名对应的字段;表名与类名对应,字段与类成员变量对应。类成员变量包括通用变量和附加变量,通用变量包括类ID以及其他常用需要监控的用户使用应用时的运行数据。类ID与终端中是唯一的。In another embodiment, the data table includes a table name and fields corresponding to the table name; the table name corresponds to the class name, and the fields correspond to class member variables. Class member variables include general variables and additional variables, and general variables include class IDs and other common running data that need to be monitored when users use the application. Class IDs are unique within a terminal.

本实施例中终端的数据处理系统能够利用ORM技术将定义的类与数据表形成映射关系,使数据表的建立、查询和封装等操作通用、简化。The data processing system of the terminal in this embodiment can use the ORM technology to form a mapping relationship between defined classes and data tables, so that operations such as establishment, query, and encapsulation of data tables are common and simplified.

在另一个实施例中,数据处理单元20还包括:第二数据转化单元(图未示),用于将共享数据库中各数据表转化成Bean类。In another embodiment, the data processing unit 20 further includes: a second data conversion unit (not shown in the figure), configured to convert each data table in the shared database into a Bean class.

本实施例中终端的数据处理系统,通过第二数据转化单元将共享数据库中各数据表转化成Bean类,从而使共享数据库中所存储数据类型统一,清晰明了,便于后续的查询和封装等。The data processing system of the terminal in this embodiment converts each data table in the shared database into Bean classes through the second data conversion unit, so that the data types stored in the shared database are unified, clear, and convenient for subsequent query and packaging.

图6为本发明终端的数据处理系统又一个实施例的结构示意图。参考图6,本实施中终端的数据处理系统包括:数据存储单元10、数据处理单元20、第一数据查询单元30和数据显示单元40。FIG. 6 is a schematic structural diagram of another embodiment of a data processing system of a terminal according to the present invention. Referring to FIG. 6 , the data processing system of the terminal in this implementation includes: a data storage unit 10 , a data processing unit 20 , a first data query unit 30 and a data display unit 40 .

其中,数据处理单元20的内部结构划分及功能可参考图5中数据处理单元20,在此不作详述。Wherein, the internal structure division and functions of the data processing unit 20 can refer to the data processing unit 20 in FIG. 5 , and will not be described in detail here.

第一数据查询单元30用于通过类名于共享数据库中查询与类名对应的类成员变量;数据显示单元40用于通过Adapter以视图形式显示数据表中的运行数据。The first data query unit 30 is used to query the class member variables corresponding to the class name in the shared database through the class name; the data display unit 40 is used to display the running data in the data table in the form of a view through the Adapter.

本实施例中终端的数据处理系统能够利用Java的反射机制和反射注解特性,通过第一数据查询单元30在获知类名时于共享数据库中查询与类名对应的类成员变量,实现对共享数据库中各个运行数据的查询,操作简单;以及通过数据显示单元40将所获取的运行数据直观的显示给用户,方便用户对共享数据库中所存储的数据进行查看。In this embodiment, the data processing system of the terminal can utilize the reflection mechanism and the reflection annotation feature of Java to query the class member variable corresponding to the class name in the shared database through the first data query unit 30 when the class name is known, so as to realize the query of the shared database. The query of each operating data in the shared database is easy to operate; and the obtained operating data is intuitively displayed to the user through the data display unit 40, which is convenient for the user to view the data stored in the shared database.

图7为本发明终端的信息显示系统再一个实施例的结构示意图。参考图7,本实施中终端的数据处理系统包括:数据存储单元10、数据处理单元20、第二数据查询单元50和数据显示单元40。其中,FIG. 7 is a schematic structural diagram of another embodiment of an information display system for a terminal according to the present invention. Referring to FIG. 7 , the data processing system of the terminal in this implementation includes: a data storage unit 10 , a data processing unit 20 , a second data query unit 50 and a data display unit 40 . in,

数据处理单元20的内部结构划分及功能可参考图5中数据处理单元20,在此不作详述。The internal structure division and functions of the data processing unit 20 can refer to the data processing unit 20 in FIG. 5 , and will not be described in detail here.

第二数据查询单元50用于通过共享数据库中的数据表的字段查询与数据表的表名对应的类名;The second data query unit 50 is used to query the class name corresponding to the table name of the data table through the field query of the data table in the shared database;

数据显示单元40用于通过Adapter以视图形式显示数据表中的运行数据。The data display unit 40 is used to display the operating data in the data table in a view form through the Adapter.

本实施例中终端的数据处理系统能够利用Java的反射机制和反射注解特性,通过第二数据查询单元50在获知共享数据库中的数据表的字段时,于共享数据库中查询与数据表的表名对应的类名,实现对共享数据库中各个运行数据的查询,操作简单;以及通过数据显示单元40将所获取的运行数据直观的显示给用户,方便用户对共享数据库中所存储的数据进行查看。In this embodiment, the data processing system of the terminal can use the reflection mechanism and the reflection annotation feature of Java, and when the field of the data table in the shared database is known through the second data query unit 50, it can query the table name of the data table in the shared database The corresponding class name realizes the query of each operating data in the shared database, and the operation is simple; and the obtained operating data is intuitively displayed to the user through the data display unit 40, which is convenient for the user to view the data stored in the shared database.

本发明实施例提供了以下技术方案:Embodiments of the present invention provide the following technical solutions:

1、一种终端的数据处理方法,所述终端中设置有两个以上应用;所述终端的数据处理方法包括:1. A data processing method for a terminal, wherein more than two applications are set in the terminal; the data processing method for the terminal includes:

设置共享数据库;Set up a shared database;

将所述应用的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中。The running data of the application is stored in a data table corresponding to the running data in the shared database.

2、根据1所述的终端的数据处理方法,在将所述应用的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中之前,还包括:2. The terminal data processing method according to 1, before storing the running data of the application in the data table corresponding to the running data in the shared database, further comprising:

判断所述共享数据库中是否包括与所述运行数据对应的数据表;judging whether the shared database includes a data table corresponding to the operating data;

若是,则将所述应用的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中。If yes, storing the running data of the application in a data table corresponding to the running data in the shared database.

3、根据2所述的终端的数据处理方法,若所述共享数据库中不包括与所述运行数据对应的数据表,则建立与所述运行数据对应的数据表并将所建立的数据表存储于所述共享数据库中,然后将所述运行数据存储于所述共享数据库中与该运行数据对应的数据表中。3. According to the terminal data processing method described in 2, if the shared database does not include a data table corresponding to the operating data, then establish a data table corresponding to the operating data and store the established data table In the shared database, the operation data is then stored in a data table corresponding to the operation data in the shared database.

4、根据3所述的终端的数据处理方法,通过DataBaseHelper将所述应用的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中,或者于所述共享数据库中建立与所述运行数据对应的数据表。4. According to the data processing method of the terminal described in 3, the operation data of the application is stored in the data table corresponding to the operation data in the shared database through DataBaseHelper, or a data table corresponding to the operation data is established in the shared database. The data table corresponding to the above operating data.

5、根据4所述的终端的数据处理方法,在将所述应用的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中之前,所述终端的数据处理方法还包括:5. According to the data processing method of the terminal described in 4, before storing the operation data of the application in the data table corresponding to the operation data in the shared database, the data processing method of the terminal further includes:

将所述运行数据转化成ContentValues类;Convert the operation data into ContentValues class;

将转化成ContentValues类的运行数据发送至所述共享数据库。Send the running data converted into ContentValues to the shared database.

6、根据5所述的终端的数据处理方法,在将所述运行数据发送至所述共享数据库时,先通过Provider组件判断所述运行数据所在应用,然后通过Binder组件将所述应用的运行数据发送至所述共享数据库。6. According to the terminal data processing method described in 5, when sending the operating data to the shared database, the Provider component is used to determine the application where the operating data belongs to, and then the operating data of the application is sent to the application through the Binder component. sent to the shared database.

7、根据6所述的终端的数据处理方法,通过AIDL技术将转化成ContentValues类的运行数据发送至所述共享数据库。7. According to the terminal data processing method described in 6, the operation data converted into ContentValues is sent to the shared database through AIDL technology.

8、根据7所述的终端的数据处理方法,所述数据表包括表名和与所述表名对应的字段;所述表名与类名对应,所述字段与类成员变量对应。8. The terminal data processing method according to 7, wherein the data table includes a table name and a field corresponding to the table name; the table name corresponds to a class name, and the field corresponds to a class member variable.

9、根据8所述的终端的数据处理方法,所述类成员变量包括通用变量和附加变量,所述通用变量包括类ID。9. The terminal data processing method according to 8, wherein the class member variables include general variables and additional variables, and the general variables include class IDs.

10、根据9所述的终端的数据处理方法,在将所述应用的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中之后,所述终端的数据处理方法还包括:10. According to the data processing method of the terminal described in 9, after storing the operation data of the application in the data table corresponding to the operation data in the shared database, the data processing method of the terminal further includes:

将所述共享数据库中各数据表转化成Bean类。Each data table in the shared database is converted into a Bean class.

11、根据10所述的终端的数据处理方法,在将所述应用的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中之后,所述终端的数据处理方法还包括:通过所述类名于所述共享数据库中查询与所述类名对应的类成员变量。11. The data processing method of the terminal according to 10, after storing the running data of the application in the data table corresponding to the running data in the shared database, the data processing method of the terminal further includes: A class member variable corresponding to the class name is queried in the shared database through the class name.

12、根据10所述的终端的数据处理方法,在将所述应用的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中之后,所述终端的数据处理方法还包括:通过所述共享数据库中的数据表的字段,查询与所述数据表的表名对应的类名。12. The data processing method of the terminal according to 10, after storing the running data of the application in the data table corresponding to the running data in the shared database, the data processing method of the terminal further includes: The class name corresponding to the table name of the data table is queried through the fields of the data table in the shared database.

13、根据11或12所述的终端的数据处理方法,通过Adapter以视图形式显示所述数据表中的运行数据。13. According to the terminal data processing method described in 11 or 12, the running data in the data table is displayed in a view form through an Adapter.

14、根据1所述的终端的数据处理方法,所述终端的操作系统为安卓操作系统。14. The terminal data processing method according to 1, wherein the operating system of the terminal is an Android operating system.

15、一种终端的数据处理系统,所述终端中设置有两个以上应用单元;所述终端的数据处理系统包括:15. A terminal data processing system, wherein the terminal is provided with more than two application units; the terminal data processing system includes:

数据存储单元,用于存储共享数据库,所述共享数据库用于存储各个所述应用单元的运行数据;a data storage unit, configured to store a shared database, and the shared database is used to store the operation data of each of the application units;

数据处理单元,用于获取所述应用单元的运行数据,并将所述应用单元的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中。The data processing unit is configured to obtain the operation data of the application unit, and store the operation data of the application unit in a data table corresponding to the operation data in the shared database.

16、根据15所述的终端的数据处理系统,所述数据处理单元包括:16. The terminal data processing system according to 15, the data processing unit includes:

数据获取单元,用于获取所述应用单元的运行数据;a data acquisition unit, configured to acquire the operation data of the application unit;

数据表查询单元,用于判断所述共享数据库中是否包括与所述运行数据对应的数据表;a data table query unit, configured to determine whether the shared database includes a data table corresponding to the operating data;

数据表更新单元,用于在所述共享数据库中包括与所述运行数据对应的数据表时,将所述应用单元的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中。a data table updating unit, configured to store the operating data of the application unit in the data table corresponding to the operating data in the shared database when the shared database includes a data table corresponding to the operating data .

17、根据16所述的终端的数据处理系统,所述数据处理单元还包括:17. The terminal data processing system according to 16, the data processing unit further includes:

数据表建立单元,用于在所述共享数据库中不包括与所述运行数据对应的数据表时,建立与所述运行数据对应的数据表,并将所建立的数据表存储于所述共享数据库中。A data table establishing unit, configured to establish a data table corresponding to the operating data when the shared database does not include a data table corresponding to the operating data, and store the established data table in the shared database middle.

18、根据17所述的终端的数据处理系统,所述数据表更新单元通过DataBaseHelper将所述应用单元的运行数据存储于所述共享数据库中与所述运行数据对应的数据表中;所述数据表建立单元通过DataBaseHelper建立与所述运行数据对应的数据表。18. The terminal data processing system according to 17, the data table update unit stores the operation data of the application unit in the data table corresponding to the operation data in the shared database through DataBaseHelper; the data The table creation unit creates a data table corresponding to the operation data through DataBaseHelper.

19、根据18所述的终端的数据处理系统,所述应用单元包括:19. The terminal data processing system according to 18, the application unit includes:

第一数据转化单元,用于将所述运行数据转化成ContentValues类;A first data conversion unit, configured to convert the operation data into a ContentValues class;

数据发送单元,用于将转化成ContentValues类的运行数据发送至所述数据处理单元。The data sending unit is used to send the running data converted into ContentValues to the data processing unit.

20、根据19所述的终端的数据处理系统,所述数据发送单元在将转化成ContentValues类的运行数据发送至所述数据处理单元时,先通过Provider组件判断所述运行数据所在应用单元,然后通过Binder组件将所述应用单元的运行数据发送至所述数据处理单元。20. According to the data processing system of the terminal described in 19, when the data sending unit sends the operation data converted into ContentValues to the data processing unit, it first judges the application unit where the operation data is located through the Provider component, and then Send the running data of the application unit to the data processing unit through the Binder component.

21、根据20所述的终端的数据处理系统,所述数据发送单元通过AIDL技术将转化成ContentValues类的运行数据发送至所述数据处理单元。21. The terminal data processing system according to 20, wherein the data sending unit sends the operation data converted into ContentValues to the data processing unit through AIDL technology.

22、根据21所述的终端的数据处理系统,所述数据表包括表名和与所述表名对应的字段;所述表名与类名对应,所述字段与类成员变量对应。22. The terminal data processing system according to 21, the data table includes a table name and a field corresponding to the table name; the table name corresponds to a class name, and the field corresponds to a class member variable.

23、根据22所述的终端的数据处理系统,所述类成员变量包括通用变量和附加变量,所述通用变量包括类ID。23. The terminal data processing system according to 22, the class member variables include general variables and additional variables, and the general variables include class IDs.

24、根据23所述的终端的数据处理方法,所述数据处理单元还包括:24. The terminal data processing method according to 23, the data processing unit further comprising:

第二数据转化单元,用于将所述共享数据库中各数据表转化成Bean类。The second data conversion unit is configured to convert each data table in the shared database into a Bean class.

25、根据24所述的终端的数据处理系统,所述终端的数据处理系统还包括:第一数据查询单元,用于通过所述类名于所述共享数据库中查询与所述类名对应的类成员变量。25. The data processing system of the terminal according to 24, further comprising: a first data query unit, configured to query the shared database through the class name corresponding to the class name Class member variables.

26、根据24所述的终端的数据处理系统,所述终端的数据处理系统还包括:第二数据查询单元,用于通过所述共享数据库中的数据表的字段,查询与所述数据表的表名对应的类名。26. The data processing system of the terminal according to 24, further comprising: a second data query unit, configured to query the fields of the data table in the shared database for information related to the data table The class name corresponding to the table name.

27、根据25或26所述的终端的数据处理系统,所述终端的数据处理系统还包括:数据显示单元,用于通过Adapter以视图形式显示所述数据表中的运行数据。27. The terminal data processing system according to 25 or 26, further comprising: a data display unit configured to display the operating data in the data table in a view form through an Adapter.

28、根据15所述的终端的数据处理系统,所述终端的操作系统为安卓操作系统。28. The terminal data processing system according to 15, wherein the operating system of the terminal is an Android operating system.

本发明的描述是为了示例和描述起见而给出的,而并不是无遗漏的或者将本发明限于所公开的形式。很多修改和变化对于本领域的普通技术人员而言是显然的。选择和描述实施例是为了更好说明本发明的原理和实际应用,并且使本领域的普通技术人员能够理解本发明从而设计适于特定用途的带有各种修改的各种实施例。The description of the present invention has been presented for purposes of illustration and description, but is not intended to be exhaustive or limited to the invention in the form disclosed. Many modifications and changes will be apparent to those of ordinary skill in the art. The embodiment was chosen and described in order to better explain the principles of the invention and the practical application, and to enable others of ordinary skill in the art to understand the invention and design various embodiments with various modifications as are suited to the particular use.

Claims (10)

1. The data processing method of the terminal is characterized in that more than two applications are arranged in the terminal; the data processing method of the terminal comprises the following steps:
setting a shared database;
and storing the operation data of the application in a data table corresponding to the operation data in the shared database.
2. The data processing method of the terminal according to claim 1, further comprising, before storing the operation data of the application in a data table corresponding to the operation data in the shared database, the following steps:
judging whether a data table corresponding to the operation data is included in the shared database;
and if so, storing the operation data of the application in a data table corresponding to the operation data in the shared database.
3. The method according to claim 2, wherein if the shared database does not include the data table corresponding to the operation data, the data table corresponding to the operation data is created and stored in the shared database, and then the operation data is stored in the data table corresponding to the operation data in the shared database.
4. The method according to claim 3, wherein the operating data of the application is stored in a data table corresponding to the operating data in the shared database by a DataBaseHelper, or a data table corresponding to the operating data is established in the shared database.
5. The data processing method of the terminal according to claim 4, wherein before the storing the operation data of the application in the data table corresponding to the operation data in the shared database, the data processing method of the terminal further comprises:
converting the operation data into a ContentValues class;
and sending the operation data converted into the ContentValues class to the shared database.
6. The data processing method of the terminal according to claim 5, wherein when the running data is sent to the shared database, an application where the running data is located is determined by a Provider component, and then the running data of the application is sent to the shared database by a Binder component.
7. The data processing method of the terminal according to claim 6, wherein the operation data converted into the ContentValues class is transmitted to the shared database by aid of aid l technology.
8. The data processing method of the terminal according to claim 7, wherein the data table includes a table name and a field corresponding to the table name; the table name corresponds to a class name, and the field corresponds to a class member variable.
9. The data processing method of the terminal according to claim 8, wherein the class member variables include a generic variable and an additional variable, and the generic variable includes a class ID.
10. The data processing system of the terminal is characterized in that more than two application units are arranged in the terminal; the data processing system of the terminal comprises:
the data storage unit is used for storing a shared database, and the shared database is used for storing the running data of each application unit;
and the data processing unit is used for acquiring the operation data of the application unit and storing the operation data of the application unit in a data table corresponding to the operation data in the shared database.
CN201610395581.2A 2016-06-06 2016-06-06 Data processing method and system for terminal Pending CN106021591A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610395581.2A CN106021591A (en) 2016-06-06 2016-06-06 Data processing method and system for terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610395581.2A CN106021591A (en) 2016-06-06 2016-06-06 Data processing method and system for terminal

Publications (1)

Publication Number Publication Date
CN106021591A true CN106021591A (en) 2016-10-12

Family

ID=57089647

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610395581.2A Pending CN106021591A (en) 2016-06-06 2016-06-06 Data processing method and system for terminal

Country Status (1)

Country Link
CN (1) CN106021591A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108920606A (en) * 2018-06-28 2018-11-30 腾讯大地通途(北京)科技有限公司 map data processing method, device, terminal device and storage medium
CN113448995A (en) * 2020-03-25 2021-09-28 北京沃东天骏信息技术有限公司 Database operation method, device and system, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104424299A (en) * 2013-09-02 2015-03-18 腾讯科技(深圳)有限公司 Data statistical method and device
CN104618503A (en) * 2015-02-15 2015-05-13 西安酷派软件科技有限公司 Inter-system data synchronization and sharing method and device as well as terminal
CN104866366A (en) * 2015-06-15 2015-08-26 广东欧珀移动通信有限公司 Application clearing method and application clearing device
CN104902089A (en) * 2015-05-26 2015-09-09 北京金和网络股份有限公司 Method for sequencing mobile terminal applications
CN105045623A (en) * 2015-07-13 2015-11-11 四川长虹电器股份有限公司 Intelligent operating system based application configuration method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104424299A (en) * 2013-09-02 2015-03-18 腾讯科技(深圳)有限公司 Data statistical method and device
CN104618503A (en) * 2015-02-15 2015-05-13 西安酷派软件科技有限公司 Inter-system data synchronization and sharing method and device as well as terminal
CN104902089A (en) * 2015-05-26 2015-09-09 北京金和网络股份有限公司 Method for sequencing mobile terminal applications
CN104866366A (en) * 2015-06-15 2015-08-26 广东欧珀移动通信有限公司 Application clearing method and application clearing device
CN105045623A (en) * 2015-07-13 2015-11-11 四川长虹电器股份有限公司 Intelligent operating system based application configuration method

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
余永佳,等: "《Android应用开发基础 基于Android4.2、任务驱动式》", 30 September 2014 *
吴倩,等: "《Android 安全机制解析与应用实践》", 31 May 2013 *
陈文,等: "《深入理解Android网络编程技术详解与最佳实践》", 31 August 2013 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108920606A (en) * 2018-06-28 2018-11-30 腾讯大地通途(北京)科技有限公司 map data processing method, device, terminal device and storage medium
CN108920606B (en) * 2018-06-28 2020-10-23 腾讯大地通途(北京)科技有限公司 Map data processing method, map data processing device, terminal equipment and storage medium
CN113448995A (en) * 2020-03-25 2021-09-28 北京沃东天骏信息技术有限公司 Database operation method, device and system, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN105653644B (en) A page builder and page construction method
CN105955208B (en) Network robot data control system based on cloud platform
US10284705B2 (en) Method and apparatus for controlling smart device, and computer storage medium
US20210291045A1 (en) Method, system and electronic device for achieving remote control of computer game by game controller
WO2018112896A1 (en) Chat interaction method and apparatus, and electronic device thereof
US10705892B2 (en) Automatically generating conversational services from a computing application
US9934007B2 (en) Method for operating tool in working environment and machine using such method
WO2010031278A1 (en) Data processing device and processing method of web page
CN112152913B (en) Service control method, device and system
US11677807B2 (en) System and method to standardize and improve implementation efficiency of user interface content
CN107147713A (en) Courseware interactive system and courseware exchange method
CN108664546B (en) XML data structure conversion method and device
CN106021591A (en) Data processing method and system for terminal
CN109614271A (en) Control method, device, device and storage medium for data consistency of multiple clusters
US10019519B2 (en) Methods and systems for utilizing global entities in software applications
CN104580298A (en) File uploading processing method and device
CN104618471A (en) Application state transition method applied to different terminals
CN105917307A (en) User interface framework
CN104808970B (en) A kind of method and system for realizing internationalized software
TWI714006B (en) Method and device for starting Active system of Android system
CN109033447B (en) Face recognition data visualization system
CN113626016A (en) Front-end and back-end separated reusable component based on Vue + Element UI + Koa2
WO2016000564A1 (en) Method for projecting workspace and system using same
US20130031116A1 (en) Modeled business object data import
TW201525738A (en) Method for generating form validation program and corresponding form interface from result set metadata

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into 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: 20161012