Subscribe ( )

iPhone Programming Tutorials


 

Forum

You must be logged in to post Login Register

Search 

sqlite and integers

User Post

6:07 am
October 3, 2008


cmcintosh

Noob

posts 1

1

I have a sqlite db, i have some colums that are integers and a couple that are strings now, from the tutorial I have learned that:


[NSString stringWithUTF8String:(char *)sqlite3_column_text(init_statement, 4)];

will return a string variable.  How would one do this for an integer?

I have gotten this far and think I am on the right track, but do not know what isthe first part after the NSInteger, any suggestions or a link to an article learning more on how to handle this sort of data would be good, both would be great.


 self.gameId = [NSInteger ???:(int *)sqlite3_column_int(init_statement, 2)];

8:17 am
October 3, 2008


Admin

brandontreb

posts 88

2

In the Todo Tutorial Part 3, I show you how to retrieve an integer value from the database.

Here is the code:


self.gameId = sqlite3_column_int(init_statment,2);


It should return an int without having to cast at all…You only need to do the casting when working with strings.  I hope this helps

If debugging is the process of removing bugs, then programming must be the process of putting them in.
-Edsger Dijkstra

Search 

About the iCodeBlog forum

Most Users Ever Online:

44


Currently Online:

4 Guests

Forum Stats:

Groups: 2

Forums: 6

Topics: 419

Posts: 893

Membership:

There are 934 Members

There has been 1 Guest

There are 2 Admins

There is 1 Moderator

Top Posters:

bobcubsfan – 54

crazyiez – 30

Uhu – 17

AdeC – 17

Nick – 15

jitesh61 – 12

Administrators: Brandon (88 Posts), Collin (0 Posts)

Moderators: VertigoSol (26 Posts)



©   

  • Posted by on 6 Aug 2008 in Uncategorized
  •   |  
  •   |  
  •   |  
  • Comments Off

Comments are closed.