Four storage methods for Android data: SharedPreferences, SQLite, Content Provider, and File (2) -- SQLite and androidsqlite
SQLite is a lightweight database designed for embedded devices. It has only five data types:
NULL: NULL
INTEGER: INTEGER
REAL: Floating Point Number
TEXT: String
BLOB: Big Data
In
StatementYou are welcome to repost this article, but please respect the author's Labor achievements. repost this article and keep the statement in this box. Thank you.Article Source: http://blog.csdn.net/iukey
SQLite is implemented in pure C, so it is doomed to be a cross-platform tool that can be used in both Android and iOS, and can completely write common code for us to transplant. Of course,
SQLite is a lightweight database designed for embedded devices. It has only five data types:
Null: NULL
Integer: integer
Real: Floating Point Number
Text: String
BLOB: Big Data
In SQLite, the Boolean and date types are not specifically designed, because the boolean type can replace true and false with integer 0 and 1, the date type can have text, real, and integer values in a specific format instead of disp
tutorial:SQLite;. Header Onsqlite;. Mode Columnsqlite;. Timer Onsqlite> The above settings will produce output in the following format:ID NAME age ADDRESS SALARY---------- ---------- ---------- ---------- -------- --1 Paul California 20000.02 Allen Texas 15000.03 Teddy Norway 20000.04 Mark rich-mond 65000.05 David Texas 85000.06 Kim
SQLite This is a very popular embedded database. It supports SQL queries, and only uses very little memory. Android is implemented in integration with SQLite, so each Android application is able to use the SQLite database. When you are familiar with SQL developers. Using
a cursor instance during query execution. If it is set to null, it indicates that the system uses the default factory class super (context, name, null, version) ;}@ override public void oncreate (sqlitedatabase dB) {db.exe csql ("create table if not exists person (personid integer primary key autoincrement, name varchar (20), age integer) ") ;}@ override public void onupgrade (sqlitedatabase dB, int oldversion, int newversion) {db.exe csql (" alter table person add phone varchar (12 )"); // Add
SQLite tutorial (14): C language programming example code (2), sqlite programming example
3. Efficient batch data insertion:
Before giving the operation steps, let's briefly describe the concept of batch insert to help you read the subsequent sample code. In fact, batch insert is not a new concept. It is supported in the C interface APIs of other relational datab
SQLite tutorial (12): detailed explanation of lock and concurrency control, and detailed description of sqlite
I. Overview:
In SQLite, the lock and concurrency control mechanisms are handled by the pager_module module, such as ACID (Atomic, Consistent, Isolated, and Durable ). In transactions that contain data modifica
Iot framework ServerSuperIO tutorial-19. device drivers and OPC Client Support persistence of mysql, oracle, sqlite, and sqlserver. V3.6.4 released, sqlite persistent
19. The device driver and OPC Client Support persistence of mysql, oracle, sqlite, and sqlserver.
19.1 Overview
ServerSuperIO supports writing data colle
Sqlite:1. A Lightweight data management tool for local data storage is one of the many tools used to implement database management.2.Android has absorbed the code functions of SQLite in its system, we can directly in the Android program using SQLite's statement to create a database, and to implement database additions
SQLite tutorial (5): Index and data analysis/cleanup, sqlite Data Analysis
I. Create an index:
In SQLite, the SQL syntax for index creation is basically the same as that of most other relational databases, because here is just an example usage:Copy codeThe Code is as follows:Sqlite> create table testtable (first_col in
Reference http://blog.csdn.net/sdsxleon/article/details/18259973 very goodhttps://github.com/2point0/Android-Database-Locking-Collisions-Example Examplehttp://www.eoeandroid.com/forum.php?mod=viewthreadtid=333473Http://bbs.51cto.com/thread-990260-1.htmlWith transactions, the speed will be veryScenario 1:SQLiteis essentially writing the data to a file, typically found under the app's package namexxx.dbthe file that hasRootpermission of the phone, which
Android listview scroll sliding screen shows sqlite paging, similar to chat records, listview dynamically adds sqlite paging dataI recently used openfire-based chat (like QQ) to view chat records on pages. For this reason, I used to view chat records in reverse chronological order, declare that the demo is in reverse order based on the id (the principle is the sa
(Android.os.Message msg) {int code = Msg.what;switch (CO DE) {case 0:mphonebookehelper.insertcontacts (); break;}};}It is important to note that when you create a new thread in the activity, it is not directly accessible to the UI components in the activity, it needs to be handled with handler or Asyntask, and no one throws exception:Java.lang.RuntimeException:Can ' t create handler inside thread that have not called looper.prepare ()So I call the sendemptymessage () function in the button even
PHP SQLite instance tutorial. This tutorial will introduce you to the important methods supported by SQLiteAPI and provide a simple script template that can be used in your development, this document describes how to use PHP to interact with the SQLite database. This document describes the important methods supported b
SQLite tutorial (6): expression explanation, sqlite expression
I. common expressions:
Like most relational databases, SQLite can well support expressions provided in the SQL standard, and its functions are consistent with the SQL standard, such:Copy codeThe Code is as follows:|*/%+-===! = ANDOR~ NOTIn the above express
SQLite tutorial (13): C language programming example code (1), sqlite programming example
1. Get the table Schema information:
1) dynamically create a table.
2) obtain the table field information, such as the number of fields and the type of each field, based on the API provided by sqlite3.
3). Delete the table.
See the following code and key notes:Copy codeThe C
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.