int ID = sqlite3_column_int(stmt, 0); const unsigned char *cName = sqlite3_column_text(stmt, 1); const unsigned char *cPic = sqlite3_column_text(stmt, 2); // 将获取到的C语言字符串转换成OC字符串 NSString *name = [NSString stringWithUTF8String:(const char *)cName]; NSString *p...
* sqlite3_column_double() * sqlite3_column_int() * sqlite3_column_int64() * sqlite3_column_text() * sqlite3_column_text16() * sqlite3_column_type() * sqlite3_column_value() sqlite3_finalize() 销毁 sqlite3_stmt对象, 所有sqlite3_stmt对象都应该销毁以防止内存泄漏 sqlite3_close() 关闭...
sqlite3_stmt *stmt; if (sqlite3_prepare_v2(_sqlite3, sql.UTF8String, -1, &stmt, NULL) == SQLITE_OK){//是否准备成功 while(sqlite3_step(stmt) == SQLITE_ROW){//执行每一行数据 int ID = sqlite3_column_int(stmt, 0); unsigned const char *name = sqlite3_column_text(stmt, 1); ...
(三) sqlite3_column_ 原型: SQLITE_APIconstvoid*sqlite3_column_blob(sqlite3_stmt*,intiCol);SQLITE_APIintsqlite3_column_bytes(sqlite3_stmt*,intiCol);SQLITE_APIintsqlite3_column_bytes16(sqlite3_stmt*,intiCol);SQLITE_APIdoublesqlite3_column_double(sqlite3_stmt*,intiCol);SQLITE_APIintsqlite3_...
while (sqlite3_step(stmt) ==SQLITE_ROW) {//返回SQLITE_ROW说明查询到了数据 int _id =sqlite3_column_int(stmt,0);//id char *_name = (char *)sqlite3_column_text(stmt,1); //name NSString *name = [NSStringstringWithUTF8String:_name]; ...
int id = sqlite3_column_int(stmt, 0); const char *name = (const char *)sqlite3_column_text(stmt, 1); int age = sqlite3_column_int(stmt, 2) + 1; printf("%d\t%s\t%d\n", id, name, age); char sql[1024]; snprintf(sql, sizeof sql, "update stu set age = %d where id ...
int count = sqlite3_column_int(stmt, 0); if (count < 0) { goto err2; } printf("count = %d\n", count); sqlite3_finalize(stmt); return count; err2: sqlite3_finalize(stmt); err1: return -1; } 下面是一个查找数据并取出数据代码: ...
int result = sqlite3_prepare_v2(_db, sql, -1, &stmt, NULL); if (result == SQLITE_OK) { NSLog(@"查询语句合法"); students = [NSMutableArray array]; //4.执行SQL语句 while (sqlite3_step(stmt) == SQLITE_ROW) { StudentModel *student = [[StudentModel alloc] init]; ...
sqlite3_column_blob(sqlite3_stmt*, int iCol); // 二进制文本数据 sqlite3_column_text(sqlite3_stmt*, int iCol); // 字符串数据 3.常用建表语句 1.创建数据库:create database 数据库名称 2.删除数据库:drop database 数据库名称 3.创建数据表:create table if not exists 表名(id integer primary...
sqlite3_stmt *statement; if (sqlite3_prepare_v2(database, selectSql, -1, &statement, nil)==SQLITE_OK) { NSLog(@"select ok."); while (sqlite3_step(statement)==SQLITE_ROW)//SQLITE_OK SQLITE_ROW { int _id=sqlite3_column_int(statement, 0); NSString *name=[[NSString all...