dataif (erromsg) {//If there is an errorNSLog (@ "Insert data failed--%s", erromsg);} else {NSLog (@ "Insert data successfully");}}Delete the data and insert the data, just replace the SQL statement.Query data:const char *sql = "SELECT ID, Name, age from T_student WHERE age Preparation before querying-1 means the system automatically calculates the length of the SQL statementSQLITE3_STMT: Used to fetch datasqlite3_stmt *stmt = NULL;if (SQLITE3_PREPARE_V2 (self.db, SQL,-1, stmt, NULL) = = SQLITE
content ' where field = ' content before change 'The set is followed by the new data,where it is followed by the previous dataEnquiry: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 > conte
This example for you to share the iOS SQLite specific operation methods for your reference, the specific content as follows
#import
The above is the entire content of this article, I hope to help you learn.
Environment: OSX 10.8.3 XCode4.6 (4h127)When developing iphone and ipad apps, it's often necessary to use XML files and SQLite databases. When debugging, we need to look at the contents of the XML and the data of the database. But these things are inside the simulator. We need to find where they are stored and use the appropriate tools to open the view. The general location is as follows: User (current user)/library (Chinese: Resource library)/applica
iOS Development database Chapter-sqlite Common functionsA simple explanation1. Open the Databaseint Sqlite3_open (const char *filename,//file path for databaseSqlite3 **ppdb//DB instance);2. Execute any SQL statementint Sqlite3_exec (sqlite3*,//an open DB instanceconst char *sql,//SQL statement to executeInt (*callback) (void*,int,char**,char**),//callback after the SQL statement is executedvoid *,//The 1th
a foreign key called fk_t_student_class_id_t_class_id in the T_student table.The role of this foreign key is to refer to the ID field of the T_class table using the class_id field in the T_student table4. Table Connection QueryTable Join query: You need to federate multiple tables to find the data you wantTypes of table joinsInner joins: INNER JOIN or join (displays records with a full field value in the left and right tables)Left outer connection: Left OUTER join (guarantees the integrity of d
Sqlite database connection class. Sqlite database connection class * sqlite database connection class uses php to connect to sqlite. Sqlite database tutorial connection class * sqlite d
Nbsp; This tutorial describes important methods supported by SQLiteAPI, provides a simple script template that can be used in your development to show you how to use PHP to interact with the SQLite database. This article assumes that you have installed Apache and PHP. Nbsp; This tutorial will introduce you to the important methods supported by
viewcontroller.m//sqlitedemo////Created by Lam_tt on 15-4-11.//Copyright (c) 2015 Lam_tt. All rights reserved.//#import "ViewController.h" #import iOS SQLite simple to use
) { [Self.queue intransaction:^ ( Fmdatabase *db, BOOL *rollback) { [db executeupdate:@ "UPDATE t_student SET name= ' Jack ' WHERE id=?", @2]; [DB executeupdate:@ "UPDATE t_student SET name= ' Tomy ' WHERE id=?", @3]; When the situation is not found, the active rollback is made with the following statement. *rollback=yes; [DB executeupdate:@ "UPDATE t_student SET name= ' Eric ' WHERE id=?", @4]; }];}
data queriedSQLITE_API int sqlite_stdcall sqlite3_exec ( sqlite3*,/ * An open database *///handle Const char *sql,/ * SQL to is evaluated *///sql statement int (*callback) (void*,int,char **,Char* *),/ * callback function *///execution Complete callback void *,/ * 1st argument to callback *///callback block first parameter char **errmsg/ * ERROR msg written here *///fault message );Check SQL statementsSQLITE_API int sqlite_stdcall sqlite3_prepare_v2 ( sqlite3 *db,/ * Databa
name = ' WW ' WHERE age is 7;UPDATE t_student SET name = ' Xxoo ' WHERE age UPDATE t_student SET name = ' nnmm ' WHERE age /* Delete Data */DELETE from T_student;/* Update Data */UPDATE t_student SET name = ' LNJ ';/* Insert Data */INSERT into T_student (age, score, name) VALUES (' + ', ' + ', ' Jonathan ');INSERT into T_student (name, age) VALUES (' Lee ', ' 28 ');INSERT into T_student (score) VALUES (100);/* Insert Data */INSERT into T_student (name, age, score) VALUES (' Lee ', ' 28 ', 100);
This tutorial will introduce you to the important methods supported by the SQLite API and provide a simple script template that can be used in your development to show you how to use PHP to interact with the SQLite database. This article assumes that you have installed Apache and PHP.You do not have to install an interactive
occurs,Use putenv ("TMP = C:/temp"); to specify a temporary folder. For details, see the code:
";}; // Close the database sqlite_close ($ db) ;}else {print $ sqliteerror ;}?>
PHP + SQLite database operation tutorial and example
';} Else {echo' successfully connected the SQlite file: ', $ db_name ,'';} // CREATE a data TABLE: MD5 password TABLE sqlite_query (
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.