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