fmdb

Passing an array to sqlite WHERE IN clause via FMDB?

帅比萌擦擦* 提交于 2019-11-29 17:15:24
问题 Is it possible to pass an array to a SELECT … WHERE … IN statement via FMDB? I tried to implode the array like this: NSArray *mergeIds; // An array with NSNumber Objects NSString *mergeIdString = [mergeIds componentsJoinedByString:@","]; NSString *query = @"SELECT * FROM items WHERE last_merge_id IN (?)"; FMResultSet *result = [database executeQuery:query, mergeIdString]; This only works if there is exactly 1 object in the array, which leads me to believe that FMDB adds quotes around the

How Can I Save & Retrieve an image (bytes) to SQLite (blob) using FMDB?

女生的网名这么多〃 提交于 2019-11-29 10:24:55
问题 I'm making an iOS App that need to show some images from a remote site (from an URL), and everytime the users enter to the screen that should show the image, the app get freeze until the download is completed. So I want to store the images already downloaded into a SQLite Table named COVERS. Here is the code that how I'm downloading and Showing the image: Suppose that movieCover is an UIImageView and the object movie has a NSURL property named cover that contains the URL of the image to be

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

*爱你&永不变心* 提交于 2019-11-28 20:21:58
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) 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]; JeremyP The function sqlite3_last_insert_rowid() is what you're looking for. Having just checked out the source code

Core Data VS Sqlite or FMDB…?

佐手、 提交于 2019-11-28 03:02:26
Now this might look like a duplicate thread, but my question is that I have read a lot of questions like.. Core Data vs SQLite 3 and others but these are 2-3 years old. I have also read that FMDB was developed as core data was not supported on iOS, So it should not be used any more. And on the other hand I have read that one should not use core data as a database. So I am seriously confused,whether I should use core data for object storage or not . I mean on what basis I should decide which to use? Are there any guidelines provided by apple or someone else.. or is it something that will come