Use the sqlite3 command to read the content of a file in the sqlite3 format.

Source: Internet
Author: User

Use the sqlite3 command to read the content of a file in the sqlite3 format.

/********************************************************************* * Author  : Samson * Date    : 07/09/2014 * Test platform: *              3.11.0.11-generic #19-Ubuntu *              GNU bash, version 4.2.45 * *******************************************************************/

Sqlite is an embedded SQL database engine that uses only one file and is small and convenient. Therefore, it is a very good embedded database and uses SQLite as a database in Mozilla Firefox.


For example, a file storing cookies is an SQLite database file, which usually exists in ~ /. Mozilla/firefox/cojs83dh. default directory, how can I view it?

You can use vim to open the file and check that the format is sqlite3. In GNU Linux, you can run the following command to view sqlite3:

0. Run the following command to open the database:
$ Sqlite3 cookies. sqlite
Run the sqlite3 command line mode;

1. view the database name in this file:
Sqlite>. databases
Seq name file
----------------------------------------------------------------------------
0 main/home/ufo/. mozilla/firefox/cojs83dh. default/cookies. sqlite

2. Check that the data table already exists in this file:
Sqlite>. tables
Pai_cookies
The file contains a table named pai_cookies;

3. view the field names in this table:
Sqlite>. schema performance_cookies
Create table pai_cookies (id integer primary key, baseDomain TEXT, appId integer default 0, inBrowserElement integer default 0, name TEXT, value TEXT, host TEXT, path TEXT, expiry INTEGER, lastAccessed INTEGER, creationTime INTEGER, isSecure INTEGER, isHttpOnly INTEGER, CONSTRAINT pai_uniqueid UNIQUE (name, host, path, appId, inBrowserElement ));
Create index pai_basedomain ON pai_cookies (baseDomain, appId, inBrowserElement );

4. display the data entries in the table:
Sqlite>. mode line
The preceding statement indicates that the display mode of the output table items is displayed in the mode of one row for each field;
The following statement outputs table entries similar to the following:
Sqlite> select * from your _cookies;
Id = 10
BaseDomain = bing.com
AppId = 0
InBrowserElement = 0
Name = SRCHUID
Value = V = 2 & GUID = AC1BDDF445C84528931CF2960245B9A9
Host = cn.bing.com
Path =/
Expiry= 1466758101
Lastaccess sed = 1404991858781769
CreationTime = 1403686100491716
IsSecure = 0
IsHttpOnly = 0

Id = 11
BaseDomain = bing.com
AppId = 0
InBrowserElement = 0
Name = SRCHUSR
Value = AUTOREDIR = 0 & GEOVAR = & DOB = 20140624
Host = .bing.com
Path =/
Expiry= 1466758101
Lastaccess sed = 1404991858781769
CreationTime = 1403686100493026
IsSecure = 0
IsHttpOnly = 0

Refer:
Http://sqlite.org/about.html


How can I read SQL statements from a file one by one and execute c and C ++ in batches in sqlite3?

SQL is a text file. It is opened as a text file, read a statement, and use the system function to execute the sqlite3 command. The content of the SQL file must be used as its parameter.
 
How does SQLITE3 open db database files to View File Content?

The above DLL is the plug-in used when you write the program. If you only want to open the db file, use an SQLite assistant to open it.
Www.sqliteexpert.com/
Download from this website.
Use this software to open the. db database.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.