Questions tagged [fmdb]

FMDB is a free, third-party Objective-C wrapper for SQLite, providing a simple, object-oriented interface for Mac OS X and iOS.

FMDB is a free, third-party Objective-C wrapper for SQLite, providing a simple, object-oriented interface for Mac OS X and iOS. FMDB isolates the Objective-C developer from the SQLite C interface and greatly simplifies the process of writing code that interacts with SQLite databases.

FMDB was developed by August "Gus" Mueller and is provided the public free of charge for use without restriction. See the LICENSE.

References

677 questions
4
votes
4 answers

How to turn on foreign keys in FMDatabase?

Just stumbled upon the fact foreign keys are disabled by default in sqlite. I have "on delete casdade" foreign key and deleting parent table records does not delete child records. Various posts indicate you need to enable that on each connection…
Centurion
  • 14,106
  • 31
  • 105
  • 197
4
votes
3 answers

how do we open an already existing database fmdb and where to include it?

I am using fmdb but i am not knowing where to add the db file. I found this old answer that i think it doesn't fit for xcode 4.2 (since we dont have 'Resources' folder anymore). I created a database in 'Lita', added the extension .sqlite and added…
iosMentalist
  • 3,066
  • 1
  • 30
  • 40
3
votes
3 answers

delete row from SQLite database with FMDB

i feel like i have read the docs for FMDB a million times. i am not sure why this code is not working - i have tried the executeUpdate method and the executeMethodWithFormat and their corresponding formats, neither seem to work. _dbArray is an array…
rick
  • 1,075
  • 4
  • 20
  • 29
3
votes
1 answer

Can someone explain how to use fmdb's FMDatabaseQueue?

I saw that FMDatabaseQueue is a new addition to fmdb to help handle background thread db calls. It seems like it's just what I need, but I can't find any documentation explaining how to make and handle query/update requests. Does anybody have any…
Lizza
  • 2,769
  • 5
  • 39
  • 72
3
votes
1 answer

FMDB query with char

I'm currently trying to execute a query on a database of words. The database is organized such that I can access by first letter of the word, and by length of the word. However, I'm having trouble when I search using a letter and length: //random…
Ray
  • 45
  • 1
  • 6
3
votes
2 answers

Saving to database using FMDB crashes on interpreting NSInteger

When the below function is called, I get the EXC_BAD_ACCESS crash. It looks like FMDB is having a problem interpreting the subject_id NSInteger as it makes it through the two NStrings and bombs when it hits this subject_id column in the WHERE…
jroyce
  • 2,029
  • 2
  • 22
  • 45
3
votes
2 answers

How can I read the whole row data from SQLite with FMDB in IOS dev?

I can read all column Data from code like this ... FMResultSet *rs = [db executeQuery:@"SELECT Name, Age, FROM PersonList"]; while ([rs next]) { NSString *name = [rs stringForColumn:@"Name"]; int age = [rs intForColumn:@"Age"]; } or find some…
bbbbbird1
  • 55
  • 2
  • 6
3
votes
3 answers

CoreData or SQLite for iOS aggregation

I have an iPhone app that requires local storage. My initial thought was to use core data, which is fine for a most of the app, however a major chunk is using aggregations on the data. In SQLite this is the standard use of MIN, MAX, AVG, GROUP_BY…
Cameron
  • 4,181
  • 9
  • 36
  • 40
3
votes
1 answer

SQLite Changes Not Saved

I'm using SQLite in iOS 4 on an iPhone, but the changes made by my update statements aren't saved. At first thought perhaps quitting the app might be deleting the database somehow, but they're not even persisted during the same session. The code to…
Echilon
  • 10,064
  • 33
  • 131
  • 217
3
votes
2 answers

Xcode failed to emit precompiled header?

thanks in advance for the help you will give me. I have searched this for half a day over the internet yesterday and two hours now and I haven't found anything (more than those two links that did not help FMDatabase.h not found when using route-me…
user1849661
3
votes
1 answer

getting error as there is at least one open result set around after performing [FMDatabaseQueue inDatabase:]?

In my app, there are multiple threads accessing the database. I have used the SQLite wrapper FMDB. I heard that FMDB provide me us to handle multithreading via FMdatabaseQueue. Due to that, I have used it like below: @property (nonatomic, strong)…
Nik
  • 1,679
  • 1
  • 20
  • 36
3
votes
2 answers

FMDB open database

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…
victorvj
  • 31
  • 1
  • 3
3
votes
0 answers

Using FMDB in Swift to execute a prepared statement

I have an array of objects I want to insert into a SQLite database. I'm using FMDB as my SQLite wrapper. This is the code I have: do { if !db.beginTransaction() { throw db.lastError() } for location in…
Dai
  • 141,631
  • 28
  • 261
  • 374
3
votes
2 answers

FMDB not working in swift?

In my project I added FMDB using cocoapods. I then created a bridging header for FMDB. But when I import FMDB.h using #import "FMDB.h" I receive the error "FMDB.h not found". When I import "#import " from folder, Xcode again gives me errors for…
3
votes
1 answer

Sqlite - how to retrieve a DATETIME field in Swift?

I am trying to retrieve a DATETIME field called TIMESTAMP from an SQLite DB with the following code: let dateFormatter = NSDateFormatter() dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" var d1: NSDate = NSDate() if…
Edward Hasted
  • 3,201
  • 8
  • 30
  • 48