| 6433 | } |
| 6434 | |
| 6435 | static int run_sp_int(struct sqlclntstate *clnt, int argcnt, char **err) |
| 6436 | { |
| 6437 | int rc; |
| 6438 | SP sp = clnt->sp; |
| 6439 | Lua lua = sp->lua; |
| 6440 | |
| 6441 | if ((rc = lua_pcall(lua, argcnt, LUA_MULTRET, 0)) != 0) { |
| 6442 | if (lua_gettop(lua) > 0 && !lua_isnil(lua, -1)) { |
| 6443 | *err = strdup(luabb_tostring(lua, -1)); |
| 6444 | } else { |
| 6445 | *err = strdup(""); |
| 6446 | } |
| 6447 | rc = -1; |
| 6448 | int tmp; |
| 6449 | /* Don't make new parent transaction on this rollback. */ |
| 6450 | sp->make_parent_trans = 0; |
| 6451 | |
| 6452 | db_rollback_int(lua, &tmp); |
| 6453 | |
| 6454 | if (in_client_trans(clnt)) { |
| 6455 | /* We have rolled back the transaction before having seen a commit |
| 6456 | * or rollback from the client. Let's fix the transaction state. |
| 6457 | */ |
| 6458 | assert(clnt->ctrl_sqlengine == SQLENG_NORMAL_PROCESS); |
| 6459 | sql_set_sqlengine_state(clnt, __FILE__, __LINE__, SQLENG_FNSH_ABORTED_STATE); |
| 6460 | } |
| 6461 | } |
| 6462 | |
| 6463 | if (gbl_break_lua && pthread_equal(gbl_break_lua, pthread_self())) { |
| 6464 | gbl_lua_version++; |
| 6465 | gbl_break_lua = 0; |
| 6466 | gbl_break_all_lua = 0; |
| 6467 | } |
| 6468 | |
| 6469 | return rc; |
| 6470 | } |
| 6471 | |
| 6472 | static int run_sp(struct sqlclntstate *clnt, int argcnt, char **err) |
| 6473 | { |
no test coverage detected