Tag: fmdb

ios fmdb内存泄漏

嗨我问这个问题,我的朋友,正在努力解决这个FMDB内存问题。 他的项目从一个数据库中读取一个列表,他打开数据库并读取每个单元格的数据(这不是一个好主意,但他做了),在init中,init数据库队列, databaseQueue = [[FMDatabaseQueue alloc] initWithPath:_dbPath]; 在cellForRowAtIndexPath中,使用configCell来做事情 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString * addressBookTableViewCellIdentifier = @"AddressBookTableViewCell"; AddressBookTableViewCell * cell = (AddressBookTableViewCell*)[tableView dequeueReusableCellWithIdentifier:addressBookTableViewCellIdentifier]; if (cell == nil) { // Create a cell to display an ingredient. cell = [[[AddressBookTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:addressBookTableViewCellIdentifier] autorelease]; cell.selectionStyle = UITableViewCellSelectionStyleBlue; } [self configCell:cell atIndexPath:indexPath]; return cell; […]

在同一个数据库上同时使用基于core-data和sqlite c的api

AFAIK CoreData可以configuration为在持久性存储中使用sqlite。 所以核心数据不提供使用SQL查询的方式。 所以core-data在后台有sqlite db。 同时使用基于Core-Data和Sqlite c的api访问相同的数据库是否安全? 会导致任何数据损坏是sqllite或任何线程问题。 为什么我要使用任何包装如FMDB或基于C的API是使用SQL查询来查询复杂的数据 请澄清我。

如何使用FMDB从表中删除所有数据

我想从我的数据库中的表中删除所有的数据。 我正在使用FMDB.And我已经使用此代码,但它不会从我的表中删除数据。 -(BOOL) deleteAll { FMDatabase *db = [FMDatabase databaseWithPath:[Utility getDatabasePath]]; [db open]; BOOL success = [db executeUpdate:@"TRUNCATE TABLE customers"]; [db close]; return success; return YES; }

如何在iOS应用程序中从FMDB中的两个不同数据库连接两个表

我的情况是这样的。 出于安全原因,我决定将应用程序数据放到包和用户数据文件目录中。 问题是如何从不同的数据库中join表格? 如果不可能的话,我必须创build一个表到文件目录中的数据库?

将NSArray转换为JSON对象数组

我想从结果数组中创build一个JSON数组对象。 NSMutableArray *resultsArray = [NSMutableArray array]; FMResultSet *resultsSet = [database executeQuery:queryString]; while ([resultsSet next]) { [resultsArray addObject:[resultsSet resultDictionary]]; } 为了澄清,我使用FMDB查询数据库。 然后,我将结果对象存储在resultsArray中。 从这里我想将结果数组转换成JSON数组对象。

SQLite的。 不能添加超过1000行

我试图添加到我的SQLite数据库(与FMDB)10K行,但写入停止在1000行。 我没有任何错误或警告。 我的代码: NSString *queryString = [NSString stringWithFormat:@"insert into histories (storyid, text, date, storyurl) values (%li, ?, ?, ?)",history.storyIndex]; if ([self.db open]) { if([self.db executeUpdate:queryString, history.storyText, history.storyDate, history.storyUrl]) { NSLog(@"history added"); } } 有什么build议么?

FMDB ios没有这样的表

我有一个SQLite项目的问题,我正在做,我正在使用FMDB,我遵循一个简单的例子,但没有工作。 而我找不到错误。 我从terminal做了我的数据库模式,我把它的一些数据。 我对ios开发很陌生,所以我不知道我是否做了好几步。 这就是我所做的: 1 – 我做了我的数据库模式,并添加一些字段。 2 – 我将database.db复制到xcode中的项目文件夹中。 3 – 我添加FMDB文件。 4 – 我添加sqlite3.dylib 5 – 我把这个代码: – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.dbname = @"database.db"; NSArray * docPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString * docDIr = [docPath objectAtIndex:0]; self.dbpath = [docDIr stringByAppendingPathComponent:dbname]; [self checkDB]; [self getQ]; return YES; } -(void) getQ […]

iOS的SQLite / FMDB更新无法正常工作

这并不像我想要的那样容易和具体,但我真的被某些东西困住了。 我按照这个教程,重新创build一个iPad应用程序非常相似: http : //www.highoncoding.com/Articles/836_Persisting_iOS_Application_Data_in_SQLite_Database_Using_FMDB.aspx 我遇到的问题是编辑客户和保存部分。 我已经在NSLog中引入了我编辑的客户新名称,并且通过了所有的函数,所以我认为它已经在更新命令中破坏了。 这也可能与客户ID,或在故事板,我从来没有find一些微小的设置。 如果有人有任何想法,让我知道。 我也可以把我的代码压缩成任何人。

内存泄漏(?)后,sqlite + fmdb真空命令

我通过FMDB封装在我的应用程序中使用sqlite。 调用VACUUM之前,我的应用中的内存使用量为2.25 MB: [myFmdb executeUpdate: @"VACUUM;" ]; 后缀在5.8 MB,我似乎无法回收内存。 后真空,仪器/分配工具显示吨活字节sqlite3MemMalloc调用,每个分配1.5 K. closures数据库并重新打开(一个选项),我怎么能清理这个呢? 编辑 :closures并重新打开数据库连接清除内存。 这是我的解决scheme,除非有人可以进一步了解这一点。

FMDatabaseQueue错误:数据库被locking

我有一个在后台线程运行的方法,所以(据我了解),我需要使用FMDatabaseQueue安全,可靠地访问我的SQLite数据库。 我正在做一个查询来检查logging的存在,之后立即UPDATE或INSERT取决于结果。 第一个查询运行良好,我得到了一个计数,但后面的查询不运行。 这是我得到的错误: 未知的错误调用sqlite3_step(5:数据库被locking)欧盟 这是我的代码: //Establish database queue NSString *path = [[PPHelpers documentsPath] stringByAppendingPathComponent:@"PilotPro2.db"]; FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:path]; //Start thread-safe database queue [queue inDatabase:^(FMDatabase *dbq) { NSUInteger count; //The other parameters in this query are provided beforehand NSString *query = [NSString stringWithFormat:@"SELECT COUNT(%@) AS counter FROM %@ WHERE %@ = '%@'",columnID, model, columnID, […]