开发者

How to write an SQLite3 Objective-C resultset wrapper?

I want to write an SQLite resultset wrapper class for iPhone to dynamically call sqlite3_column_int or sqlite3_column_text. In my fetchAll method I would like without knowing data type to just return the data.

I was thinking of using performSelector. Ho开发者_运维百科w would I design such a class to interact with SQLite?


No, you can't use an Objective-C feature to call a C function in that way (performSelector that is). You can call C code within objective-C. One approach may be to keep function pointers to the C functions you want to call, then implement some logic to choose the appropriate function pointer to reference.


I'm not quite sure I understand, but I suppose you might be able to write a few Objective-C methods containing small amounts of pure C and call performSelector on those. Unfortunately the SQLite3 API for the iPhone kind of sucks.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜