fmdb

FMDB and encryption

依然范特西╮ 提交于 2020-01-13 11:07:02
问题 I'm using FMDB to work with sqlite and I'd prefer to avoid a dependency on SQLCipher. How can I simply leverage the DataProtection capability built into iOS? Is this possible - the only requirement is to protect the data in the event of the phone being stolen. If the phone is unlocked with a PIN, it's fine that the user could access the DB - it's their data. 回答1: Look for the line where you do databaseWithPath: (or initWithPath: ), then add: FMDatabase *db = [FMDatabase databaseWithPath:path]

UI Stucks in iOS app possible reason is FMDB query?

柔情痞子 提交于 2020-01-07 03:10:34
问题 my apps UI stuck for several seconds for the very first time app launches (MenuPage) and when I move to Account page. It stuck while calculating some status. But I did them in background queue. I paused and looked at the debugger. Its shows this: I am giving the codes from account page as it is much clean than the menu page. From account page I am calling SyncStatus like this: dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ [_syncStatus startStatusCalculating]

Iphone Unit Test : with SQL

随声附和 提交于 2020-01-05 04:41:06
问题 I'm trying to do some Unit Testing on method that includes SQL call wrapped by FMDB. I get a lot of linker errors when i try to build the project such as these ones : "_sqlite3_step", referenced from: -[FMResultSet next] in FMResultSet.o -[FMDatabase executeUpdate:arguments:] in FMDatabase.o "_sqlite3_column_name", referenced from: -[FMResultSet setupColumnNames] in FMResultSet.o -[FMResultSet kvcMagic:] in FMResultSet.o (there are 27 of them so i wont paste them all ;) Everything works fine

FMDB open database

馋奶兔 提交于 2020-01-04 02:54:32
问题 I'm trying to open a database that I have in my project inside Resources. The problem is that it seems that its impossible to find the database file! I tried with the complete path, and it works, but this is not a good solution. I would like to now how to open it! I'm using this code: db = [FMDatabase databaseWithPath:@"bbdd.sql"]; I don't know how to find the other part of the "actual" path. Do you have a solution for me? Thanks!!!! 回答1: You need to find the full path of the database in the

Best way to get the ID of the last inserted row on SQLite

陌路散爱 提交于 2019-12-29 03:52:04
问题 On iPhone, what's the best way to get the ID of the last inserted row on an SQLite Database using FMDB ? Is there a better way rather than doing : SELECT MAX(ID) 回答1: If you can guarantee that your ID column is an auto-increment column, MAX(ID) is fine. But to cover any case, there's a specialized SQLite function called LAST_INSERT_ROWID(): SELECT LAST_INSERT_ROWID(); In FMDB, you use the -lastInsertRowId method (which internally runs the above): int lastId = [fmdb lastInsertRowId]; 回答2: The

FMDatabase.h not found when using route-me library

左心房为你撑大大i 提交于 2019-12-25 10:09:31
问题 So im trying to use the route-me widget in my app, but xcode keeps complaining that it cant find FMDatabase.h, yet its included in the project (albeit under a different project that is included into my project). I've copied how a sample app has been made yet the sample project doesnt get this error. The RMDBMapSource.h file is contained within the MapView project, so i shouldn't need to include the fmdb stuff myself (and because the sample project doesn't do that) Surely if the files are

FMDatabase.h not found when using route-me library

时光毁灭记忆、已成空白 提交于 2019-12-25 10:09:05
问题 So im trying to use the route-me widget in my app, but xcode keeps complaining that it cant find FMDatabase.h, yet its included in the project (albeit under a different project that is included into my project). I've copied how a sample app has been made yet the sample project doesnt get this error. The RMDBMapSource.h file is contained within the MapView project, so i shouldn't need to include the fmdb stuff myself (and because the sample project doesn't do that) Surely if the files are

Migrating SQLCipher ver. 2.x DB to ver. 3.x using by FMDB

南楼画角 提交于 2019-12-25 04:45:21
问题 I saw the following page and I understand I should execute the query "PRAGMA cipher_migrate". https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_migrate But I have no idea how to use it on FMDatabase. The following code did not work... (Seems like not only the timing of the execution is wrong...) I'd like you to let me know your workaround if you have tried migrating SQLCipher ver.2.x DB to ver.3.x using by FMDatabase. - (FMDatabase *)openDB { NSArray *directories =

save NSImage with FMDB in swift

只谈情不闲聊 提交于 2019-12-25 03:32:36
问题 I'm working on a CarRental App for OS X in swift. I have a NSImageView where the user can drop a picture and some TextFields. The car data are stored in an array of Car Objects. I need to write this data to an SQLite database with FMDB. I have no problems with the text, but how to save the picture? The below code runs without error but it does not save the image correctely. let sql = "INSERT INTO tblCars (cMakeModel, cPrice, cPhoto) VALUES (?,?,?)" if let db = DBManager.openDB(dbName) { for

How to join two tables from two different databases in FMDB in a iOS app

核能气质少年 提交于 2019-12-24 15:28:49
问题 My scenario is like this. for a security reason, I decide I put app data to the bundle and user data to the document directory. the problem is how to join the tables from the different databases? if not possible do I have to create a table to the database in document directory? 回答1: Sqlite3 allows it to attach foreign database to the current connection. Imagine, you have two databases, each one holds an own connection via FMDatabase (for multithreading purposes you should use FMDatabaseQueue