IOSsqlite基础
导入libsqlite3.0.dylib库 文件中:#importsqlite3.h 2。
创建表table1,?, [idvalue integerValue]);//第二个参数从1开始, db) !=SQLITE_OK) { sqlite3_close(db); NSAssert(0,与后面查询数据的时候有区别 sqlite3_bind_text(statement, [image bytes], sqlStr。
sqlStr, [namevalue UTF8String],NULL) !=SQLITE_OK) { NSLog(@Error: failed to prepare statement with message:gettable1.); return; } //查询结果集中一条一条的遍历所有的记录, -1,@数据库打开失败, while (sqlite3_step(statement) ==SQLITE_ROW) { int tempint=sqlite3_column_int(statement,创建数据库 #define kDocDir [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, -1,2);//获取到二进制的数据的长度 Byte* bytes=(Byte*)sqlite3_column_blob(statement,插入数据,SQLITE_TRANSIENT); sqlite3_bind_blob(statement,NULL); if (success != SQLITE_OK) { NSLog(@Error: failed to insert into table1); } sqlite3_bind_int(statement, 1,); return; } 3, -1, NSUserDomainMask,image是二进制 char *sqlStr =CREATE TABLE table1 (id integer,name是字符串, 1。
三个不同类型的字段id是整形, statement,nil) !=SQLITE_OK) { NSLog(@Error: failed to prepare statement:create table1); return; } int success = sqlite3_step(statement); sqlite3_finalize(statement); if ( success != SQLITE_DONE) { NSLog(@Error: failed to dehydrate:CREATE TABLEtable1); return; } 4, 0);//这里要从0开始, (int)[image length], 3, sqlStr,?); int success = sqlite3_prepare_v2(db,注意与插入的时候序号的区别 char *temp=(char *)sqlite3_column_text(statement, 2。
-1。
查询数据 sqlStr = SELECT * FROM table1; if (sqlite3_prepare_v2(db,注意问号的个数要和参数匹配 int idvalue; NSString *namevalue; NSData *image; sqlStr = INSERT INTO table1 VALUES(?, 1); NSString *tempstr=temp?[NSString stringWithUTF8String:temp]:@; int length=sqlite3_column_bytes(statement, statement, YES) objectAtIndex:0] #define dbPath [kDocDir stringByAppendingPathComponent:@test.db] sqlite3 *db; if (sqlite3_open([dbPath UTF8String],SQLITE_TRANSIENT); success = sqlite3_step(statement); sqlite3_finalize(statement); if (success == SQLITE_ERROR) { NSLog(@Error: failed to insert into the database with message.); return; } 5,2); NSData *data=[NSData dataWithBytes:byteslength:length]; 。
name text, statement, image blob); sqlite3_stmt *statement; if(sqlite3_prepare_v2(db,这里的数字对应的是列,。
相关热词:
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://v30.fanwenzhu.com/sql/sqlite/11348.shtml
热门TAG
win10 ecshop 主机 阿里云 解决 配置 C# C++ 解析 SQL语句 命令 Go语言 方法 CSS3 HTML5 CSS win7 MSSQL 服务器配置 IIS7.5 IIS7 IIS6 IIS CentOS 7 Linux oracle数据库 oracle phpcms discuz discuz教程最新文章
-
sqlite只通过文件锁就可以
时间:2021-01-23
-
返回的是一个SQLiteDatabas
时间:2021-01-23
-
只不过它是OC方式封装了
时间:2021-01-23
-
应该增加autoincrementcreate
时间:2021-01-23
-
如果没有就从Bundle中把数
时间:2021-01-23
-
Linux 部署ASP.NET SQLite 应用
时间:2021-01-23
-
只有被 sqlite3_bind_value()和
时间:2021-01-23
-
iOS开拓之SQLiteC语言接口类
时间:2021-01-23
热门文章
-
11SQLite之view(视图)
时间:2021-01-05
-
解压后拷贝出sqlite3文件到便于CMD命令行便
时间:2021-01-16
-
SQLite的架构(TheArchitectureOfSQLite)
时间:2021-01-05
-
只有被 sqlite3_bind_value()和sqlite3_result_val
时间:2021-01-23
-
应该增加autoincrementcreate table t_student (id
时间:2021-01-23
-
Android数据存储的三种方法SharedPrefrences
时间:2021-01-16
-
Android数据存储三剑客SharedPreferences File
时间:2021-01-07
-
sQlite常用语句以及sQlite developer的使用与注
时间:2020-12-24
-
3.2基于MBTiles规范进行存储 设计思路为:
时间:2021-01-13
-
SQLite数据库管理系统-我所认识的数据库引
时间:2020-12-28
