Use of ios-database SQLite

Source: Internet
Author: User

Methods of database additions and deletions

Sqlite3_exec (DB, [SQL Utf8string], NULL, NULL, &ERRO);

Use of the database

Step: 01. Import Frame <sqlite3.h>

02. Create a database (sqlite3_exec) and open the Database (Sqlite3_open ())

03. Create a table, add a field (sqlite3_exec)

04. Implement database increase, delete, change, query operation (sqlite3_exec)

05. Close the Database (Sqlite3_close ())

Query operation steps:

01. Verify that the statement is valid: SQLITE3_PREPARE_V2

02. Bind the data to be queried: Sqlite3_bind_text

03. Loop to find content (by line): Sqlite3_step

04. Take out the data in this line (based on the corresponding class): Sqlite3_column_text

. formulas used by SQL statements

Build Table:

creat table name (field name field type, field name field type)

creat table name if not exist (field name field type, field name field type)

columns such as:creat table if not exist user(ID integer,name text,phone text);

Insert:INSERT into table name (field, field)values (' content '. ' content ');

Delete:delete from table name where field = ' What to delete ';

change:update table name set field = ' changed content ' where field = ' content before change '

The set is followed by the new data,where it is followed by the previous data

Enquiry:

01.select *from table name query all fields (* indicates all).

02.select field 1. Field 2....from table name;

such as:select *from user;

Conditional Statements:

where field = content;

Where field is content;// equivalent =

where field ! = content.

The Where field is the not content;

where fields > content;

where field > content and fields > content;&& where field > content or field > Content



Use of ios-database SQLite

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.