开发者

How to implement sqlite3_trace callback in objective c

I'm having trouble implementing following callback from the sqlite3 api. Has someone a good 开发者_运维百科example for implementing callbacks like this?

void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);

Found the solution: (this goes before @implementation block)

void myCallbackFunc(void *foo, const char* bar) {
    NSLog(@"=> %s", bar);
}


Essentially, implement a function with the following signature:

void (*xTrace)(void*,const char*);

and then place a pointer to this function in the call to sqlite3_trace. The sqlite3_trace page tells you what values will be passed to this function, so that you can NSLog then, [fs]printf them, show them on the screen, whatever you would like

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜