开发者

Get by column names in SQLite?

Currently I am getting the values from statement like this:

[[NSString stringWithUTF8String:(char *)sqlite3_column_text(ReturnStatement,0)] retain];

I want to get the values by entering the column name like this:

[[NSString stringWithUTF8String:(char *)sqlite3开发者_如何学C_column_text(ReturnStatement,@"FirstColumn")] retain];

Is there any way to do this?


Check out http://sqlite.org/c3ref/column_name.html. You will have to iterate over the column indices returned by the query to add the column names to an array or dictionary that you can reference later to lookup the column index given a name to provide to the column_text function which only accepts the column index as an integer parameter.

One of the problems of using sqlite directly instead of CoreData which will handle this for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜