-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
insert does not work #41
Comments
Sorry, but I can't even being to help you out on this, since there are so many things that could be going wrong. I would suggest you add a bunch of logging to your classes, and make sure every input that you're giving to the various methods is exactly as you expect it to be. Either that, or break the problem down into the simplest possible example, and if there's a bug in that- we can start there. |
Hi, thanks for your patience. This is the insert statement I am using:
and then, to check, I execute a count(*) select, and it returns that 0 records are in the table!? no errors returned executeUpdate returns true, and rc in the inner method is 0.. i don't know what is it.. i open the connection multiple times before the insert, but i close it everytime.. that's the only sketchy thing i have in the app right now.. but my other concern is it does not "insert" into the db location I have it writes to this one: i open the database like this: any thoughts? this is the first time i use inserts in the application using fmdb, been always manually inserting data while developing.. again, thank you VERY much for your support! Isaac |
forget about "but my other concern is it does not "insert" into the db location I have it writes to this one:" because it actually inserts in the right database.. i just check that. |
Sorry, I'm not sure what to tell you. Unless you can provide for me a stripped down reproducible sample, there isn't anything I can do. |
FMDatabase * fmdb = [FMDatabase databaseWithPath: [[NSBundle mainBundle] pathForResource:@"ortho" ofType:@"db"]];
2012-01-04 22:29:53.867 Tests[4099:207] SessionCommandProcessorGHTestCase/testSimpleInsert table: weird!? |
Works ok for me (using this JSTalk script): var dbPath = "/tmp/jstalk.sqlite"; var db = [JSTDatabase databaseWithPath:dbPath]; [db executeUpdate:"""CREATE TABLE T_ANSWER ( [db executeUpdate:"INSERT INTO T_ANSWER (PATIENT_VISIT_ID, QUESTION_ID) VALUES (?, ?)", [NSNumber numberWithInt:99], [NSNumber numberWithInt:99]]; var rs = [db executeQuery:"select * from T_ANSWER"]; while ([rs next]) { var rs = [db executeQuery:"select count(*) from T_ANSWER where PATIENT_VISIT_ID = 99"]; while ([rs next]) { { |
Thank you! I'll do my homework! |
I might be doing something wrong, but i have a dao on top of fmdb, i am trying to insert records into the databse. first fmdb seems to be copying the database file to some temporary location and is not performing the inserts on the database file i open (i.e. the one included in the project), and second, insert is work ok no errors and returns a successful result, but the insert does not happen in the database, even in the db location fmdb is writing to.
i am openning the databse everytime i do the insert, i will change that eventually, but any ideas why this is happening. i know i am posting enough details, but any hints would be ver much appreciated.
Thanks!
Isaac
The text was updated successfully, but these errors were encountered: