mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-08 19:00:27 +00:00
Add operation details to conflict handler in SQLite Lua API
This commit is contained in:
parent
f2b692a345
commit
132b9b8279
1 changed files with 11 additions and 1 deletions
|
@ -1968,12 +1968,22 @@ static int db_changeset_conflict_callback(
|
||||||
lua_State *L = db->L;
|
lua_State *L = db->L;
|
||||||
int top = lua_gettop(L);
|
int top = lua_gettop(L);
|
||||||
int result, isint;
|
int result, isint;
|
||||||
|
const char *zTab;
|
||||||
|
int nCol, Op, bIndirect;
|
||||||
|
|
||||||
|
if (sqlite3changeset_op(p, &zTab, &nCol, &Op, &bIndirect) != LUA_OK) {
|
||||||
|
lua_pushliteral(L, "invalid return from changeset iterator");
|
||||||
|
return lua_error(L);
|
||||||
|
}
|
||||||
|
|
||||||
lua_rawgeti(L, LUA_REGISTRYINDEX, changeset_conflict_cb); /* get callback */
|
lua_rawgeti(L, LUA_REGISTRYINDEX, changeset_conflict_cb); /* get callback */
|
||||||
lua_rawgeti(L, LUA_REGISTRYINDEX, changeset_cb_udata); /* get callback user data */
|
lua_rawgeti(L, LUA_REGISTRYINDEX, changeset_cb_udata); /* get callback user data */
|
||||||
lua_pushinteger(L, eConflict);
|
lua_pushinteger(L, eConflict);
|
||||||
|
lua_pushstring(L, zTab);
|
||||||
|
lua_pushinteger(L, Op);
|
||||||
|
lua_pushboolean(L, bIndirect);
|
||||||
|
|
||||||
if (lua_pcall(L, 2, 1, 0) != LUA_OK) return lua_error(L);
|
if (lua_pcall(L, 5, 1, 0) != LUA_OK) return lua_error(L);
|
||||||
|
|
||||||
result = lua_tointegerx(L, -1, &isint); /* use result if there was no error */
|
result = lua_tointegerx(L, -1, &isint); /* use result if there was no error */
|
||||||
if (!isint) {
|
if (!isint) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue