Reprinted from: http://blog.csdn.net/ygsyyl/article/details/8144407
1, in the PC environment to start a simulator (not mobile)
2. See if the simulator/systen/xbin has sqlite3 command
ADB shell
Cd/system/xbin
Ls
3. Copy the simulator/system/xbin/sqlite3 command file from the simulator to the PC
ADB pull/system/xbin/sqlite3 E:/eclipse
4. Turn off the simulator and connect the Android phone to the PC
5. Get read access to Android phone/system folder
ADB Shell # mout-o remout, Rw-t yaffs2/dev/block/mtdblock3/system (a lot of people based on their device online is this)
6. Copy the E:/eclipse/sqlite3 file on the PC to the/system/xbin/directory of the Android phone
ADB push E:/sqlite3/system/xbin
If prompted permission denial
ADB shell
chmod 777 system/
CD system
chmod 777 XBin
Then execute the push above
If not, go straight to Eclipse DDMS filter Explore/system/xbin
Drag the data you use directly from your computer to the/system/xbin.
7. Modify the permissions of the Android real-computer/system/xbin/sqlite3 command
ADB shell
chmod 4755/system/xbin/sqlite3
then enter Sqlite3
Go to SQLite and you can do it.
If you can execute it, the database is installed.
8
Android database is built on
/data/data/Project com.example.name/databases/database name
Enter the directory to open the database
Sqlite3 database_name.db.
If you can't open it, change the permissions of the database to 777 or 755.
CHMOD 777 database_name.
If you want to write, you must set the Write permission for all directories.
/data/data/Project com.example.name/databases/Database Celebrities
All permissions in front of the database have been changed.
Cases
chmod 777 Data
CD data
chmod 777 Data
CD data
chmod 777 Project Name
You can then execute the SQLITE3 database name.
9 Help for help.
Exits the database. Quit
Here are some additional questions.
First adb shell
Mount
And then you see the following line
Above in Windows using the ADB # Mount-o .......
Below the ADB shell you can use the following command
Mount-r-W remount-t rfs/dev/block/sti9/system
Both RFS and Sti9 are based on one of the graphs above. Write according to your own device.
At last
Mount-r-O remount-t rfs/dev/block/sti9/system
Re-remount for safety ...
Common commands;
. databases View all databases
. Tables View All Tables
. Dump VIEW all INSERT statements
. schame table_name View table structure
After a half-day of SQLite's manual, did not find how to modify the column name. Finally, I used a stupid method.
Here I'm going to rename the post tbl to tb_l.
First rename the Post table.
ALTER TABLE post RENAME to Tmp_post;
You re-create the post table.
?
1234 |
CREATE TABLE post( id integer primary key autoincrement, tb_l varchar (128) not null ); |
Import Tmp_post data into post and delete tmp_post;
Insert into post (tb_l) select tbl from Tmp_post;
drop table tmp_post;
If the original table Tmp_post is the same as the number of newly created post columns, and it corresponds to one by one, you can import it using a statement.
INSERT INTO post select * from Tmp_talbe;
--------------------------------------
When you use Sqliteman to modify a table, you encounter a problem that whenever you add or modify column information, the information that is the primary key is lost, so you can only write your own SQL execution. Example:
ALTER TABLE "store_productcategory" ADD COLUMN "Displayorder" INT DEFAULT (0)
The biggest feature of SQLite is that you can save all types of data to any field without worrying about the data type of the field. Except for the primary key. The primary key can only hold 64-bit integers. Since the type is not very clear. I think you have the type of what should be what type, will not error. That is, no type.
* SQLite supports table name modification and increment column
* 1, modify the table name: ALTER table Oldtablename RENAME to Newtablename;
* 2, add column: ALTER TABLE tablename ADD column fieldname FieldType;
Updated data Update mytab Set Columon = ' Date ' where id=10;