如何在SQLite中提交更改? [英] How to commit changes in SQLite?

查看:117
本文介绍了如何在SQLite中提交更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据库出现了问题 - 有时候某些更改不会被自动提交,所以我需要手动执行。

I've got a problem in my database - somehow changes sometimes are not being autocommitted so I need to COMMIT the manually.

我该怎么做?为了在SQLite中提交更改,我必须在objective-C中编写什么代码?

How can I do this? What code do I have to write in objective-C in order to commit changes in SQLite?

我正在开发一个iPhone应用程序。

I am developing an iPhone application.

谢谢。

推荐答案

因为我刚刚写了另一个问题,最简单的方法是:

As I just happened to write to another question, the simplest way is:

char* errmsg;
int result = sqlite3_exec(database, "COMMIT", NULL, NULL, &errmsg);

使用通常的结果代码& c(你需要sqlite3_free(errmsg))我使用了它指向的错误信息,如果有的话。

with the usual result codes &c (you'll need to sqlite3_free(errmsg) after you've used the error message it points to, if any).

这篇关于如何在SQLite中提交更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆