tags:

views:

51

answers:

1

I have a method called like this...

-(void)dbUpdate:(int)forId {

Which contains this sqlite to bind and update a database.

sqlite3_bind_int(UPDATE_ACCOUNT, 3, forId);

When I run the query, it doesn't give me an error, but it doesn't update the database either.

If I change this line of code...

sqlite3_bind_int(UPDATE_ACCOUNT, 3, forId);

manually, to...

sqlite3_bind_int(UPDATE_ACCOUNT, 3, 6);

the query runs 100% fine, as expected.

Changing the variable to an actual integer proves to me that the variable 'forId' isn't being passed or bound to the query properly.

What am I doing wrong? How is the best way to pass an Integer (and make sure it is an Integer) into an sqlite bind?

Cheers,

A: 

Thanks Nick, you pointed me in the write direction.

Turns out I was reading the value like this...

[NSNumber numberWithInt:sqlite3_column_int(SELECT_USERNAME, 0)]

I needed to bind it back doing this...

sqlite3_bind_int(UPDATE_ACCOUNT, 3, [forId intValue]);

That fixed it :)

iphone_developer